Ir para conteúdo

Boguemon

Artesão
  • Total de itens

    112
  • Registro em

  • Última visita

1 Seguidor

Sobre Boguemon

Informações

  • Char no Tibia
    Pizza de Churros
  • Forma que conheci o xTibia
    Amigos
  • Sou
    Jogador

Últimos Visitantes

O bloco dos últimos visitantes está desativado e não está sendo visualizado por outros usuários.

Boguemon's Achievements

  1. Gostaria de pedir uma ajuda pra adicionar um botão no final de cada skill que ao ser clicado chama uma talkaction, um botão tipo esse: Ficaria tipo: Magic Level 10 Fist Fighting 10 e por ai vai.... Alguém saberia me ajudar, esses são os arquivos do otclient skills.lua skill.otui
  2. Eu uso tfs 0.4 E gostaria de saber se da pra fazer o seguinte: Quando um número X de um monster Y for morto no servidor, uma Raid Z acontece no servidor, por exemplo: Ao ser morto 10.000 dragons no servidor (conta os kills de todos os players do servidor) a Raid de Demodras acontece **(conta os dragons, Dragon lords e os hatchlings)** Desde já agradeço a quem puder ajudar
  3. Buenas galera do XTibia, to com um probleminha nas portas quando faço o uso de chaves, é o seguinte: - Tanto a porta quanto a chave tem o mesmo action ID 100 adicionados pelo remeres mapeditor - A porta vem trancada e quando uso a chave nela ela abre normalmente, até ai esta tudo certo - Quando tento fechar com a chave, nada acontece << aqui ja esta errado - Quando fecho "manualmente" usando o botao direito direto na porta ela fecha e ja tranca << aqui tbm está errado pois gostaria que fosse igual ao global Essa é minha doors.lua se alguém souber me ajudar: local function checkStackpos(item, position) position.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE local thing = getThingFromPos(position) position.stackpos = STACKPOS_TOP_FIELD local field = getThingFromPos(position) return (item.uid == thing.uid or thing.itemid < 100 or field.itemid == 0) end local function doorEnter(cid, item, toPosition) doTransformItem(item.uid, item.itemid + 1) doTeleportThing(cid, toPosition) end function onUse(cid, item, fromPosition, itemEx, toPosition) if(fromPosition.x ~= CONTAINER_POSITION and isPlayerPzLocked(cid) and getTileInfo(fromPosition).protection) then doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) return true end if(getItemLevelDoor(item.itemid) > 0) then if(item.actionid == 189) then if(not isPremium(cid)) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.") return true end doorEnter(cid, item, toPosition) return true end local gender = item.actionid - 186 if(isInArray({PLAYERSEX_FEMALE, PLAYERSEX_MALE, PLAYERSEX_GAMEMASTER}, gender)) then if(gender ~= getPlayerSex(cid)) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.") return true end doorEnter(cid, item, toPosition) return true end local skull = item.actionid - 180 if(skull >= SKULL_NONE and skull <= SKULL_BLACK) then if(skull ~= getCreatureSkullType(cid)) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.") return true end doorEnter(cid, item, toPosition) return true end local group = item.actionid - 150 if(group >= 0 and group < 30) then if(group > getPlayerGroupId(cid)) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.") return true end doorEnter(cid, item, toPosition) return true end local vocation = item.actionid - 100 if(vocation >= 0 and vocation < 50) then local playerVocationInfo = getVocationInfo(getPlayerVocation(cid)) if(playerVocationInfo.id ~= vocation and playerVocationInfo.fromVocation ~= vocation) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.") return true end doorEnter(cid, item, toPosition) return true end if(item.actionid == 190 or (item.actionid ~= 0 and getPlayerLevel(cid) >= (item.actionid - getItemLevelDoor(item.itemid)))) then doorEnter(cid, item, toPosition) else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.") end return true end if(isInArray(specialDoors, item.itemid)) then if(item.actionid == 100 or (item.actionid ~= 0 and getPlayerStorageValue(cid, item.actionid) > 0)) then doorEnter(cid, item, toPosition) else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.") end return true end if(isInArray(keys, item.itemid)) then if(itemEx.actionid > 0) then if(item.actionid == itemEx.actionid and doors[itemEx.itemid] ~= nil) then doTransformItem(itemEx.uid, doors[itemEx.itemid]) return true end doPlayerSendCancel(cid, "The key does not match.") return true end return false end if(isInArray(horizontalOpenDoors, item.itemid) and checkStackpos(item, fromPosition)) then local newPosition = toPosition newPosition.y = newPosition.y + 1 local doorPosition = fromPosition doorPosition.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE local doorCreature = getThingfromPos(doorPosition) if(doorCreature.itemid ~= 0) then local pzDoorPosition = getTileInfo(doorPosition).protection local pzNewPosition = getTileInfo(newPosition).protection if((pzDoorPosition and not pzNewPosition and doorCreature.uid ~= cid) or (not pzDoorPosition and pzNewPosition and doorCreature.uid == cid and isPlayerPzLocked(cid))) then doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) else doTeleportThing(doorCreature.uid, newPosition) if(not isInArray(closingDoors, item.itemid)) then doTransformItem(item.uid, item.itemid - 1) end end return true end doTransformItem(item.uid, item.itemid - 1) return true end if(isInArray(verticalOpenDoors, item.itemid) and checkStackpos(item, fromPosition)) then local newPosition = toPosition newPosition.x = newPosition.x + 1 local doorPosition = fromPosition doorPosition.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE local doorCreature = getThingfromPos(doorPosition) if(doorCreature.itemid ~= 0) then if(getTileInfo(doorPosition).protection and not getTileInfo(newPosition).protection and doorCreature.uid ~= cid) then doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) else doTeleportThing(doorCreature.uid, newPosition) if(not isInArray(closingDoors, item.itemid)) then doTransformItem(item.uid, item.itemid - 1) end end return true end doTransformItem(item.uid, item.itemid - 1) return true end if(doors[item.itemid] ~= nil and checkStackpos(item, fromPosition)) then if(item.actionid == 0) then doTransformItem(item.uid, doors[item.itemid]) else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is locked.") end return true end return false end
  4. Opa, eu tenho esse botão do purse no otclient (8.60) purseButton = inventoryPanel:getChildById('purseButton') local function purseFunction() local purse = g_game.getLocalPlayer():getInventoryItem(InventorySlotPurse) if purse then g_game.use(purse) end end purseButton.onClick = purseFunction eu estou tentando fazer com que ao clicar nele ele abra uma janela (battle list, vip, inventory), mas não sei como fazer, o máximo que consegui ate agora é abrir uma bp em um dos slots, alguem poderia me ajudar? Eu sei que eh na parte do "local purse = g_game..." mas eu não sei que codigo usar ali Pra quem não entendeu é o seguinte: 1º - Ja tenho o botao na janela do inventario 2º - Ao clicar nele, ele teria que abrir uma outra janela
  5. Gostaria de saber se tem como por para que se o player estiver com um item de sword fique mostrando só as skills (ML, sword, shielding e fishing), mesmo processo se for club, axe ou distance, e obviamente se não tiver nenhum item na mão apareça o Fist
  6. Queria saber se é possível e se for, como coloco no servidor de tibia mesmo, o sistema de que você ordena que o summon vai para local X Uso tfs 0.4 rev 3777
  7. Olá, o Adriano Swatt estava fazendo um script pra mim, mas devido a alguns problemas e aos corres do dia-a-dia ele não teve tempo de terminar, gostaria da ajuda para terminar esse script... O script consiste em: O boost é ativado ao summonar o monstro e não usando algum item como ja vi em outro post O cálculo do dano adicionado é feito através da soma do level e do ML, o resultado disso se toma como porcentagem a adicionar no dano que o monstro iria hitar, ex; level = 50 + ML = 35, result = 85, o hit do monstro ficaria 350(exemplo) + 85% dos 350, o mesmo serve no caso do monstro se auto healar (MONK por exemplo), mas o boost é pra qualquer summon A vida do monstro segue a mesma logica só que ao invés do hit aumentar é a vida obviamente local eventName = "00testing"local percent_limit = 500function onStatsChange(cid, attacker, type, combat, value) print('LUTA OCORRENDO') if type == STATSCHANGE_HEALTHLOSS and value >= 1 then -- print('LIST TARGET: '..getMonsterTargetList(attacker)[1]..'') -- Retorna UID registerCreatureEvent(getCreatureTarget(attacker), eventName) print('REGISTRANDO EVENTO EM: '..getCreatureName(attacker):lower()..' ATACANDO UM '..getCreatureName(getCreatureTarget(attacker)):lower()..'.') if getCreatureMaster(attacker) then ownSummon = getCreatureMaster(attacker) print('TEMOS: '..getCreatureName(attacker):lower()..' ATACANDO UM '..getCreatureName(cid):lower()..'.') if isPlayer(ownSummon) then local overflow_protection = {} if overflow_protection[attacker] then overflow_protection[attacker] = nil return true end getML = getPlayerMagLevel(ownSummon) getLvL = getPlayerLevel(ownSummon) addDMG = getML + getLvL -- Percent if addDMG < percent_limit then percDMG = math.floor(value*(addDMG/100)) newValue = (value+percDMG) print('True Value: '..value..' // PercDMG: '..percDMG..' // NewValue: '..newValue..' [ML: '..getML..'/ LVL: '..getLvL..].') else percDMG = math.floor(value*(percent_limit/100)) newValue = (value+percDMG) print('True Value: '..value..' // PercDMG: '..percDMG..' // NewValue: '..newValue..' [ML: '..getML..'/ LVL: '..getLvL..].') end overflow_protection[attacker] = true doPlayerSendTextMessage(ownSummon, MESSAGE_STATUS_DEFAULT, "Your "..getCreatureName(attacker).." deals "..newValue.." [hit "..value.." + "..percDMG.." boost damage] to "..(getMonsterInfo(getCreatureName(cid)).description)..".") doTargetCombatHealth(attacker, cid, combat, -newValue, -newValue, CONST_ME_NONE) return false else print('SUMMON ISN\'T BY PLAYER // ATTACKER: '..getCreatureName(attacker)..' -> CID: '..getCreatureName(cid)..'.') end else print('NOT IS A SUMMON // ATTACKER: '..getCreatureName(attacker)..' -> CID: '..getCreatureName(cid)..'.') end else print('SEM PERDA DE VIDA // CID: '..getCreatureName(cid)..'.') endreturn trueend
  8. Sabem que quando nós jogamos um item sobre a bp ele entra? queria remover isso, queria que so entrasse ao jogar diretamente dentro creio que seja nesse arquivo container.cpp ////////////////////////////////////////////////////////////////////////// OpenTibia - an opensource roleplaying game////////////////////////////////////////////////////////////////////////// This program is free software: you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation, either version 3 of the License, or// (at your option) any later version.//// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with this program. If not, see <http://www.gnu.org/licenses/>.////////////////////////////////////////////////////////////////////////#include "otpch.h"#include "container.h"#include "game.h"#include "iomap.h"#include "player.h"extern Game g_game;ContainerContainer(uint16_t type) : Item(type){ maxSize = items[type].maxItems; serializationCount = 0; totalWeight = 0.0;}Container~Container(){ for(ItemListiterator cit = itemlist.begin(); cit != itemlist.end(); ++cit) { (*cit)->setParent(NULL); (*cit)->unRef(); } itemlist.clear();}Item* Containerclone() const{ Container* _item = static_cast<Container*>(Itemclone()); for(ItemListconst_iterator it = itemlist.begin(); it != itemlist.end(); ++it) _item->addItem((*it)->clone()); return _item;}Container* ContainergetParentContainer(){ if(Cylinder* cylinder = getParent()) { if(Item* item = cylinder->getItem()) return item->getContainer(); } return NULL;}void ContaineraddItem(Item* item){ itemlist.push_back(item); item->setParent(this);}Attr_ReadValue ContainerreadAttr(AttrTypes_t attr, PropStream& propStream){ switch(attr) { case ATTR_CONTAINER_ITEMS: { uint32_t count; if(!propStream.getLong(count)) return ATTR_READ_ERROR; serializationCount = count; return ATTR_READ_END; } default: break; } return ItemreadAttr(attr, propStream);}bool ContainerunserializeItemNode(FileLoader& f, NODE node, PropStream& propStream){ if(!ItemunserializeItemNode(f, node, propStream)) return false; uint32_t type; for(NODE nodeItem = f.getChildNode(node, type); nodeItem; nodeItem = f.getNextNode(nodeItem, type)) { //load container items if(type != OTBM_ITEM) return false; PropStream itemPropStream; f.getProps(nodeItem, itemPropStream); Item* item = ItemCreateItem(itemPropStream); if(!item) return false; if(!item->unserializeItemNode(f, nodeItem, itemPropStream)) return false; addItem(item); updateItemWeight(item->getWeight()); } return true;}void ContainerupdateItemWeight(double diff){ totalWeight += diff; if(Container* parent = getParentContainer()) parent->updateItemWeight(diff);}double ContainergetWeight() const{ return ItemgetWeight() + totalWeight;}stdstring ContainergetContentDescription() const{ stdstringstream s; return getContentDescription(s).str();}stdstringstream& ContainergetContentDescription(stdstringstream& s) const{ bool begin = true; Container* evil = const_cast<Container*>(this); for(ContainerIterator it = evil->begin(); it != evil->end(); ++it) { Container* tmp = (*it)->getContainer(); if(tmp && !tmp->empty()) continue; if(!begin) s << ", "; else begin = false; s << (*it)->getNameDescription(); } if(begin) s << "nothing"; return s;}Item* ContainergetItem(uint32_t index){ size_t n = 0; for(ItemListconst_iterator cit = getItems(); cit != getEnd(); ++cit) { if(n == index) return *cit; else ++n; } return NULL;}uint32_t ContainergetItemHoldingCount() const{ uint32_t counter = 0; for(ContainerIterator it = begin(); it != end(); ++it) ++counter; return counter;}bool ContainerisHoldingItem(const Item* item) const{ for(ContainerIterator it = begin(); it != end(); ++it) { if((*it) == item) return true; } return false;}void ContaineronAddContainerItem(Item* item){ const Position& cylinderMapPos = getPosition(); SpectatorVec list; SpectatorVeciterator it; g_game.getSpectators(list, cylinderMapPos, false, false, 2, 2, 2, 2); //send to client Player* player = NULL; for(it = list.begin(); it != list.end(); ++it) { if((player = (*it)->getPlayer())) player->sendAddContainerItem(this, item); } //event methods for(it = list.begin(); it != list.end(); ++it) { if((player = (*it)->getPlayer())) player->onAddContainerItem(this, item); }}void ContaineronUpdateContainerItem(uint32_t index, Item* oldItem, const ItemType& oldType, Item* newItem, const ItemType& newType){ const Position& cylinderMapPos = getPosition(); SpectatorVec list; SpectatorVeciterator it; g_game.getSpectators(list, cylinderMapPos, false, false, 2, 2, 2, 2); //send to client Player* player = NULL; for(it = list.begin(); it != list.end(); ++it) { if((player = (*it)->getPlayer())) player->sendUpdateContainerItem(this, index, oldItem, newItem); } //event methods for(it = list.begin(); it != list.end(); ++it) { if((player = (*it)->getPlayer())) player->onUpdateContainerItem(this, index, oldItem, oldType, newItem, newType); }}void ContaineronRemoveContainerItem(uint32_t index, Item* item){ const Position& cylinderMapPos = getPosition(); SpectatorVec list; SpectatorVeciterator it; g_game.getSpectators(list, cylinderMapPos, false, false, 2, 2, 2, 2); //send change to client Player* player = NULL; for(it = list.begin(); it != list.end(); ++it) { if((player = (*it)->getPlayer())) player->sendRemoveContainerItem(this, index, item); } //event methods for(it = list.begin(); it != list.end(); ++it) { if((player = (*it)->getPlayer())) player->onRemoveContainerItem(this, index, item); }}ReturnValue Container__queryAdd(int32_t index, const Thing* thing, uint32_t count, uint32_t flags) const{ if(((flags & FLAG_CHILDISOWNER) == FLAG_CHILDISOWNER)) { //a child container is querying, since we are the top container (not carried by a player) //just return with no error. return RET_NOERROR; } const Item* item = thing->getItem(); if(!item) return RET_NOTPOSSIBLE; if(!item->isPickupable()) return RET_CANNOTPICKUP; if(item == this) return RET_THISISIMPOSSIBLE; if(const Container* container = item->getContainer()) { for(const Cylinder* cylinder = getParent(); cylinder; cylinder = cylinder->getParent()) { if(cylinder == container) return RET_THISISIMPOSSIBLE; } } if(index == INDEX_WHEREEVER && !((flags & FLAG_NOLIMIT) == FLAG_NOLIMIT) && full()) return RET_CONTAINERNOTENOUGHROOM; const Cylinder* topParent = getTopParent(); if(topParent != this) return topParent->__queryAdd(INDEX_WHEREEVER, item, count, flags | FLAG_CHILDISOWNER); return RET_NOERROR;}ReturnValue Container__queryMaxCount(int32_t index, const Thing* thing, uint32_t count, uint32_t& maxQueryCount, uint32_t flags) const{ const Item* item = thing->getItem(); if(!item) { maxQueryCount = 0; return RET_NOTPOSSIBLE; } if(((flags & FLAG_NOLIMIT) == FLAG_NOLIMIT)) { maxQueryCount = stdmax((uint32_t)1, count); return RET_NOERROR; } int32_t freeSlots = stdmax((int32_t)(capacity() - size()), (int32_t)0); if(item->isStackable()) { uint32_t n = 0; if(index != INDEX_WHEREEVER) { const Thing* destThing = __getThing(index); const Item* destItem = NULL; if(destThing) destItem = destThing->getItem(); if(destItem && destItem->getID() == item->getID()) n = 100 - destItem->getItemCount(); } maxQueryCount = freeSlots * 100 + n; if(maxQueryCount < count) return RET_CONTAINERNOTENOUGHROOM; } else { maxQueryCount = freeSlots; if(maxQueryCount == 0) return RET_CONTAINERNOTENOUGHROOM; } return RET_NOERROR;}ReturnValue Container__queryRemove(const Thing* thing, uint32_t count, uint32_t flags) const{ int32_t index = __getIndexOfThing(thing); if(index == -1) return RET_NOTPOSSIBLE; const Item* item = thing->getItem(); if(item == NULL) return RET_NOTPOSSIBLE; if(count == 0 || (item->isStackable() && count > item->getItemCount())) return RET_NOTPOSSIBLE; if(!item->isMovable() && !hasBitSet(FLAG_IGNORENOTMOVABLE, flags)) return RET_NOTMOVABLE; return RET_NOERROR;}Cylinder* Container__queryDestination(int32_t& index, const 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; else return this; } else if(index == 255 /*add wherever*/) { index = INDEX_WHEREEVER; *destItem = NULL; return this; } 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; } if(index != INDEX_WHEREEVER) { Thing* destThing = __getThing(index); if(destThing) *destItem = destThing->getItem(); if(Cylinder* subCylinder = dynamic_cast<Cylinder*>(*destItem)) { index = INDEX_WHEREEVER; *destItem = NULL; return subCylinder; } } } return this;}void Container__addThing(Creature* actor, Thing* thing){ return __addThing(actor, 0, thing);}void Container__addThing(Creature*, int32_t index, Thing* thing){ if(index >= (int32_t)capacity()) {#ifdef __DEBUG_MOVESYS__ stdclog << "Failure: [Container::__addThing], index:" << index << ", index >= capacity()" << stdendl;#endif return /*RET_NOTPOSSIBLE*/; } Item* item = thing->getItem(); if(!item) {#ifdef __DEBUG_MOVESYS__ stdclog << "Failure: [Container::__addThing] item == NULL" << stdendl;#endif return /*RET_NOTPOSSIBLE*/; }#ifdef __DEBUG_MOVESYS__ if(index != INDEX_WHEREEVER && size() >= capacity()) { stdclog << "Failure: [Container::__addThing] size() >= capacity()" << stdendl; return /*RET_CONTAINERNOTENOUGHROOM*/; }#endif item->setParent(this); itemlist.push_front(item); totalWeight += item->getWeight(); if(Container* parentContainer = getParentContainer()) parentContainer->updateItemWeight(item->getWeight()); //send change to client if(getParent() && getParent() != VirtualCylindervirtualCylinder) onAddContainerItem(item);}void Container__updateThing(Thing* thing, uint16_t itemId, uint32_t count){ int32_t index = __getIndexOfThing(thing); if(index == -1) {#ifdef __DEBUG_MOVESYS__ stdclog << "Failure: [Container::__updateThing] index == -1" << stdendl;#endif return /*RET_NOTPOSSIBLE*/; } Item* item = thing->getItem(); if(!item) {#ifdef __DEBUG_MOVESYS__ stdclog << "Failure: [Container::__updateThing] item == NULL" << stdendl;#endif return /*RET_NOTPOSSIBLE*/; } const ItemType& oldType = Itemitems[item->getID()]; const ItemType& newType = Itemitems[itemId]; const double oldWeight = item->getWeight(); item->setID(itemId); item->setSubType(count); const double diffWeight = -oldWeight + item->getWeight(); totalWeight += diffWeight; if(Container* parentContainer = getParentContainer()) parentContainer->updateItemWeight(diffWeight); //send change to client if(getParent()) onUpdateContainerItem(index, item, oldType, item, newType);}void Container__replaceThing(uint32_t index, Thing* thing){ Item* item = thing->getItem(); if(!item) {#ifdef __DEBUG_MOVESYS__ stdclog << "Failure: [Container::__replaceThing] item == NULL" << stdendl;#endif return /*RET_NOTPOSSIBLE*/; } uint32_t count = 0; ItemListiterator cit = itemlist.end(); for(cit = itemlist.begin(); cit != itemlist.end(); ++cit) { if(count == index) break; ++count; } if(cit == itemlist.end()) {#ifdef __DEBUG_MOVESYS__ stdclog << "Failure: [Container::__updateThing] item not found" << stdendl;#endif return /*RET_NOTPOSSIBLE*/; } totalWeight -= (*cit)->getWeight(); totalWeight += item->getWeight(); if(Container* parentContainer = getParentContainer()) parentContainer->updateItemWeight(-(*cit)->getWeight() + item->getWeight()); itemlist.insert(cit, item); item->setParent(this); //send change to client if(getParent()) { const ItemType& oldType = Itemitems[(*cit)->getID()]; const ItemType& newType = Itemitems[item->getID()]; onUpdateContainerItem(index, *cit, oldType, item, newType); } (*cit)->setParent(NULL); itemlist.erase(cit);}void Container__removeThing(Thing* thing, uint32_t count){ Item* item = thing->getItem(); if(!item) {#ifdef __DEBUG_MOVESYS__ stdclog << "Failure: [Container::__removeThing] item == NULL" << stdendl;#endif return /*RET_NOTPOSSIBLE*/; } int32_t index = __getIndexOfThing(thing); if(index == -1) {#ifdef __DEBUG_MOVESYS__ stdclog << "Failure: [Container::__removeThing] index == -1" << stdendl;#endif return /*RET_NOTPOSSIBLE*/; } ItemListiterator cit = stdfind(itemlist.begin(), itemlist.end(), thing); if(cit == itemlist.end()) {#ifdef __DEBUG_MOVESYS__ stdclog << "Failure: [Container::__removeThing] item not found" << stdendl;#endif return /*RET_NOTPOSSIBLE*/; } if(item->isStackable() && count != item->getItemCount()) { const double oldWeight = -item->getWeight(); item->setItemCount(stdmax(0, (int32_t)(item->getItemCount() - count))); const double diffWeight = oldWeight + item->getWeight(); totalWeight += diffWeight; //send change to client if(getParent()) { if(Container* parentContainer = getParentContainer()) parentContainer->updateItemWeight(diffWeight); const ItemType& it = Itemitems[item->getID()]; onUpdateContainerItem(index, item, it, item, it); } } else { //send change to client if(getParent()) { if(Container* parentContainer = getParentContainer()) parentContainer->updateItemWeight(-item->getWeight()); onRemoveContainerItem(index, item); } totalWeight -= item->getWeight(); item->setParent(NULL); itemlist.erase(cit); }}Thing* Container__getThing(uint32_t index) const{ if(index > size()) return NULL; uint32_t count = 0; for(ItemListconst_iterator cit = itemlist.begin(); cit != itemlist.end(); ++cit) { if(count == index) return *cit; else ++count; } return NULL;}int32_t Container__getIndexOfThing(const Thing* thing) const{ uint32_t index = 0; for(ItemListconst_iterator cit = getItems(); cit != getEnd(); ++cit) { if(*cit == thing) return index; else ++index; } return -1;}int32_t Container__getFirstIndex() const{ return 0;}int32_t Container__getLastIndex() const{ return size();}uint32_t Container__getItemTypeCount(uint16_t itemId, int32_t subType /*= -1*/) const{ uint32_t count = 0; for(ItemListconst_iterator it = itemlist.begin(); it != itemlist.end(); ++it) { if((*it) && (*it)->getID() == itemId && (subType == -1 || subType == (*it)->getSubType())) count += (*it)->getItemCount(); } return count;}stdmap<uint32_t, uint32_t>& Container__getAllItemTypeCount(stdmap<uint32_t, uint32_t>& countMap) const{ for(ItemListconst_iterator it = itemlist.begin(); it != itemlist.end(); ++it) countMap[(*it)->getID()] += (*it)->getItemCount(); return countMap;}void ContainerpostAddNotification(Creature* actor, Thing* thing, const Cylinder* oldParent, int32_t index, CylinderLink_t/* link = LINK_OWNER*/){ Cylinder* topParent = getTopParent(); if(!topParent->getCreature()) { if(topParent == this) { //let the tile class notify surrounding players if(topParent->getParent()) topParent->getParent()->postAddNotification(actor, thing, oldParent, index, LINK_NEAR); } else topParent->postAddNotification(actor, thing, oldParent, index, LINK_PARENT); } else topParent->postAddNotification(actor, thing, oldParent, index, LINK_TOPPARENT);}void ContainerpostRemoveNotification(Creature* actor, Thing* thing, const Cylinder* newParent, int32_t index, bool isCompleteRemoval, CylinderLink_t/* link = LINK_OWNER*/){ Cylinder* topParent = getTopParent(); if(!topParent->getCreature()) { if(topParent == this) { //let the tile class notify surrounding players if(topParent->getParent()) topParent->getParent()->postRemoveNotification(actor, thing, newParent, index, isCompleteRemoval, LINK_NEAR); } else topParent->postRemoveNotification(actor, thing, newParent, index, isCompleteRemoval, LINK_PARENT); } else topParent->postRemoveNotification(actor, thing, newParent, index, isCompleteRemoval, LINK_TOPPARENT);}void Container__internalAddThing(Thing* thing){ __internalAddThing(0, thing);}void Container__internalAddThing(uint32_t#ifdef __DEBUG_MOVESYS__ index#endif , Thing* thing){#ifdef __DEBUG_MOVESYS__ stdclog << "[Container::__internalAddThing] index: " << index << stdendl;#endif if(!thing) return; Item* item = thing->getItem(); if(item == NULL) {#ifdef __DEBUG_MOVESYS__ stdclog << "Failure: [Container::__internalAddThing] item == NULL" << stdendl;#endif return; } itemlist.push_front(item); item->setParent(this); totalWeight += item->getWeight(); if(Container* parentContainer = getParentContainer()) parentContainer->updateItemWeight(item->getWeight());}void Container__startDecaying(){ for(ItemListconst_iterator it = itemlist.begin(); it != itemlist.end(); ++it) (*it)->__startDecaying();}ContainerIterator Containerbegin(){ ContainerIterator cit(this); if(!itemlist.empty()) { cit.over.push(this); cit.current = itemlist.begin(); } return cit;}ContainerIterator Containerend(){ ContainerIterator cit(this); return cit;}ContainerIterator Containerbegin() const{ Container* evil = const_cast<Container*>(this); return evil->begin();}ContainerIterator Containerend() const{ Container* evil = const_cast<Container*>(this); return evil->end();}ContainerIteratorContainerIterator():base(NULL) {}ContainerIteratorContainerIterator(Container* _base):base(_base) {}ContainerIteratorContainerIterator(const ContainerIterator& rhs):base(rhs.base), over(rhs.over), current(rhs.current) {}bool ContainerIteratoroperator==(const ContainerIterator& rhs){ return !(*this != rhs);}bool ContainerIteratoroperator!=(const ContainerIterator& rhs){ assert(base); if(base != rhs.base) return true; if(over.empty() && rhs.over.empty()) return false; if(over.empty()) return true; if(rhs.over.empty()) return true; if(over.front() != rhs.over.front()) return true; return current != rhs.current;}ContainerIterator& ContainerIteratoroperator=(const ContainerIterator& rhs){ this->base = rhs.base; this->current = rhs.current; this->over = rhs.over; return *this;}Item* ContainerIteratoroperator*(){ assert(base); return *current;}Item* ContainerIteratoroperator->(){ return *(*this);}ContainerIterator& ContainerIteratoroperator++(){ assert(base); if(Item* item = *current) { Container* container = item->getContainer(); if(container && !container->empty()) over.push(container); } ++current; if(current == over.front()->itemlist.end()) { over.pop(); if(over.empty()) return *this; current = over.front()->itemlist.begin(); } return *this;}ContainerIterator ContainerIteratoroperator++(int32_t){ ContainerIterator tmp(*this); ++*this; return tmp;}
  9. Cara, vc é o caotic do tv system?

    1. Mostrar comentários anteriores  %s mais
    2. Boguemon

      Boguemon

      Eu tentei adicionar no meu tfs 0.4, 8.71 e n deu, vc n teria um pra minha versão?

    3. caotic

      caotic

      Infelizmente n

    4. Boguemon

      Boguemon

      e não consegues me ajudar a colocar no meu?

  10. Pra mim, tudo que tá ali é necessário pra funcionar do jeito que eu quero, e como sou bem novato em script não sei simplificar sem deixar o script de um jeito que eu não quero
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...