o do houses funciona msm? o kra disse q ia faze um negocio la de regex sla...
bom tutorial +rep
Por comedinhasss, 15 de jul. de 2010 em Tutoriais de Programação
o do houses funciona msm? o kra disse q ia faze um negocio la de regex sla...
bom tutorial +rep
info
Grupo: Herói
Registrado: 08/08/07
Posts: 520
Reputação: +235
Gênero: Masculino
Char no Tibia: Sir Morths

sim funciona...
Todos Foram Testados E Aprovados
info
Grupo: Herói
Registrado: 25/06/08
Posts: 723
Reputação: +275
Gênero: Masculino
Char no Tibia: Diiva

Tutorial perfeito, estava pensando em trazer ele pro XTibia, mas já que você touxe...
Nada mais a fazer se não aprovar né?!
Parabéns um ótimo tutorial, vai ajudar muita gente!
Editado Julho 15 por Doidin
info
Grupo: Marquês
Registrado: 08/05/08
Posts: 1.3k
Reputação: +168

Muito bom Comedinhasss
Mas vale lembrar que todos aí, menos items.xml, fica nas sources do executável e não nas pastas do OT!!
REP+,
Abraços!
info
Grupo: Herói
Registrado: 08/08/07
Posts: 520
Reputação: +235
Gênero: Masculino
Char no Tibia: Sir Morths

outfit.xml também a na pasta do ot....
Brigado pelos elogios..
info
Grupo: Conde
Registrado: 24/09/07
Posts: 606
Reputação: +9
Char no Tibia: Pain Niihzamun

Top..excelente organização, muito bem feito
)
Digno de um colaborador XTibia!
REP+
info
Grupo: Conde
Registrado: 06/09/08
Posts: 544
Reputação: +87
Gênero: Masculino
Char no Tibia: Hallsiny

Não pensei que fosse tão complicado, rsrsrs!
Perfeito, não tem como não entenderem!
Abraços ![]()
info
Grupo: Barão
Registrado: 01/06/10
Posts: 230
Reputação: +25

se eu não coloca-se itens e monstros do 8.60, teria como deixa 8.57 e 8.60?
se eu não coloca-se itens e monstros do 8.60, teria como deixa 8.57 e 8.60?
seguindo este tutorial acho q naum
onde encontro o "house.cpp" ?
info
Grupo: Herói
Registrado: 08/08/07
Posts: 520
Reputação: +235
Gênero: Masculino
Char no Tibia: Sir Morths

Na source do servidor...
esta é uma area de programação...
info
Grupo: Campones
Registrado: 16/07/10
Posts: 16
Reputação: +2
Char no Tibia: Haayashi

Tutorial perfeito cara,acredito que vai ajudar muitos
info
Grupo: Campones
Registrado: 15/09/07
Posts: 5
Reputação: 0

parabens brother, isso ae ![]()
info
Grupo: Herói
Registrado: 08/08/07
Posts: 520
Reputação: +235
Gênero: Masculino
Char no Tibia: Sir Morths
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:
Subistitua por:
Procure:
Subistitua por:
Em resources.h:
Procure:
Substitua por:
Em itemloader.h:
Procure:
Substitua e adicione por:
Em items.cpp:
Procure:
Substitua e adicione por:
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:
Substitua por:
Em tools.cpp:
Procure:
{"insects", MAGIC_EFFECT_INSECTS}Substitua por:
{"insects", MAGIC_EFFECT_INSECTS}, {"dragonhead", MAGIC_EFFECT_DRAGONHEAD}Em const.h:
Procure:
Substitua por:
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:
Embaixo adicione:
Também procure:
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:
Em luascript.cpp:
Procure por:
Embaixo adicione:
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:
Embaixo adicione:
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 endNa 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
Em data\items\items.xml:
Delete onde estão configurada as runas a seguinte linha (Em Todas)
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
Editado Setembro 24 por comedinhasss