Forum Scorpioon OTS Strona Główna
RejestracjaSzukajFAQUżytkownicyGrupyGalerieZaloguj
takie tam do domku
Idź do strony Poprzedni  1, 2, 3  Następny
 
Odpowiedz do tematu    Forum Scorpioon OTS Strona Główna » Newsy Zobacz poprzedni temat
Zobacz następny temat
takie tam do domku
Autor Wiadomość
Sord De Chaos
Player
Player



Dołączył: 22 Cze 2006
Posty: 137
Przeczytał: 0 tematów

Ostrzeżeń: 5/7

Post
Aha Razz To faktycznie zle przeczytalem ^^ A dostanem nagrode ?:> Takom jak mowiles ?Razz Albo dobra nic nie mowie ^^ Bo jeszcze sie rozmyslisz Razz


Post został pochwalony 0 razy
Wto 12:50, 27 Cze 2006 Zobacz profil autora
Sapless
Moderator
Moderator



Dołączył: 24 Cze 2006
Posty: 115
Przeczytał: 0 tematów

Ostrzeżeń: 4/7
Skąd: Rzeszów

Post
Scorpik własnie teraaz zabral sie za bed sysstem ;] tylko sie troszq na mnie zdenerwowal jak zapytalem kiedy bedzie ots ;/ ...


Post został pochwalony 0 razy
Wto 13:51, 27 Cze 2006 Zobacz profil autora
ScorpiOOn
Administrator
Administrator



Dołączył: 22 Cze 2006
Posty: 397
Przeczytał: 0 tematów

Ostrzeżeń: 0/7
Skąd: Warszawa

Post
Kur** sord to gowno nie dziala, to znaczy ots sie wlacza ale jak chce isc spac to nie dziala, i niech zgadne ty stwirdziles ze to dziala bo ci sie ots ku** wlaczyl? a to nie tylko to trzeba zrobic to trzeba przetestowac aha i to raczej jest na 7.5 bo ku** po 1: id mi sie wydaje ze sa na 7.5 i pozatym niema pliku protocol75.cpp tylko protocol76.cpp czyli ten skrypt jest na 7.5 kur*** wiec jak nie wiesz dokladnie to sie nie madrzyj ^^
(protocol75 jest na 7.5 tibie a protocol76 na tibie 7.6) :[


Post został pochwalony 0 razy
Wto 13:58, 27 Cze 2006 Zobacz profil autora
Sord De Chaos
Player
Player



Dołączył: 22 Cze 2006
Posty: 137
Przeczytał: 0 tematów

Ostrzeżeń: 5/7

Post
Yyyyy .. Aha Razz Oki Srry wait zaraz zaraz mam gdzies na 7.6 przetestuje i powiem
Confused

@Edit 27 czerwca 2006 roku

Właśnie znalazłem pod 7.6 Smile I dziala :] Jak Nie bedzie dziala to chyba je*** walne na ziemie ... Bo mi dziala wszystko kozacko ... a o to linker Smile
[link widoczny dla zalogowanych]


Post został pochwalony 0 razy

Ostatnio zmieniony przez Sord De Chaos dnia Wto 14:44, 27 Cze 2006, w całości zmieniany 2 razy
Wto 14:02, 27 Cze 2006 Zobacz profil autora
DaMciO
Administrator
Administrator



Dołączył: 22 Cze 2006
Posty: 238
Przeczytał: 0 tematów

Ostrzeżeń: 0/7
Skąd: Stalowa Wola

Post
tez gdzies mam bed systems pod 7.6 zaraz poszukam


Post został pochwalony 0 razy
Wto 14:08, 27 Cze 2006 Zobacz profil autora
DaMciO
Administrator
Administrator



Dołączył: 22 Cze 2006
Posty: 238
Przeczytał: 0 tematów

Ostrzeżeń: 0/7
Skąd: Stalowa Wola

Post
Masz Tu Bed System-a


Bed System

Odrazu na wstepie mowie ze to nei jest moj bed system.Znalazlem go na otfans.pl i chce tu go zamiescic

w pliku game.cpp na koncu plku dodaj:

Kod PHP:
#ifdef TLM_BEDS
bool Game::loadBeds(std::string file)
{
xmlDocPtr doc;
doc = xmlParseFile(file.c_str());
if (doc){
xmlNodePtr root, p, tmp;
root = xmlDocGetRootElement(doc);
if (xmlStrcmp(root->name, (const xmlChar*)"beds")) {
xmlFreeDoc(doc);
return -1;
}
tmp = root->children;
int x,y,z,id;
while(tmp){
if (strcmp((char*) tmp->name, "bed")==0){
x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x"));
y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y"));
z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z"));
id = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "id"));
Position mainPos(x, y, z);
Item *mainItem = Item::CreateItem(id);
Tile *mainTile = getTile(mainPos.x, mainPos.y, mainPos.z);
if (mainTile && mainItem){
Position nextPos(x, y, z);
Item *nextItem = Item::CreateItem(id+1);
if (id == 1754 || id == 1758 || id == 1762 || id == 1766){
nextPos.y++;
}
else if(id == 1756 || id == 1760 || id == 1764 || id == 1768){
nextPos.x++;
}
Tile *nextTile = getTile(nextPos.x, nextPos.y, nextPos.z);
if (nextTile && nextItem){
mainTile->addThing(mainItem);
mainItem->pos = mainPos;
nextTile->addThing(nextItem);
nextItem->pos = nextPos;
}
}
}
tmp = tmp->next;
}
xmlFreeDoc(doc);
return 0;
}
return -1;
}
std::string Game::getBedSleeper(const Position pos)
{
std::string file="data/beds.xml";
xmlDocPtr doc;
doc = xmlParseFile(file.c_str());
if (doc){
xmlNodePtr root, tmp;
root = xmlDocGetRootElement(doc);
if (xmlStrcmp(root->name, (const xmlChar*)"beds")) {
xmlFreeDoc(doc);
return "Nobody";
}
tmp = root->children;
while(tmp){
if (strcmp((const char*) tmp->name, "bed")==0){
int x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x"));
int y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y"));
int z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z"));
if (x == pos.x && y == pos.y && z == pos.z){
return (const char*)xmlGetProp(tmp, (const xmlChar *)"name");
}
}
tmp = tmp->next;
}
xmlFreeDoc(doc);
}
return "Nobody";
}
unsigned int Game::getBedID(const Position pos)
{
std::string file="data/beds.xml";
xmlDocPtr doc;
doc = xmlParseFile(file.c_str());
if (doc){
xmlNodePtr root, tmp;
root = xmlDocGetRootElement(doc);
if (xmlStrcmp(root->name, (const xmlChar*)"beds")) {
xmlFreeDoc(doc);
return 0;
}
tmp = root->children;
while(tmp){
if (strcmp((const char*) tmp->name, "bed")==0){
int x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x"));
int y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y"));
int z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z"));
if (x == pos.x && y == pos.y && z == pos.z){
return atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "id"));
}
}
tmp = tmp->next;
}
xmlFreeDoc(doc);
}
return 0;
}

bool Game::changeBed(const Position pos, unsigned int oldid, std::string sleepname)
{
Tile *maintile = getTile(pos.x,pos.y,pos.z);
Item *mainitem = dynamic_cast<Item*>(maintile->getThingByStackPos(maintile->getThingCount()-1));
if (mainitem && maintile->isHouse()){
Position tilePos(pos.x, pos.y, pos.z);
if (oldid == 1754 || oldid == 1758 || oldid == 1762 || oldid == 1766){
tilePos.y++;
}
else if(oldid == 1756 || oldid == 1760 || oldid == 1764 || oldid == 1768){
tilePos.x++;
}
Tile *nexttile = getTile(tilePos.x,tilePos.y,tilePos.z);
Item *nextitem = dynamic_cast<Item*>(nexttile->getThingByStackPos(maintile->getThingCount()-1));
if (nextitem && nexttile->isHouse()){
if (oldid == 1754 || oldid == 1758){
mainitem->setID(oldid+Cool;
}
else if(oldid == 1756){
mainitem->setID(1768);
}
else if(oldid == 1760){
mainitem->setID(1764);
}
else if(oldid == 1762 || oldid == 1766){
mainitem->setID(oldid-Cool;
}
else if(oldid == 1764){
mainitem->setID(1760);
}
else if(oldid == 1768){
mainitem->setID(1756);
}
nextitem->setID(mainitem->getID()+1);
creatureBroadcastTileUpdated(pos);
creatureBroadcastTileUpdated(tilePos);

std::string file="data/beds.xml";
xmlDocPtr doc;
doc = xmlParseFile(file.c_str());
if (doc){
xmlNodePtr root, tmp;
root = xmlDocGetRootElement(doc);
if (xmlStrcmp(root->name, (const xmlChar*)"beds")) {
xmlFreeDoc(doc);
return false;
}
Position bedPos[1000];// 1000 = number of beds
unsigned int id[1000];
std::string name[1000];
int i = 0;
tmp = root->children;
while(tmp){
if (strcmp((const char*) tmp->name, "bed")==0){
i++;
bedPos[i].x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x" ));
bedPos[i].y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y" ));
bedPos[i].z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z" ));
id[i] = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "id" ));
name[i] = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "name"));
if (bedPos[i] == pos){
id[i] = mainitem->getID();
name[i] = sleepname;
}
}
tmp = tmp->next;
}
doc = xmlNewDoc((const xmlChar*)"1.0");
doc->children = xmlNewDocNode(doc, NULL, (const xmlChar*)"beds", NULL);
root = doc->children;

std::stringstream sb;
for(int x = 1; x <= i; x++){
tmp = xmlNewNode(NULL,(const xmlChar*)"bed");
sb << bedPos[x].x; xmlSetProp(tmp, (const xmlChar*) "x" , (const xmlChar*)sb.str().c_str()); sb.str("");
sb << bedPos[x].y; xmlSetProp(tmp, (const xmlChar*) "y" , (const xmlChar*)sb.str().c_str()); sb.str("");
sb << bedPos[x].z; xmlSetProp(tmp, (const xmlChar*) "z" , (const xmlChar*)sb.str().c_str()); sb.str("");
sb << id[x]; xmlSetProp(tmp, (const xmlChar*) "id", (const xmlChar*)sb.str().c_str()); sb.str("");
sb << name[x]; xmlSetProp(tmp, (const xmlChar*) "name", (const xmlChar*)sb.str().c_str()); sb.str("");
xmlAddChild(root, tmp);
}
xmlSaveFile(file.c_str(), doc);
xmlFreeDoc(doc);
return true;
}
}
}
return false;
}
Position Game::getBedPos(std::string name)
{
std::string file="data/beds.xml";
xmlDocPtr doc;
doc = xmlParseFile(file.c_str());
if (doc){
xmlNodePtr root, tmp;
root = xmlDocGetRootElement(doc);
if (xmlStrcmp(root->name, (const xmlChar*)"beds")) {
xmlFreeDoc(doc);
return Position(0xFFFF,0xFFFF,0xFF);
}
tmp = root->children;
while(tmp){
if (strcmp((const char*) tmp->name, "bed")==0){
std::string sleepname = (const char*)xmlGetProp(tmp, (const xmlChar *)"name");
if (sleepname == name){
int x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x"));
int y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y"));
int z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z"));
return Position(x,y,z);
}
}
tmp = tmp->next;
}
xmlFreeDoc(doc);
}
return Position(0xFFFF,0xFFFF,0xFF);
}

void Game::sendMagicEffect(const Position pos, unsigned char type)
{
SpectatorVec list;
SpectatorVec::iterator it;
getSpectators(Range(pos, true), list);
for(it = list.begin(); it != list.end(); ++it) {
Player* spectator = dynamic_cast<Player*>(*it);
if (spectator){
spectator->sendMagicEffect(pos, type);
}
}
}
#endif //TLM_BEDS

W pliku game.h pod linijką:
Kod PHP:
~Game();

dodaj:
Kod PHP:
#ifdef TLM_BEDS
std::string getBedSleeper(const Position pos);
unsigned int getBedID(const Position pos);
Position getBedPos(std::string name);

bool changeBed(const Position pos, unsigned int oldid, std::string sleepname);
bool loadBeds(std::string file);
#endif //TLM BEDS
W pliku item.cpp na końcu pliku dodaj
Kod PHP:
#ifdef TLM_BEDS
bool Item::isBed()
{
if(id == 1754 || id == 1755 || id == 1756 || id == 1757 || id == 1758 || id == 1759 || id == 1760 || id == 1761 || id == 1762 || id == 1763 || id == 1764 || id == 1765 || id == 1766 || id == 1767 || id == 1768 || id == 1769)
return true;
else return false;
}
#endif //TLM_BEDS
W pliku item.h pod:
Kod PHP:
bool isDecaying;
dodaj:
Kod PHP:
#ifdef TLM_BEDS
bool isBed();
#endif //TLM_BEDS
W pliku otserv.cpp pod:
Kod PHP:
#ifdef TLM_HOUSE_SYSTEM
std::cout << ":: Loading houses.xml... ";
if (!Houses::Load(&g_game))
{
ErrorMessage("Could not load houses!");
return -1;
}
std::cout << "[done]" << std::endl;
#endif //TLM_HOUSE_SYSTEM
Dodaj:
Kod PHP:
#ifdef TLM_BEDS
std::cout << ":: Loading beds.xml... ";
if(g_game.loadBeds("data/beds.xml")){;
ErrorMessage("Could not load data/beds.xml!");
return -1;
}
std::cout << "[done]" << std::endl;
#endif //TLM_BEDS
W pliku player.cpp pod:
Kod PHP:
internal_ping = 0;
dodaj:
Kod PHP:
#ifdef TLM_BEDS
lastlogout = 0;
#endif //TLM_BEDS
Na końcu pliku dodaj:
Kod PHP:
#ifdef TLM_BEDS
void Player::sendLogout()
{
client->logout();
}

void Player::sendKick()
{
this->kicked = true;
client->sendKick();
}


bool Player::isSleeping()
{
std::string file="data/beds.xml";
xmlDocPtr doc;
doc = xmlParseFile(file.c_str());
if (doc){
xmlNodePtr root, tmp;
root = xmlDocGetRootElement(doc);
if (xmlStrcmp(root->name, (const xmlChar*)"beds")) {
xmlFreeDoc(doc);
return false;
}
tmp = root->children;
while(tmp){
if (strcmp((const char*) tmp->name, "bed")==0){
std::string sleepname = (const char*)xmlGetProp(tmp, (const xmlChar *)"name");
if (sleepname == this->name){
return true;
}
}
tmp = tmp->next;
}
xmlFreeDoc(doc);
}
return false;
}
#endif //TLM_BEDS
W pliku player.h
pod linijką:
Kod PHP:
public:
dodaj:
Kod PHP:
#ifdef TLM_BEDS
time_t lastlogout;
bool isSleeping();
void sendLogout();
bool kicked;
void sendKick();
#endif //TLM_BEDS
W pliku protocol76.cpp NAD:
Kod PHP:
#ifdef TLM_HOUSE_SYSTEM
Tile* doorTile = game->getTile(LookPos);
dodaj:
Kod PHP:
#ifdef TLM_BEDS
if(item->isBed()){
Position pos(LookPos.x, LookPos.y, LookPos.z);
std::stringstream bedtext;
bedtext << "You see a bed"/*<< item->getName()*/
<< ".\n " << game->getBedSleeper(pos) << " is sleeping there.";
AddTextMessage(newmsg, MSG_INFO,
bedtext.str().c_str());
sendNetworkMessage(&newmsg);
return;
}
#endif //TLM_BEDS

Teraz naciśnij ALT + P przejdź do zakładki PARAMETERS i w sub tabeli C++ compiler dodaj na końcu tabelki:

Kod PHP:
-DTLM_BEDS


Mam nadzieje ze niktorym pomoglem


Post został pochwalony 0 razy
Wto 14:10, 27 Cze 2006 Zobacz profil autora
DaMciO
Administrator
Administrator



Dołączył: 22 Cze 2006
Posty: 238
Przeczytał: 0 tematów

Ostrzeżeń: 0/7
Skąd: Stalowa Wola

Post
Albo Drugi

Może się komuś przydać
Ale trzeba chwilke posiedzieć nad źródełkami

Pliki do edycji:

* game.h
* game.cpp
* player.h
* player.cpp
* protocol75.cpp
* otserv.cpp


No to zabieramy się do pracy
Otwieramy plik game.h i szukamy w nim tej linijki:
Kod:

bool creatureSaySpell(Creature *creature, const std::string &text);

... i wklepujemy pod nią to :
Kod:

//----------- Bed System Begin ----------- std::string getBedSleeper(const Position pos); unsigned int getBedID(const Position pos); Position getBedPos(std::string name); bool changeBed(const Position pos, unsigned int oldid, std::string sleepname); bool loadBeds(std::string file); //----------- Bed System End -----------

Zapisujemy zmiany i otwieramy plik game.cpp szukamy tam:
Kod:

#ifdef __DEBUG_PLAYERS__ std::cout << (uint32_t)getPlayersOnline() << " players online." << std::endl; #endif

... i zamieniamy na:
Kod:

#ifdef __DEBUG_PLAYERS__ std::cout << (uint32_t)getPlayersOnline() << " players online." << std::endl; if (p->isSleeping()){ changeBed(getBedPos(p->getName()), getBedID(getBedPos(p->getName())), "Nobody"); } #endif


Dalej plik game.cpp znajdź około wiersza 4100:
Kod:

bool Game::playerUseItem(Player *player, const Position& pos, const unsigned char stackpos, const unsigned short itemid, unsigned char index) { OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::playerUseItem()"); if(player->isRemoved) return false; actions.UseItem(player,pos,stackpos,itemid,index); return true; }

I zamień na:
Kod:

bool Game::playerUseItem(Player *player, const Position& pos, const unsigned char stackpos, const unsigned short itemid, unsigned char index) { OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::playerUseItem()"); if(itemid == 2455 || itemid == 2457 || itemid == 2459 || itemid == 2461 || itemid == 2471 || itemid == 2473 /*|| itemid == 1762 || itemid == 1764 || itemid == 1766 || itemid == 1768*/){ if (changeBed(pos, itemid, player->getName())){ teleport(player, pos); player->sendLogout(); return true; } else{ player->sendCancel("Sorry, not possible."); return false; } } if(player->isRemoved) return false; actions.UseItem(player,pos,stackpos,itemid,index); return true; }


Jeszcze tylko to (dodaj na samym końcu pliku):

Kod:

bool Game::loadBeds(std::string file) { xmlDocPtr doc; doc = xmlParseFile(file.c_str()); if (doc){ xmlNodePtr root, p, tmp; root = xmlDocGetRootElement(doc); if (xmlStrcmp(root->name, (const xmlChar*)"beds")) { xmlFreeDoc(doc); return -1; } tmp = root->children; int x,y,z,id; while(tmp){ if (strcmp((char*) tmp->name, "bed")==0){ x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x")); y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y")); z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z")); id = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "id")); Position mainPos(x, y, z); Item *mainItem = Item::CreateItem(id); Tile *mainTile = getTile(mainPos.x, mainPos.y, mainPos.z); if (mainTile && mainItem){ Position nextPos(x, y, z); Item *nextItem = Item::CreateItem(id+1); if (id == 2455 || id == 2459 || id == 2463 || id == 2467 || id == 2471 || id == 2475){ nextPos.y++; } else if(id == 2457 || id == 2461 || id == 2465 || id == 2469 || id == 2473 || id == 2477){ nextPos.x++; } Tile *nextTile = getTile(nextPos.x, nextPos.y, nextPos.z); if (nextTile && nextItem){ mainTile->addThing(mainItem); mainItem->pos = mainPos; nextTile->addThing(nextItem); nextItem->pos = nextPos; } } } tmp = tmp->next; } xmlFreeDoc(doc); return 0; } return -1; } std::string Game::getBedSleeper(const Position pos) { std::string file="data/world/beds.xml"; xmlDocPtr doc; doc = xmlParseFile(file.c_str()); if (doc){ xmlNodePtr root, tmp; root = xmlDocGetRootElement(doc); if (xmlStrcmp(root->name, (const xmlChar*)"beds")) { xmlFreeDoc(doc); return "Nobody"; } tmp = root->children; while(tmp){ if (strcmp((const char*) tmp->name, "bed")==0){ int x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x")); int y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y")); int z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z")); if (x == pos.x && y == pos.y && z == pos.z){ return (const char*)xmlGetProp(tmp, (const xmlChar *)"name"); } } tmp = tmp->next; } xmlFreeDoc(doc); } return "Nobody"; } unsigned int Game::getBedID(const Position pos) { std::string file="data/world/beds.xml"; xmlDocPtr doc; doc = xmlParseFile(file.c_str()); if (doc){ xmlNodePtr root, tmp; root = xmlDocGetRootElement(doc); if (xmlStrcmp(root->name, (const xmlChar*)"beds")) { xmlFreeDoc(doc); return 0; } tmp = root->children; while(tmp){ if (strcmp((const char*) tmp->name, "bed")==0){ int x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x")); int y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y")); int z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z")); if (x == pos.x && y == pos.y && z == pos.z){ return atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "id")); } } tmp = tmp->next; } xmlFreeDoc(doc); } return 0; } bool Game::changeBed(const Position pos, unsigned int oldid, std::string sleepname) { Tile *maintile = getTile(pos.x,pos.y,pos.z); Item *mainitem = dynamic_cast<Item*>(maintile->getThingByStackPos(maintile->getThingCount()-1)); if (mainitem && maintile->isPz()){ Position tilePos(pos.x, pos.y, pos.z); if (oldid == 2455 || oldid == 2459 || oldid == 2463 || oldid == 2467 || oldid == 2471 || oldid == 2475){ tilePos.y++; } else if(oldid == 2457 || oldid == 2461 || oldid == 2465 || oldid == 2469 || oldid == 2473 || oldid == 2477){ tilePos.x++; } Tile *nexttile = getTile(tilePos.x,tilePos.y,tilePos.z); Item *nextitem = dynamic_cast<Item*>(nexttile->getThingByStackPos(maintile->getThingCount()-1)); if (nextitem && nexttile->isPz()){ if (oldid == 2455 || oldid == 2459){ mainitem->setID(oldid+Cool; } else if(oldid == 2457){ mainitem->setID(2469); } else if(oldid == 2461){ mainitem->setID(2465); } else if(oldid == 2463 || oldid == 2467){ mainitem->setID(oldid-Cool; } else if(oldid == 2475 || oldid == 2477){ mainitem->setID(oldid-Cool; } else if(oldid == 2465){ mainitem->setID(2461); } else if(oldid == 2469){ mainitem->setID(2457); } else if(oldid == 2475){ mainitem->setID(2471); } else if(oldid == 2477){ mainitem->setID(2473); } nextitem->setID(mainitem->getID()+1); SpectatorVec list; SpectatorVec::iterator it; getSpectators(Range(tilePos, true), list); //players for(it = list.begin(); it != list.end(); ++it) { if(dynamic_cast<Player*>(*it)) { (*it)->onTileUpdated(pos); (*it)->onTileUpdated(tilePos); } } //Player *player = dynamic_cast<Player*>(player); //player->onTileUpdated(pos); //player->onTileUpdated(tilePos); std::string file="data/world/beds.xml"; xmlDocPtr doc; doc = xmlParseFile(file.c_str()); if (doc){ xmlNodePtr root, tmp; root = xmlDocGetRootElement(doc); if (xmlStrcmp(root->name, (const xmlChar*)"beds")) { xmlFreeDoc(doc); return false; } Position bedPos[1000];// 1000 = number of beds unsigned int id[1000]; std::string name[1000]; int i = 0; tmp = root->children; while(tmp){ if (strcmp((const char*) tmp->name, "bed")==0){ i++; bedPos[i].x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x" )); bedPos[i].y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y" )); bedPos[i].z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z" )); id[i] = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "id" )); name[i] = (const char*) xmlGetProp(tmp, (const xmlChar*) "name"); if (bedPos[i] == pos){ id[i] = mainitem->getID(); name[i] = sleepname; } } tmp = tmp->next; } doc = xmlNewDoc((const xmlChar*)"1.0"); doc->children = xmlNewDocNode(doc, NULL, (const xmlChar*)"beds", NULL); root = doc->children; std::stringstream sb; for(int x = 1; x <= i; x++){ tmp = xmlNewNode(NULL,(const xmlChar*)"bed"); sb << bedPos[x].x; xmlSetProp(tmp, (const xmlChar*) "x" , (const xmlChar*)sb.str().c_str()); sb.str(""); sb << bedPos[x].y; xmlSetProp(tmp, (const xmlChar*) "y" , (const xmlChar*)sb.str().c_str()); sb.str(""); sb << bedPos[x].z; xmlSetProp(tmp, (const xmlChar*) "z" , (const xmlChar*)sb.str().c_str()); sb.str(""); sb << id[x]; xmlSetProp(tmp, (const xmlChar*) "id", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << name[x]; xmlSetProp(tmp, (const xmlChar*) "name", (const xmlChar*)sb.str().c_str()); sb.str(""); xmlAddChild(root, tmp); } xmlSaveFile(file.c_str(), doc); xmlFreeDoc(doc); return true; } return false; } } } Position Game::getBedPos(std::string name) { std::string file="data/world/beds.xml"; xmlDocPtr doc; doc = xmlParseFile(file.c_str()); if (doc){ xmlNodePtr root, tmp; root = xmlDocGetRootElement(doc); if (xmlStrcmp(root->name, (const xmlChar*)"beds")) { xmlFreeDoc(doc); return Position(0xFFFF,0xFFFF,0xFF); } tmp = root->children; while(tmp){ if (strcmp((const char*) tmp->name, "bed")==0){ std::string sleepname = (const char*)xmlGetProp(tmp, (const xmlChar *)"name"); if (sleepname == name){ int x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x")); int y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y")); int z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z")); return Position(x,y,z); } } tmp = tmp->next; } xmlFreeDoc(doc); } return Position(0xFFFF,0xFFFF,0xFF); }


Zapisujemy zmiany i otwieramy plik player.h do klasy player w sekcji public dodajemy:
Kod:

bool isSleeping(); void sendLogout();

Otwieramy plik player.cpp szukamy linijki:
Kod:

#endif //YUR_LIGHT_ITEM

... podspodem dodajemy:
Kod:

void Player::sendLogout() { client->logout(); } bool Player::isSleeping() { std::string file="data/world/beds.xml"; xmlDocPtr doc; doc = xmlParseFile(file.c_str()); if (doc){ xmlNodePtr root, tmp; root = xmlDocGetRootElement(doc); if (xmlStrcmp(root->name, (const xmlChar*)"beds")) { xmlFreeDoc(doc); return false; } tmp = root->children; while(tmp){ if (strcmp((const char*) tmp->name, "bed")==0){ std::string sleepname = (const char*)xmlGetProp(tmp, (const xmlChar *)"name"); if (sleepname == this->name){ return true; } } tmp = tmp->next; } xmlFreeDoc(doc); } return false; }

Zapisujemy zmiany i otwieramy plik protocol75.cpp szukamy:
Kod:

#endif //TLM_HOUSE_SYSTEM {

... zamieniamy na :
Kod:

#endif //TLM_HOUSE_SYSTEM { if(ItemNum >= 2463 && ItemNum <= 2470 || ItemNum >= 2475 && ItemNum <= 2477){ Position pos(LookPos.x, LookPos.y, LookPos.z); std::stringstream bedtext; if (ItemNum == 2464 || ItemNum == 2468 || ItemNum == 2472 ){ pos.y--; } else if(ItemNum == 2466 || ItemNum == 2470 || ItemNum == 2474){ pos.x--; } bedtext << "You see a bed"/*<< item->getName()*/ << ".\n " << game->getBedSleeper(pos) << " is sleeping there."; AddTextMessage(newmsg, MSG_INFO, bedtext.str().c_str()); } if(ItemNum == 2455 || ItemNum == 2461){ Position pos(LookPos.x, LookPos.y, LookPos.z); std::stringstream bedtext2; bedtext2 << "You see a bed\n Nobody is sleeping there."; AddTextMessage(newmsg, MSG_INFO, bedtext2.str().c_str()); } if(ItemNum == 2457 || ItemNum == 2459){ Position pos(LookPos.x, LookPos.y, LookPos.z); std::stringstream bedtext2; bedtext2 << "You see a cot\n Nobody is sleeping there."; AddTextMessage(newmsg, MSG_INFO, bedtext2.str().c_str()); } if(ItemNum == 2471 || ItemNum == 2473){ Position pos(LookPos.x, LookPos.y, LookPos.z); std::stringstream bedtext2; bedtext2 << "You see a hammock\n Nobody is sleeping there."; AddTextMessage(newmsg, MSG_INFO, bedtext2.str().c_str()); }

Został nam ostatni plik otserv.cpp szykamy tam :
Kod:

// Call to WSA Startup on Windows Systems...

... i zamieniamy na:
Kod:

// Call to WSA Startup on Windows Systems... //load beds std::cout << ":: Loaded Beds ... ";; if(g_game.loadBeds("data/world/beds.xml")){; ErrorMessage("Could not load data/world/beds.xml!"); return -1; } std::cout << "[done]" << std::endl;


W katalogu world dodajemy plik beds.xml:
Kod:

<?xml version="1.0"?> <beds> <bed x="151" y="29" z="7" id="2455" name="Nobody"/> </beds>

Gdzie x,y,z to współrzędne, id="2455" to numerek łóżka, a name="Nobody" oznacza czy ktoś w nim śpi

Uff to się napisałęm może komuś się przyda


Post został pochwalony 0 razy
Wto 14:12, 27 Cze 2006 Zobacz profil autora
ScorpiOOn
Administrator
Administrator



Dołączył: 22 Cze 2006
Posty: 397
Przeczytał: 0 tematów

Ostrzeżeń: 0/7
Skąd: Warszawa

Post
EE wlasnie ten drugi mi podal sord i on jest na 7.6 ale porobie z tym 1 !!


Post został pochwalony 0 razy
Wto 14:26, 27 Cze 2006 Zobacz profil autora
ScorpiOOn
Administrator
Administrator



Dołączył: 22 Cze 2006
Posty: 397
Przeczytał: 0 tematów

Ostrzeżeń: 0/7
Skąd: Warszawa

Post
Cenzura Damcio bys sie chyba nauczyl kopiowac wes lepiej podaj linka do tego bo to co ty podales to kur*** ch** nic nieda sie sprawdzic ^^ i nie wiadomo gdziue to wpisac ^^


Post został pochwalony 0 razy
Wto 14:31, 27 Cze 2006 Zobacz profil autora
Sord De Chaos
Player
Player



Dołączył: 22 Cze 2006
Posty: 137
Przeczytał: 0 tematów

Ostrzeżeń: 5/7

Post
ScorpiOOn łap:) Dziala na bank pod 7.6 jest ;]
[link widoczny dla zalogowanych]


Post został pochwalony 0 razy
Wto 14:45, 27 Cze 2006 Zobacz profil autora
ScorpiOOn
Administrator
Administrator



Dołączył: 22 Cze 2006
Posty: 397
Przeczytał: 0 tematów

Ostrzeżeń: 0/7
Skąd: Warszawa

Post
Kur** nie moge znalesc w pliku player.cpp tej linijki ^^ :[
Kod:
 internal_ping = 0;



Post został pochwalony 0 razy
Wto 17:43, 27 Cze 2006 Zobacz profil autora
ScorpiOOn
Administrator
Administrator



Dołączył: 22 Cze 2006
Posty: 397
Przeczytał: 0 tematów

Ostrzeżeń: 0/7
Skąd: Warszawa

Post
Eh kur** jeba** to ja pier** nie dziala i ja juz sie pogbuilem kur** i skoro nikt nawet pomoc nie chce to nie bedziecie mieli tego zasr*** beds systemu nie dosc ze nie moge znalesc tej zasr*** linijki podanej w poscie wyrzej to jeszcze Cenzura nie lapie tego ^^
Cytat:
Teraz naciśnij ALT + P przejdź do zakładki PARAMETERS i w sub tabeli C++ compiler dodaj na końcu tabelki

Je*** to Neutral


Post został pochwalony 0 razy
Wto 18:22, 27 Cze 2006 Zobacz profil autora
Sord De Chaos
Player
Player



Dołączył: 22 Cze 2006
Posty: 137
Przeczytał: 0 tematów

Ostrzeżeń: 5/7

Post
Kuuuurde :/ To czekaj Sproboje znaleść takiego gdzie nie trzeba tego gownianego alt+ costam Postaram sie znalesc jakiegos lepszego bez kombinowania
Crying or Very sad


Post został pochwalony 0 razy
Wto 18:51, 27 Cze 2006 Zobacz profil autora
Sapless
Moderator
Moderator



Dołączył: 24 Cze 2006
Posty: 115
Przeczytał: 0 tematów

Ostrzeżeń: 4/7
Skąd: Rzeszów

Post
Skorpion zanim to zrobisz to ci "pikawa" pierdo***nie :]


Post został pochwalony 0 razy
Wto 19:47, 27 Cze 2006 Zobacz profil autora
Sapless
Moderator
Moderator



Dołączył: 24 Cze 2006
Posty: 115
Przeczytał: 0 tematów

Ostrzeżeń: 4/7
Skąd: Rzeszów

Post
Podobno Ten Bed system "kraszuje" server ...


Post został pochwalony 0 razy
Wto 20:16, 27 Cze 2006 Zobacz profil autora
Wyświetl posty z ostatnich:    
Odpowiedz do tematu    Forum Scorpioon OTS Strona Główna » Newsy Wszystkie czasy w strefie EET (Europa)
Idź do strony Poprzedni  1, 2, 3  Następny
Strona 2 z 3

 
Skocz do: 
Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach


fora.pl - załóż własne forum dyskusyjne za darmo
Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Music Lyrics.
Regulamin