Tudo que HSinhori postou
-
Problema no /n
To usando esse TFS 0.4 que o luanluciano93 editou TibiaKing O npc não aparece quando uso o /n algumNPC aparece isso na distro I/O warning : failed to load external entity "data/npc/.xml" [17:57:52.257] [Warning - Npc::loadFromXml] Cannot load npc file (data/npc/.xml). [17:57:52.258] Info: failed to load external entity "data/npc/.xml" [17:57:52.258] [Error - TalkAction Interface] [17:57:52.258] data/talkactions/scripts/creature.lua:onSay [17:57:52.258] Description: [17:57:52.258] (luaDoCreateNpc) Npc with name '' not found > Broadcasted message: "Full server save within 30 seconds, please mind it may freeze!". o script é esse: function onSay(cid, words, param, channel) local func = doCreateMonster if(words:sub(2, 2) == "n") then func = doCreateNpc end local pid = cid local t = string.explode(param, ",") if(t[2]) then pid = getPlayerByNameWildcard(t[2]) if(not pid) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.") return true end end local position = getCreaturePosition(pid) local effect = CONST_ME_MAGIC_RED local ret = func(t[1], position, false, true) if(tonumber(ret) == nil) then effect = CONST_ME_POFF doPlayerSendDefaultCancel(cid, (ret == false and RETURNVALUE_NOTPOSSIBLE or RETURNVALUE_NOTENOUGHROOM)) end doSendMagicEffect(position, effect) return true end Se alguém puder me ajudar, agradeço
-
Pegar storage pro summon
monster.cpp: In member function ‘virtual void Monster::onThink(uint32_t)’: monster.cpp:635:58: error: no matching function for call to ‘Monster::getStorage(int, int)’ else if(master != followCreature && getStorage(1111, 1)) //Our master has not ordered us to attack anything, lets follow him around instead. ^ monster.cpp:635:58: note: candidate is: In file included from monsters.h:22:0, from monster.h:21, from monster.cpp:19: creature.h:336:16: note: virtual bool Creature::getStorage(uint32_t, std::string&) const virtual bool getStorage(const uint32_t key, std::string& value) const; ^ creature.h:336:16: note: no known conversion for argument 2 from ‘int’ to ‘std::string& {aka std::basic_string<char>&}’
-
Pegar storage pro summon
monster.cpp é o seguinte, esse é o meu monster.cpp, eu queria que essa parte funcionasse com um getStorage junto, ficando assim claro que o que eu fiz foi só um exemplo pra entenderem oque eu gostaria, mas é bem aquilo mesmo, alguém poderia me ajudar? por via das duvidas, deixo o link das sources que eu uso tfs com cast do luanluciano93 aqui do tk @luanluciano93 saberias me ajudar? já que são as sources que vc ja arrumou o cast? Edit: um cara me disse pra fazer isso mas dai eu consegui esses erros
-
Skill por WeaponType
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
-
Retirando Cast System da Distro
adiciona isso na tua config.lua pra ver se resolve
-
Ordenar Summon
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
-
Retirando Cast System da Distro
vc pode desativar no config.lua
-
Erro na distro
Opa, quando eu abro o otserv no Ubuntu 14.04, depois de dizer que está aberto aparece essa msg na distro o otserv até funciona normal, mas eu queria resolver esse problema pra evitar qualquer bug ou problema que possa ocorrer, alguém saberia me ajudar? eu uso a source desse topico TFS 0.4 Cast pelo luanluciano não sabia se a seção correta era essa ou a de programação, então se estiver errada pode mudar
-
Erro ao compilar no VS15
e como reinstalo? ele vem numa pasta zipada que coloco lá, e unica coisa que faço depois é clicar no arquivo .bat, é isso? Edit: o future.hpp está na pasta que vc citou ali em cima
-
Erro ao compilar no VS15
Estou tentando compilar no visual studio 2015 e da esses erros Eu segui o tutorial e pelo que percebi ele não está setando o sdk nem o boost nas variaveis de ambiente quando uso eles (tentei tanto como adm quanto normal), e não sei como fazer manualmente (quais pastas setar corretamente)
-
Boost Summon
bump
-
Boost Summon
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 = 500 function 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)..'.') end return true end
-
Stacking maximo diferenciado
Gostaria da ajuda de vocês pra colocar diretamente nas sources o seguinte, se um item for "ammunition" ele tem um stacking maximo maior (ex; 500) se não ele continua padrão Uso tfs 0.4 / 8.71
-
Remover o move sobre a bp
Sabem que quando nós jogamos um item sobre a bp ele entra? queria remover isso, queria que so entrasse ao jogar diretamente dentro, eu uso tfs0.4, 8.71 creio que seja nese 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; Container::Container(uint16_t type) : Item(type) { maxSize = items[type].maxItems; serializationCount = 0; totalWeight = 0.0; } Container::~Container() { for(ItemList::iterator cit = itemlist.begin(); cit != itemlist.end(); ++cit) { (*cit)->setParent(NULL); (*cit)->unRef(); } itemlist.clear(); } Item* Container::clone() const { Container* _item = static_cast<Container*>(Item::clone()); for(ItemList::const_iterator it = itemlist.begin(); it != itemlist.end(); ++it) _item->addItem((*it)->clone()); return _item; } Container* Container::getParentContainer() { if(Cylinder* cylinder = getParent()) { if(Item* item = cylinder->getItem()) return item->getContainer(); } return NULL; } void Container::addItem(Item* item) { itemlist.push_back(item); item->setParent(this); } Attr_ReadValue Container::readAttr(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 Item::readAttr(attr, propStream); } bool Container::unserializeItemNode(FileLoader& f, NODE node, PropStream& propStream) { if(!Item::unserializeItemNode(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 = Item::CreateItem(itemPropStream); if(!item) return false; if(!item->unserializeItemNode(f, nodeItem, itemPropStream)) return false; addItem(item); updateItemWeight(item->getWeight()); } return true; } void Container::updateItemWeight(double diff) { totalWeight += diff; if(Container* parent = getParentContainer()) parent->updateItemWeight(diff); } double Container::getWeight() const { return Item::getWeight() + totalWeight; } std::string Container::getContentDescription() const { std::stringstream s; return getContentDescription(s).str(); } std::stringstream& Container::getContentDescription(std::stringstream& 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* Container::getItem(uint32_t index) { size_t n = 0; for(ItemList::const_iterator cit = getItems(); cit != getEnd(); ++cit) { if(n == index) return *cit; else ++n; } return NULL; } uint32_t Container::getItemHoldingCount() const { uint32_t counter = 0; for(ContainerIterator it = begin(); it != end(); ++it) ++counter; return counter; } bool Container::isHoldingItem(const Item* item) const { for(ContainerIterator it = begin(); it != end(); ++it) { if((*it) == item) return true; } return false; } void Container::onAddContainerItem(Item* item) { const Position& cylinderMapPos = getPosition(); SpectatorVec list; SpectatorVec::iterator 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 Container::onUpdateContainerItem(uint32_t index, Item* oldItem, const ItemType& oldType, Item* newItem, const ItemType& newType) { const Position& cylinderMapPos = getPosition(); SpectatorVec list; SpectatorVec::iterator 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 Container::onRemoveContainerItem(uint32_t index, Item* item) { const Position& cylinderMapPos = getPosition(); SpectatorVec list; SpectatorVec::iterator 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 = std::max((uint32_t)1, count); return RET_NOERROR; } int32_t freeSlots = std::max((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__ std::clog << "Failure: [Container::__addThing], index:" << index << ", index >= capacity()" << std::endl; #endif return /*RET_NOTPOSSIBLE*/; } Item* item = thing->getItem(); if(!item) { #ifdef __DEBUG_MOVESYS__ std::clog << "Failure: [Container::__addThing] item == NULL" << std::endl; #endif return /*RET_NOTPOSSIBLE*/; } #ifdef __DEBUG_MOVESYS__ if(index != INDEX_WHEREEVER && size() >= capacity()) { std::clog << "Failure: [Container::__addThing] size() >= capacity()" << std::endl; 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() != VirtualCylinder::virtualCylinder) onAddContainerItem(item); } void Container::__updateThing(Thing* thing, uint16_t itemId, uint32_t count) { int32_t index = __getIndexOfThing(thing); if(index == -1) { #ifdef __DEBUG_MOVESYS__ std::clog << "Failure: [Container::__updateThing] index == -1" << std::endl; #endif return /*RET_NOTPOSSIBLE*/; } Item* item = thing->getItem(); if(!item) { #ifdef __DEBUG_MOVESYS__ std::clog << "Failure: [Container::__updateThing] item == NULL" << std::endl; #endif return /*RET_NOTPOSSIBLE*/; } const ItemType& oldType = Item::items[item->getID()]; const ItemType& newType = Item::items[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__ std::clog << "Failure: [Container::__replaceThing] item == NULL" << std::endl; #endif return /*RET_NOTPOSSIBLE*/; } uint32_t count = 0; ItemList::iterator cit = itemlist.end(); for(cit = itemlist.begin(); cit != itemlist.end(); ++cit) { if(count == index) break; ++count; } if(cit == itemlist.end()) { #ifdef __DEBUG_MOVESYS__ std::clog << "Failure: [Container::__updateThing] item not found" << std::endl; #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 = Item::items[(*cit)->getID()]; const ItemType& newType = Item::items[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__ std::clog << "Failure: [Container::__removeThing] item == NULL" << std::endl; #endif return /*RET_NOTPOSSIBLE*/; } int32_t index = __getIndexOfThing(thing); if(index == -1) { #ifdef __DEBUG_MOVESYS__ std::clog << "Failure: [Container::__removeThing] index == -1" << std::endl; #endif return /*RET_NOTPOSSIBLE*/; } ItemList::iterator cit = std::find(itemlist.begin(), itemlist.end(), thing); if(cit == itemlist.end()) { #ifdef __DEBUG_MOVESYS__ std::clog << "Failure: [Container::__removeThing] item not found" << std::endl; #endif return /*RET_NOTPOSSIBLE*/; } if(item->isStackable() && count != item->getItemCount()) { const double oldWeight = -item->getWeight(); item->setItemCount(std::max(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 = Item::items[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(ItemList::const_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(ItemList::const_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(ItemList::const_iterator it = itemlist.begin(); it != itemlist.end(); ++it) { if((*it) && (*it)->getID() == itemId && (subType == -1 || subType == (*it)->getSubType())) count += (*it)->getItemCount(); } return count; } std::map<uint32_t, uint32_t>& Container::__getAllItemTypeCount(std::map<uint32_t, uint32_t>& countMap) const { for(ItemList::const_iterator it = itemlist.begin(); it != itemlist.end(); ++it) countMap[(*it)->getID()] += (*it)->getItemCount(); return countMap; } void Container::postAddNotification(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 Container::postRemoveNotification(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__ std::clog << "[Container::__internalAddThing] index: " << index << std::endl; #endif if(!thing) return; Item* item = thing->getItem(); if(item == NULL) { #ifdef __DEBUG_MOVESYS__ std::clog << "Failure: [Container::__internalAddThing] item == NULL" << std::endl; #endif return; } itemlist.push_front(item); item->setParent(this); totalWeight += item->getWeight(); if(Container* parentContainer = getParentContainer()) parentContainer->updateItemWeight(item->getWeight()); } void Container::__startDecaying() { for(ItemList::const_iterator it = itemlist.begin(); it != itemlist.end(); ++it) (*it)->__startDecaying(); } ContainerIterator Container::begin() { ContainerIterator cit(this); if(!itemlist.empty()) { cit.over.push(this); cit.current = itemlist.begin(); } return cit; } ContainerIterator Container::end() { ContainerIterator cit(this); return cit; } ContainerIterator Container::begin() const { Container* evil = const_cast<Container*>(this); return evil->begin(); } ContainerIterator Container::end() const { Container* evil = const_cast<Container*>(this); return evil->end(); } ContainerIterator::ContainerIterator(): base(NULL) {} ContainerIterator::ContainerIterator(Container* _base): base(_base) {} ContainerIterator::ContainerIterator(const ContainerIterator& rhs): base(rhs.base), over(rhs.over), current(rhs.current) {} bool ContainerIterator::operator==(const ContainerIterator& rhs) { return !(*this != rhs); } bool ContainerIterator::operator!=(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& ContainerIterator::operator=(const ContainerIterator& rhs) { this->base = rhs.base; this->current = rhs.current; this->over = rhs.over; return *this; } Item* ContainerIterator::operator*() { assert(base); return *current; } Item* ContainerIterator::operator->() { return *(*this); } ContainerIterator& ContainerIterator::operator++() { 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 ContainerIterator::operator++(int32_t) { ContainerIterator tmp(*this); ++*this; return tmp; }
-
Remover exp de summon
Gostaria da ajuda de vocês pra remover a exp que o summon ganha, e fazer com que o player receba a exp toda, creio que seja nessa parte, mas como não tenho certeza e não quero arriscar tirar a exp party gostaria da ajuda de vcs, uso tfs 0.4 serv 8.71 void Creature::onTargetKilled(Creature* target) { if(target == this) return; double exp = target->getGainedExperience(this); onGainExperience(exp, target, false); } bool Creature::onKilledCreature(Creature* target, DeathEntry& entry) { bool ret = true; if(master) ret = master->onKilledCreature(target, entry); CreatureEventList killEvents = getCreatureEvents(CREATURE_EVENT_KILL); if(!entry.isLast()) { for(CreatureEventList::iterator it = killEvents.begin(); it != killEvents.end(); ++it) (*it)->executeKill(this, target, entry); return true; } for(CreatureEventList::iterator it = killEvents.begin(); it != killEvents.end(); ++it) { if(!(*it)->executeKill(this, target, entry) && ret) ret = false; } return ret; } void Creature::onGainExperience(double& gainExp, Creature* target, bool multiplied) { if(gainExp <= 0) return; if(master) { gainExp = gainExp / 2; master->onGainExperience(gainExp, target, multiplied); } else if(!multiplied) gainExp *= g_config.getDouble(ConfigManager::RATE_EXPERIENCE); int16_t color = g_config.getNumber(ConfigManager::EXPERIENCE_COLOR); if(color < 0) color = random_range(0, 255); std::stringstream ss; ss << (uint64_t)gainExp; g_game.addAnimatedText(getPosition(), (uint8_t)color, ss.str()); } void Creature::onGainSharedExperience(double& gainExp, Creature* target, bool multiplied) { if(gainExp <= 0) return; if(master) { gainExp = gainExp / 2; master->onGainSharedExperience(gainExp, target, multiplied); } else if(!multiplied) gainExp *= g_config.getDouble(ConfigManager::RATE_EXPERIENCE); int16_t color = g_config.getNumber(ConfigManager::EXPERIENCE_COLOR); if(color < 0) color = random_range(0, 255); std::stringstream ss; ss << (uint64_t)gainExp; g_game.addAnimatedText(getPosition(), (uint8_t)color, ss.str()); }
-
(Resolvido)Script de mineração
@MaTTch cara, e fiz uma alteração no script, e adicionei mais itemprizes e agora qdo ganha alguma item, ele da a msg de que ganho o item e em seguida essa ação é executada local configs = { sign = {{level = {0,9}, percent = 5}, {level = {10,19}, percent = 8}, {level = {20,29}, percent = 11}, {level = {30,39}, percent = 14}, {level = {40,49}, percent = 17}, {level = {50,59}, percent = 20}, {level = {60,69}, percent = 23}, {level = {70,79}, percent = 26}, {level = {80,89}, percent = 29}, {level = {90,99}, percent = 32}, {level = {100,200}, percent = 35}}, stones = {1285, 1356}, stones_prize = { {itemprize = 1294, quant = {1,5}, percent = {1,50}}, --small stones {itemprize = 2145, quant = {1,5}, percent = {51,55}}, -- small diamond {itemprize = 2146, quant = {1,5}, percent = {56,60}}, -- small sapphire {itemprize = 2147, quant = {1,5}, percent = {61,65}}, -- small ruby {itemprize = 2149, quant = {1,5}, percent = {66,70}}, -- small emerald {itemprize = 2150, quant = {1,5}, percent = {71,75}}, -- small amethyst }, grounds = {406}, grounds_prize = { {itemprize = 1294, quant = {1,5}, percent = {1,50}}, --small stones {itemprize = 2145, quant = {1,5}, percent = {51,55}}, -- small diamond {itemprize = 2146, quant = {1,5}, percent = {56,60}}, -- small sapphire {itemprize = 2147, quant = {1,5}, percent = {61,65}}, -- small ruby {itemprize = 2149, quant = {1,5}, percent = {66,70}}, -- small emerald {itemprize = 2150, quant = {1,5}, percent = {71,75}}, -- small amethyst {itemprize = 2219, quant = {1,1}, percent = {76,84}}, -- banana skin {itemprize = 2220, quant = {1,1}, percent = {85,93}}, -- dirty fur {itemprize = 5888, quant = {1,4}, percent = {94,98}}, -- iron {itemprize = 5887, quant = {1,3}, percent = {99,100}}, -- steel }, } function onUse(cid, item, fromPosition, itemEx, toPosition) local skills = getPlayerSkill(cid, SKILL_SWORD) if isInArray(configs.stones, itemEx.itemid) then doPlayerAddSkillTry(cid, SKILL_SWORD, 1) transform_stone = math.random(1, 100) if transform_stone < 16 then doTransformItem(itemEx.uid, 2160) doPlayerSendTextMessage(cid, 22, "More luck in your next time.") else for L = 1, #configs.sign do if skills >= configs.sign[L].level[1] and skills <= configs.sign[L].level[2] then if item.itemid == 4874 then percent = configs.sign[L].percent + 75 stry = 2 else percent = configs.sign[L].percent stry = 1 end print('Skill: '.. skills ..'.') print('Porce: '.. percent ..'%.') print('Stry: '.. stry ..'.') percent_chance = math.random(1, 100) print('PC '.. percent_chance ..'.') if percent_chance <= percent then for_stone_prize = math.random(1, 100) for M = 1, #configs.stones_prize do print('SP '.. for_stone_prize..'.') if for_stone_prize >= configs.stones_prize[M].percent[1] and for_stone_prize <= configs.stones_prize[M].percent[2] then quant = math.random(configs.stones_prize[M].quant[1],configs.stones_prize[M].quant[2]) doPlayerAddSkillTry(cid, SKILL_SWORD, stry) doPlayerAddItem(cid, configs.stones_prize[M].itemprize, quant) doPlayerSendTextMessage(cid, 22, "You won ".. quant .." ".. getItemNameById(configs.stones_prize[M].itemprize) ..".") break_chance = math.random(1,100) if break_chance < 6 then doTransformItem(itemEx.uid, 2160) end elseif (M == #configs.stones_prize) then doPlayerSendTextMessage(cid, 22, "You have not won anything, try again..") end end else doPlayerSendTextMessage(cid, 22, "You did not succeed in mining , try again.") end break end end end elseif isInArray(configs.grounds, itemEx.itemid) then doPlayerAddSkillTry(cid, SKILL_SWORD, 1) transform_ground = math.random(1, 100) if transform_ground < 16 then doTransformItem(itemEx.uid, 2160) doPlayerSendTextMessage(cid, 22, "More luck in your next time.") else for L = 1, #configs.sign do if skills >= configs.sign[L].level[1] and skills <= configs.sign[L].level[2] then if item.itemid == 4874 then percent = configs.sign[L].percent + 75 stry = 2 else percent = configs.sign[L].percent stry = 1 end print('Skill: '.. skills ..'.') print('Porce: '.. percent ..'%.') print('Stry: '.. stry ..'.') percent_chance = math.random(1, 100) print('PC '.. percent_chance ..'.') if percent_chance <= percent then for_ground_prize = math.random(1, 100) for M = 1, #configs.grounds_prize do print('SP '.. for_ground_prize..'.') if for_ground_prize >= configs.grounds_prize[M].percent[1] and for_ground_prize <= configs.grounds_prize[M].percent[2] then quant = math.random(configs.grounds_prize[M].quant[1],configs.grounds_prize[M].quant[2]) doPlayerAddSkillTry(cid, SKILL_SWORD, stry) doPlayerAddItem(cid, configs.grounds_prize[M].itemprize, quant) doPlayerSendTextMessage(cid, 22, "You won ".. quant .." ".. getItemNameById(configs.grounds_prize[M].itemprize) ..".") break_chance = math.random(1,100) if break_chance < 6 then doTransformItem(itemEx.uid, 2160) end elseif (M == #configs.grounds_prize) then doPlayerSendTextMessage(cid, 22, "You have not won anything, try again..") end end else doPlayerSendTextMessage(cid, 22, "You did not succeed in mining , try again.") end break end end end end end
-
(Resolvido)Script de mineração
@MaTTch Dica: deixe as variáveis locais e não globais. não sei oque isso significa (:
-
(Resolvido)Script de mineração
@wevertonvrb mas se tu olhar aqui, com pickaxe fica bem vantajoso e mesmo assim fica dificil de pegar @MaTTch aqui não vai break? ou esquece-se? e mais uma coisinha, podes me explicar o por que de assim funcionar?
-
(Resolvido)Script de mineração
Opa, eu tentei fazer esse script de mineração, ele até funciona, mas não parece que funfa 100% certin, ele faz o que era pra fazer, mas eu botei o percent bem alto usando o pickaxe e mesmo assim existe dificuldade de pegar o item, eu nunca usei o for, então não sei se usei ele corretamente, alguém que netende bem poderia dar uma olhada e dizer no que estou errado? a parte do ground podem ignorar, só a parte do stones mesmo local configs = { sign = {{level = {0,9}, quant = {1,2}, percent = 5}, {level = {10,19}, quant = {2,4}, percent = 8}, {level = {20,29}, quant = {3,6}, percent = 11}, {level = {30,39}, quant = {4,8}, percent = 14}, {level = {40,49}, quant = {5,10}, percent = 17}, {level = {50,59}, quant = {6,12}, percent = 20}, {level = {60,69}, quant = {7,14}, percent = 23}, {level = {70,79}, quant = {8,16}, percent = 26}, {level = {80,89}, quant = {9,18}, percent = 29}, {level = {90,99}, quant = {10,20}, percent = 32}, {level = {100,200}, quant = {11,22}, percent = 35}}, stones = {1285, 1356}, stones_prize = { {itemprize = 2160, percent = {1,10}}, {itemprize = 2152, percent = {11,30}}, {itemprize = 2148, percent = {31,100}}, }, grounds = {406}, grounds_prize = { {itemprize = 2160, percent = {0,1}}, {itemprize = 2157, percent = {2,3}} }, } function onUse(cid, item, fromPosition, itemEx, toPosition) local skills = getPlayerSkill(cid, SKILL_SWORD) if isInArray(configs.stones, itemEx.itemid) then doPlayerAddSkillTry(cid, SKILL_SWORD, 1) transform_stone = math.random(1, 100) if transform_stone < 16 then doTransformItem(itemEx.uid, 2160) doPlayerSendTextMessage(cid, 22, "More luck in your next time.") else for L = 1, #configs.sign do if skills >= configs.sign[L].level[1] and skills <= configs.sign[L].level[2] then quant = math.random(configs.sign[L].quant[1],configs.sign[L].quant[2]) if item.itemid == 4874 then percent = configs.sign[L].percent + 75 stry = 2 else percent = configs.sign[L].percent stry = 1 end print('Skill: '.. skills ..'.') print('Porce: '.. percent ..'%.') print('Stry: '.. stry ..'.') percent_chance = math.random(1, 100) print('PC '.. percent_chance ..'.') if percent_chance <= percent then for M = 1, #configs.stones_prize do for_stone_prize = math.random(1, 100) print('SP '.. for_stone_prize..'.') if for_stone_prize >= configs.stones_prize[M].percent[1] and for_stone_prize <= configs.stones_prize[M].percent[2] then doPlayerAddSkillTry(cid, SKILL_SWORD, stry) doPlayerAddItem(cid, configs.stones_prize[M].itemprize, quant) doPlayerSendTextMessage(cid, 22, "You won ".. quant .." ".. getItemNameById(configs.stones_prize[M].itemprize) ..".") break_chance = math.random(1,100) if break_chance < 6 then doTransformItem(itemEx.uid, 2160) end break else doPlayerSendTextMessage(cid, 22, "You have not won anything, try again..") break end end else doPlayerSendTextMessage(cid, 22, "You did not succeed in mining , try again.") end break end end end elseif isInArray(configs.grounds, itemEx.itemid) then doPlayerAddSkillTry(cid, SKILL_SWORD, 1) transform_ground = math.random(1, 100) if transform_ground < 16 then doTransformItem(itemEx.uid, 2160) doPlayerSendTextMessage(cid, 22, "Sorry, but this ground was empty.") else for L = 1, #configs.sign do if skills >= configs.sign[L].level[1] and skills <= configs.sign[L].level[2] then quant = math.random(configs.sign[L].quant[1],configs.sign[L].quant[2]) percent_chance = math.random(1, 100) if percent_chance <= percent then for M = 1, #configs.grounds_prize do for_ground_prize = math.random(1, 100) if for_ground_prize >= configs.grounds_prize[M].percent[1] and for_grounds_prize <= configs.grounds_prize[M].percent[2] then doPlayerAddItem(cid, configs.grounds_prize[M].itemprize, quant) doPlayerSendTextMessage(cid, 22, "You won ".. quant .." ".. getItemNameById(configs.grounds_prize[M].itemprize) ..".") doTransformItem(itemEx.uid, 2160) else doPlayerSendTextMessage(cid, 22, "You have not won anything, try again..") end break end else doPlayerSendTextMessage(cid, 22, "You did not succeed in mining , try again.") end break end end end end end
-
Mining System
Gostaria de um sistema de mining, os que eu achei não eram como eu gostaria, tipo, preciso que seja assim: 1. Ao usar a pick, ele retorne numa skill normal ao invés de storages, skill_id 7 por exemplo, e retorne em tries igual skill de combate normal 2. Haverá diferença entre pick e dwarven pickaxe, se for com a pick tem suas porcentagens, mas se for com a pickaxe tem 10% a mais do que a pick 3. A cada número X de level aumenta a % de conseguir algo 4. Cada item que pode ser pego terá uma % diferente uma da outra, baseando-se nas skills (EX: small stone com skill 3 = 2%, com skill 20 = 6% e se for gold com skill 3 = 0.2%, com skill 20 = 1%) 4.1. Serão de 3 a 4 itens diferentes (ainda não decididos) 5. Tem que ter grounds e stone definidos para poder mineirar 6. Ao mineirar na pedra, cada batida na pedra tem uma % alta de a pedra se desfazer caso seja a pedra pequena, se for a grande ela decay pra outra e da outra ela vira a pequena, que então se desfaz, e demora de 2h~5h pra pedra voltar 7. Ao mineirar no chão, a chance de o chão 'secar' e ao secar ele decay para outro, e leva também de 2h~5h pra voltar ao normal 8. Qualquer um pode mineirar, mas se for premium tem mais 8% de chances de conseguir o item 9. E por último, se for vocation > 3 ganha mais 3% de chances, tem que ser vocation e não promotion
-
Opção de mudar Game_Port
Seguinte, preciso de uma ajudinha pra fazer o seguinte: O cara entra na conta e aparece a charlist, até ai normal, só que depois que seleciona o char eu não queria que entrasse direto, preciso que abra uma nova janela com duas opções, na primeira ele redireciona pro game_port normal do server, porém se escolher a segunda opção a game_port muda pra 7174 REZALENDA que é no protocollogin.cpp, nessa parte: Não sei se faz diferença mas eu uso OTC
-
Server aceitando world_id 0 e 1
Queria saber como faço pra meu servidor de game port 7174 e world_id 2, aceitar os chars dos world_ids 0 e 1 sem usar o multiworld pra isso, um cara me disse que é no iologindata.cpp porém só disse até ai pois não sabe mexer com database, queria saber oque eu deveria alterar, eu tentei assim: #ifndef __LOGIN_SERVER__ query << "SELECT `name` FROM `players` WHERE `account_id` = " << accountId << " AND `world_id` = 0 or `world_id` = 1 AND `deleted` = 0"; e aparecia todos os chars independente de ser da conta ou não PS1: dai tentei assim : #ifndef __LOGIN_SERVER__ query << "SELECT `name` FROM `players` WHERE `account_id` = " << accountId << " AND `deleted` = 0"; e apareceu os chars só da conta, porém deu um erro dizendo que não pode carregar o char "couldn't be loaded" PS2: Já resolvi, faltava remover o world_id de outro local, pode fechar se quiser
-
Cast System Summ
bump
-
Gesior em branco no Ubuntu
Opa, eu segui esse tutorial e depois de colocar o site gesior na pasta www quando tento acessar ele pelo navegador fica tudo em branco, eu uso ubuntu 12.04, alguém saberia me ajudar?
-
Cast System Summ
Opa, pessoal, eu extrai o cast system do summ de um tfs 0.4 8.60 e coloquei no meu 0.4 8.71, e qdo alguem está sendo o caster ele não consegue falar nada no chat do cast, e quem está assistindo só recebe uma imagem parada do momento em que ele entrou no cast, alguem saberia me ajudar?