Fala ae galerinha do xtibia...
Bom vejo que muitos programadores ainda estão em dúvida para passar o seu ot para 8.6 ...
Bom então estou fazendo um tutorial...
Testado em tfs 0.3.6pl1
Sources:
Em House.cpp:
Procure:
std::string metachars = ".[{}()\\+|^{:content:}quot;;
Substitua por:
std::string metachars = ".[{}()\\+|^$*?";
Procure:
if(metachars.find(*it) != std::string::npos) outExp += "\\";
Subistitua por:
if(metachars.find(*it) != std::string::npos) outExp += "";
Procure:
replaceString(outExp, "*", ".*"); replaceString(outExp, "?", ".?");
Subistitua por:
replaceString(outExp, "*", ""); replaceString(outExp, "?", "");
Em resources.h:
Procure:
#define CLIENT_VERSION_MIN 854 #define CLIENT_VERSION_MAX 854 #define CLIENT_VERSION_STRING "Only clients with protocol 8.54 are allowed!" #define STATUS_SERVER_NAME "TheForgottenServer" #define STATUS_SERVER_VERSION "0.3.6" #define STATUS_SERVER_CODENAME "Crying Damson" #define STATUS_SERVER_PROTOCOL "8.54"
Substitua por:
#define CLIENT_VERSION_MIN 860 #define CLIENT_VERSION_MAX 860 #define CLIENT_VERSION_STRING "Only clients with protocol 8.60 are allowed!" #define STATUS_SERVER_NAME "TheForgottenServer" #define STATUS_SERVER_VERSION "0.3.6" #define STATUS_SERVER_CODENAME "Crying Damson" #define STATUS_SERVER_PROTOCOL "8.60"
Em itemloader.h:
Procure:
CLIENT_VERSION_854 = 16
Substitua e adicione por:
CLIENT_VERSION_854 = 16, CLIENT_VERSION_855 = 17, CLIENT_VERSION_856 = 18, CLIENT_VERSION_857 = 19, CLIENT_VERSION_860 = 20
Em items.cpp:
Procure:
else if(Items::dwMinorVersion != CLIENT_VERSION_854)
Substitua e adicione por:
else if(Items::dwMinorVersion != 19)
Em protocolgame.cpp:
Procure:
void ProtocolGame::parseAttack(NetworkMessage& msg) { uint32_t creatureId = msg.GetU32(); addGameTask(&Game::playerSetAttackedCreature, player->getID(), creatureId); }
Substitua por:
void ProtocolGame::parseAttack(NetworkMessage& msg) { uint32_t creatureId = msg.GetU32(); msg.GetU32(); msg.GetU32(); addGameTask(&Game::playerSetAttackedCreature, player->getID(), creatureId); }
Também procure:
void ProtocolGame::sendCancelTarget() { NetworkMessage_ptr msg = getOutputBuffer(); if(msg) { TRACK_MESSAGE(msg); msg->AddByte(0xA3); } }
Substitua por:
void ProtocolGame::sendCancelTarget() { NetworkMessage_ptr msg = getOutputBuffer(); if(msg) { TRACK_MESSAGE(msg); msg->AddByte(0xA3); msg->AddU32(0); } }
Em spells.cpp (somente em spells.cpp)
Procure:
g_game.transformItem(item, item->getID(), std::max((int32_t)0, ((int32_t)item->getCharges()) - 1));
Substitua por:
g_game.transformItem(item, item->getID(), std::max((int32_t)0, ((int32_t)item->getItemCount()) - 1));
Em tools.cpp:
Procure:
{"insects", MAGIC_EFFECT_INSECTS}
Substitua por:
{"insects", MAGIC_EFFECT_INSECTS}, {"dragonhead", MAGIC_EFFECT_DRAGONHEAD}
Em const.h:
Procure:
MAGIC_EFFECT_INSECTS = 0x44, //68 MAGIC_EFFECT_LAST = MAGIC_EFFECT_INSECTS,
Substitua por:
MAGIC_EFFECT_INSECTS = 0x44, //68, MAGIC_EFFECT_DRAGONHEAD = 0x45, //69 MAGIC_EFFECT_LAST = MAGIC_EFFECT_DRAGONHEAD,
Em game.cpp:
Procure:
void Game::showHotkeyUseMessage(Player* player, Item* item) { int32_t subType = -1; if(item->hasSubType() && !item->hasCharges()) subType = item->getSubType(); const ItemType& it = Item::items[item->getID()]; uint32_t count = player->__getItemTypeCount(item->getID(), subType, false); char buffer[40 + it.name.size()]; if(count == 1) sprintf(buffer, "Using the last %s...", it.name.c_str()); else sprintf(buffer, "Using one of %d %s...", count, it.pluralName.c_str()); player->sendTextMessage(MSG_INFO_DESCR, buffer); }
Substitua por:
void Game::showHotkeyUseMessage(Player* player, Item* item) { const ItemType& it = Item::items[item->getID()]; uint32_t count = player->__getItemTypeCount(item->getID(), -1); char buffer[40 + it.name.size()]; if(count == 1) sprintf(buffer, "Using the last %s...", it.name.c_str()); else sprintf(buffer, "Using one of %d %s...", count, it.pluralName.c_str()); player->sendTextMessage(MSG_INFO_DESCR, buffer); }
Em npc.cpp:
Procure:
li.itemId = intValue;
Embaixo adicione:
const ItemType& it = Item::items[li.itemId];
Também procure:
if(readXMLInteger(tmpNode, "subtype", intValue)) li.subType = intValue;
Embaixo adicione:
else { if(it.stackable) li.subType = 1; else if(it.isFluidContainer() || it.isSplash()) li.subType = 0; }
Em item.cpp:
Procure:
s << "("; if(!it.runeSpellName.empty()) s << "\"" << it.runeSpellName << "\", "; s << "Charges:" << subType <<")";
Embaixo adicione:
if(!it.runeSpellName.empty()) s << "(\"" << it.runeSpellName << "\")";
Em luascript.cpp:
Procure por:
//getCreatureHealth(cid) lua_register(m_luaState, "getCreatureHealth", LuaScriptInterface::luaGetCreatureHealth);
Embaixo adicione:
//getItemParent(uid) lua_register(m_luaState, "getItemParent", LuaScriptInterface::luaGetItemParent);
Também procure por:
int32_t LuaScriptInterface::luaGetCreatureHealth(lua_State* L) { //getCreatureHealth(cid) ScriptEnviroment* env = getEnv(); if(Creature* creature = env->getCreatureByUID(popNumber(L))) lua_pushnumber(L, creature->getHealth()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1; }
Substitua por:
int32_t LuaScriptInterface::luaGetItemParent(lua_State* L) { //getItemParent(uid) ScriptEnviroment* env = getEnv(); Item* item = env->getItemByUID(popNumber(L)); if(!item) { errorEx(getError(LUA_ERROR_ITEM_NOT_FOUND)); lua_pushnil(L); return 1; } Item* container = item->getParent()->getItem(); pushThing(L, container, env->addThing(container)); return 1; }
Em luascript.h:
Procure por:
static int32_t luaDoRemoveItem(lua_State* L);
Embaixo adicione:
static int32_t luaGetItemParent(lua_State* L);
Pasta Data:
Delete tudo e adicione:
local config = { removeOnUse = "no", usableOnTarget = "yes", -- can be used on target? (fe. healing friend) splashable = "no", realAnimation = "no", -- make text effect visible only for players in range 1x1 healthMultiplier = 1.0, manaMultiplier = 1.0 } config.removeOnUse = getBooleanFromString(config.removeOnUse) config.usableOnTarget = getBooleanFromString(config.usableOnTarget) config.splashable = getBooleanFromString(config.splashable) config.realAnimation = getBooleanFromString(config.realAnimation) local POTIONS = { [8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion [7618] = {empty = 7636, splash = 2, health = {100, 200}}, -- health potion [7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins"}, -- strong health potion [7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8}, vocStr = "knights"}, -- great health potion [8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion [7620] = {empty = 7636, splash = 7, mana = {70, 130}}, -- mana potion [7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion [7590] = {empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion [8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion } local exhaust = createConditionObject(CONDITION_EXHAUST) setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100)) function onUse(cid, item, fromPosition, itemEx, toPosition) local potion = POTIONS[item.itemid] if(not potion) then return false end if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then if(not config.splashable) then return false end if(toPosition.x == CONTAINER_POSITION) then toPosition = getThingPos(item.uid) end doDecayItem(doCreateItem(2016, potion.splash, toPosition)) doTransformItem(item.uid, potion.empty) return true end if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED) return true end if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) then doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1) return true end local health = potion.health if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then return false end local mana = potion.mana if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then return false end doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE) if(not realAnimation) then doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1) else for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do if(isPlayer(tid)) then doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid) end end end doAddCondition(cid, exhaust) local v = getItemParent(item.uid) if(not potion.empty or config.removeOnUse) then return true end if fromPosition.x == CONTAINER_POSITION then for _, slot in ipairs({CONST_SLOT_LEFT, CONST_SLOT_RIGHT, CONST_SLOT_AMMO}) do local tmp = getPlayerSlotItem(cid, slot) if tmp.itemid == potion.empty and tmp.type < 100 then doChangeTypeItem(item.uid, item.type - 1) return getPlayerFreeCap(cid) >= getItemInfo(potion.empty).weight and doChangeTypeItem(tmp.uid, tmp.type + 1) or doPlayerAddItem(cid, potion.empty, 1) end end else doChangeTypeItem(item.uid, item.type - 1) doCreateItem(potion.empty, 1, fromPosition) return true end if v.uid == 0 then if item.type == 1 and isInArray({CONST_SLOT_LEFT, CONST_SLOT_RIGHT, CONST_SLOT_AMMO}, fromPosition.y) then doTransformItem(item.uid, potion.empty) else -- serversided autostack should take care of this doPlayerAddItem(cid, potion.empty, 1) doChangeTypeItem(item.uid, item.type - 1) end return true else doChangeTypeItem(item.uid, item.type - 1) local size = getContainerSize(v.uid) for i = 0, size-1 do local tmp = getContainerItem(v.uid, i) if tmp.itemid == potion.empty and tmp.type < 100 then return getPlayerFreeCap(cid) >= getItemInfo(potion.empty).weight and doChangeTypeItem(tmp.uid, tmp.type + 1) or doPlayerAddItem(cid, potion.empty, 1) end end if getContainerSize(v.uid) < getContainerCap(v.uid) then doAddContainerItem(v.uid, potion.empty) else doPlayerAddItem(cid, potion.empty, 1) end end return true end
Na pasta data\lib\000-constant.lua:
Procure
maleOutfits = {128, 129, 130, 131, 132, 133, 134, 143, 144, 145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325, 328, 335} femaleOutfits = {136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324, 329, 336}
Subistitua por:
maleOutfits = {128, 129, 130, 131, 132, 133, 134, 143, 144, 145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325, 328, 335, 367} femaleOutfits = {136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324, 329, 336, 366}
Em Data\xml\outfit.xml:
Delete tudo e Adicione
<?xml version="1.0"?> <outfits> <outfit id="1"> <list gender="0" lookType="136" name="Citizen"/> <list gender="1" lookType="128" name="Citizen"/> </outfit> <outfit id="2"> <list gender="0" lookType="137" name="Hunter"/> <list gender="1" lookType="129" name="Hunter"/> </outfit> <outfit id="3"> <list gender="0" lookType="138" name="Mage"/> <list gender="1" lookType="130" name="Mage"/> </outfit> <outfit id="4"> <list gender="0" lookType="139" name="Knight"/> <list gender="1" lookType="131" name="Knight"/> </outfit> <outfit id="5" premium="yes"> <list gender="0" lookType="140" name="Noblewoman"/> <list gender="1" lookType="132" name="Nobleman"/> </outfit> <outfit id="6" premium="yes"> <list gender="0" lookType="141" name="Summoner"/> <list gender="1" lookType="133" name="Summoner"/> </outfit> <outfit id="7" premium="yes"> <list gender="0" lookType="142" name="Warrior"/> <list gender="1" lookType="134" name="Warrior"/> </outfit> <outfit id="8" premium="yes"> <list gender="0" lookType="147" name="Barbarian"/> <list gender="1" lookType="143" name="Barbarian"/> </outfit> <outfit id="9" premium="yes"> <list gender="0" lookType="148" name="Druid"/> <list gender="1" lookType="144" name="Druid"/> </outfit> <outfit id="10" premium="yes"> <list gender="0" lookType="149" name="Wizard"/> <list gender="1" lookType="145" name="Wizard"/> </outfit> <outfit id="11" premium="yes"> <list gender="0" lookType="150" name="Oriental"/> <list gender="1" lookType="146" name="Oriental"/> </outfit> <outfit id="12" premium="yes"> <list gender="0" lookType="155" name="Pirate"/> <list gender="1" lookType="151" name="Pirate"/> </outfit> <outfit id="13" premium="yes"> <list gender="0" lookType="156" name="Assassin"/> <list gender="1" lookType="152" name="Assassin"/> </outfit> <outfit id="14" premium="yes"> <list gender="0" lookType="157" name="Beggar"/> <list gender="1" lookType="153" name="Beggar"/> </outfit> <outfit id="15" premium="yes"> <list gender="0" lookType="158" name="Shaman"/> <list gender="1" lookType="154" name="Shaman"/> </outfit> <outfit id="16" premium="yes"> <list gender="0" lookType="252" name="Norsewoman"/> <list gender="1" lookType="251" name="Norseman"/> </outfit> <outfit id="17" premium="yes"> <list gender="0" lookType="269" name="Nightmare"/> <list gender="1" lookType="268" name="Nightmare"/> </outfit> <outfit id="18" premium="yes"> <list gender="0" lookType="270" name="Jester"/> <list gender="1" lookType="273" name="Jester"/> </outfit> <outfit id="19" premium="yes"> <list gender="0" lookType="279" name="Brotherhood"/> <list gender="1" lookType="278" name="Brotherhood"/> </outfit> <outfit id="20" premium="yes"> <list gender="0" lookType="288" name="Demonhunter"/> <list gender="1" lookType="289" name="Demonhunter"/> </outfit> <outfit id="21" premium="yes"> <list gender="0" lookType="324" name="Yalaharian"/> <list gender="1" lookType="325" name="Yalaharian"/> </outfit> <outfit id="22" premium="yes"> <list gender="0" lookType="336" name="Warmaster"/> <list gender="1" lookType="335" name="Warmaster"/> </outfit> <outfit id="23" default="0"> <list gender="0" lookType="329" name="Wife"/> <list gender="1" lookType="328" name="Husband"/> </outfit> <outfit id="24" premium="yes"> <list gender="0" lookType="366" name="Wayfarer"/> <list gender="1" lookType="367" name="Wayfarer"/> </outfit> </outfits>
Em data\items\items.xml:
Delete onde estão configurada as runas a seguinte linha (Em Todas)
<attribute key="charges" value="x" />
X: Qualquer numero
Arquivos para procurar e repassar:
Bom gente eu não gravei como era o antigo desse então procure uma frase e repasse
Em container.cpp:
Procure e repasse:
Cylinder* Container::__queryDestination(int32_t& index, const Thing* thing, Item** destItem, uint32_t&) { if(index == 254 /*move up*/) { index = INDEX_WHEREEVER; *destItem = NULL; Container* parentContainer = dynamic_cast<Container*>(getParent()); if(parentContainer) return parentContainer; return this; } else if(index == 255 /*add wherever*/){ index = INDEX_WHEREEVER; *destItem = NULL; } else if(index >= (int32_t)capacity()){ /* if you have a container, maximize it to show all 20 slots then you open a bag that is inside the container you will have a bag with 8 slots and a "grey" area where the other 12 slots where from the container if you drop the item on that grey area the client calculates the slot position as if the bag has 20 slots */ index = INDEX_WHEREEVER; *destItem = NULL; } const Item* item = thing->getItem(); if(item == NULL){ return this; } if(item->isStackable()){ if(item->getParent() != this){ //try find a suitable item to stack with uint32_t n = 0; for(ItemList::iterator cit = itemlist.begin(); cit != itemlist.end(); ++cit){ if((*cit) != item && (*cit)->getID() == item->getID() && (*cit)->getItemCount() < 100){ *destItem = (*cit); index = n; return this; } ++n; } } } if(index != INDEX_WHEREEVER){ Thing* destThing = __getThing(index); if(destThing) *destItem = destThing->getItem(); Cylinder* subCylinder = dynamic_cast<Cylinder*>(*destItem); if(subCylinder){ index = INDEX_WHEREEVER; *destItem = NULL; return subCylinder; } } return this; }
Em item.cpp:
Procure e repasse:
void Item::setDefaultSubtype() { setItemCount(1); const ItemType& it = items[id]; if(it.charges) setCharges(it.charges); }
Em player.cpp:
Procure e repasse:
Cylinder* Player::__queryDestination(int32_t& index, const Thing* thing, Item** destItem, uint32_t& flags) { if(index == 0 /*drop to capacity window*/ || index == INDEX_WHEREEVER){ *destItem = NULL; const Item* item = thing->getItem(); if(item == NULL){ return this; } //find an appropiate slot std::list<Container*> containerList; for(int i = SLOT_FIRST; i < SLOT_LAST; ++i){ Item* inventoryItem = inventory[i]; if(inventoryItem == tradeItem){ continue; } if(inventoryItem == tradeItem){ continue; } if(inventoryItem){ //try find an already existing item to stack with if(inventoryItem != item && item->isStackable() && inventoryItem->getID() == item->getID() && inventoryItem->getItemCount() < 100){ *destItem = inventoryItem; index = i; return this; } //check sub-containers else if(Container* subContainer = inventoryItem->getContainer()){ Cylinder* tmpCylinder = NULL; int32_t tmpIndex = INDEX_WHEREEVER; Item* tmpDestItem = NULL; tmpCylinder = subContainer->__queryDestination(tmpIndex, item, &tmpDestItem, flags); if(tmpCylinder && tmpCylinder->__queryAdd(tmpIndex, item, item->getItemCount(), flags) == RET_NOERROR){ index = tmpIndex; *destItem = tmpDestItem; return tmpCylinder; } containerList.push_back(subContainer); } } //empty slot else if(__queryAdd(i, item, item->getItemCount(), flags) == RET_NOERROR){ index = i; *destItem = NULL; return this; } } //check deeper in the containers for(std::list<Container*>::iterator it = containerList.begin(); it != containerList.end(); ++it){ for(ContainerIterator iit = (*it)->begin(); iit != (*it)->end(); ++iit){ if(Container* subContainer = (*iit)->getContainer()){ if(subContainer == tradeItem){ continue; } Cylinder* tmpCylinder = NULL; int32_t tmpIndex = INDEX_WHEREEVER; Item* tmpDestItem = NULL; tmpCylinder = subContainer->__queryDestination(tmpIndex, item, &tmpDestItem, flags); if(tmpCylinder && tmpCylinder->__queryAdd(tmpIndex, item, item->getItemCount(), flags) == RET_NOERROR){ index = tmpIndex; *destItem = tmpDestItem; return tmpCylinder; } } } } return this; } Thing* destThing = __getThing(index); if(destThing) *destItem = destThing->getItem(); Cylinder* subCylinder = dynamic_cast<Cylinder*>(destThing); if(subCylinder){ index = INDEX_WHEREEVER; *destItem = NULL; return subCylinder; } else return this; }
Downloads:
Items.otb (8.6): Clique Aqui
Items.xml (8.6): Clique aqui
Creditos á:
darkhaos - Sources
Tauku - Sources
BlueSilver - Sources
Doidin - Data
Cykotitan (O do xtibia) - Sources/Data
Eu - Data/Sources
Outros - Data/Sources
Tutorial atualizado: 24/09/2010
Agora Funciona 99,9% perfeito (deve estar faltando um detalhe ou outro)
Recomendo fazer tudo o que está mandando para não ocorrer erros