Postado Novembro 16, 2015 9 anos Eae galera, estava vendo alguns tópicos aqui do fórum e vi muita gente procurando issoe eu também procurei e não achei, então resolvi procurar,e achei na OTLand e estou trazendo para cá, EU APENAS TRADUZI, NÃO TENHO NENHUM CRÉDITO POR ISSO. Se eu não poder fazer isso por favor me avisem aqui no tópico que eu retiro. Créditos SOMENTE do: cbrm (OTLand) Tópico Oficial:https://otland.net/threads/reward-chest-boss-reward-tfs-1-2.233397/ Tested on TFS 1.2, 10.77/78Based on http://www.tibia.com/news/?subtopic=newsarchive&id=2486 Oque tem? Spoiler *Custom depot como reward chest para armazenar o loot que não foi pego dos bosses.*Recompensa individual para cada jogador que da hit no boss.*Chance de loot determinado por % do dano causado ao boss.*O player pode "pegar" seu reward container diretamente do corpo do boss.*Recompensas não reclamadas são enviadas para os reward chests dos players online e offline quando o corpo apodrecer.*Loot que não for pego sera apagados após sete dias de ser armazenado*Os items apenas podem ser retirados do reward chest, e não pode colocar items lá dentro.*Reward chests dos players são armazenados codificados, serialized tables on database*Limite de exhaustion para abrir o reward chest, a fim de evitar o spam em sql queries. To-do Spoiler *Dano recebido pelo boss leva a uma queda de % do loot.*Quantidade de healers dada a boss slayers leva a uma queda de % do loot. *Abrir reward chest com um inner depot. *Definir os corpos dos bosses como um depot para torná-los mais realistar. Changelog Spoiler (0.1) lançamento inicial(0.2) base64 coding para recompensas serializados(0.3) correção com bosses com corpses infinitos(0.4) correçao para os bosses com nomes minúsculos Comentários Spoiler Esse é um sistema que eu fui contratado a escrever um ano atrás, Agora foi lançado com o consentimento do cliente. É parecido com o Tibia's Boss Reward recurso que permite que todos os jogadores que participaram de matar o boss pegue parte do seu loot. Ele ainda está muito longe da criação original, mas pelo menos é algo que muitos donos de OTS desejam. Eu convido todos os desenvolvedores, programadores e criadores de scripts que desejam melhorar este código, para que isso possa ficar mais perto da perfeição. Agradecimentos especiais para Spoiler @Dalkon, por dicas em C++@gugahoa, pelas funções do loot@Colandus and @Cykotitan, pelo string.diff function@Printer, por atualizar as exhaustion functions Instruções de instalação Execute a query na database CREATE TABLE IF NOT EXISTS `player_rewardchest` ( `id` int(11) NOT NULL AUTO_INCREMENT, `player_id` int(11) NOT NULL, `reward` text NOT NULL, `date` bigint(20) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), FOREIGN KEY (`player_id`) REFERENCES `players` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB; src/const.h Abaixo... ITEM_MARKET = 14405 ...Adicione: ITEM_REWARD_CHEST = 21584, REWARD_CHEST_DEPOT = 99, src/depotchest.h Abaixo... explicit DepotChest(uint16_t _type); ...Adicione: uint32_t getDepotId() const { return depotId; } void setDepotId(uint32_t id) { depotId = id; } Abaixo... uint32_t maxDepotItems; ...Adicione: uint32_t depotId; src/depotchest.cpp Abaixo... maxDepotItems = 1500; ...Adicione: depotId = 0; Acima... return Container::queryAdd(index, thing, count, flags, actor); ...Adicione: if (actor != nullptr && getDepotId() == REWARD_CHEST_DEPOT) { return RETURNVALUE_NOTPOSSIBLE; } src/depotlocker.h Acima... //cylinder implementations ...Adicione: void setMaxLockerItems(uint32_t maxitems) { maxSize = maxitems; } src/luascript.h Acima... static int luaContainerGetSize(lua_State* L); ...Adicione: static int luaContainerGetContentDescription(lua_State* L); src/luascript.cpp Acima... registerMethod("Container", "getSize", LuaScriptInterface::luaContainerGetSize); ...Adicione: registerMethod("Container", "getContentDescription", LuaScriptInterface::luaContainerGetContentDescription); Acima... int LuaScriptInterface::luaContainerGetSize(lua_State* L) ...Adicione: int LuaScriptInterface::luaContainerGetContentDescription(lua_State* L) { // container:getContentDescription() Container* container = getUserdata<Container>(L, 1); if (container) { std::ostringstream ss; ss << container->getContentDescription(); pushString(L, ss.str()); } else { lua_pushnil(L); } return 1; } src/actions.cpp Troque: //depot container if (DepotLocker* depot = container->getDepotLocker()) { DepotLocker* myDepotLocker = player->getDepotLocker(depot->getDepotId()); myDepotLocker->setParent(depot->getParent()->getTile()); openContainer = myDepotLocker; player->setLastDepotId(depot->getDepotId()); } else { openContainer = container; } Por: //reward chest and depot container if (item->getID() == ITEM_REWARD_CHEST) { DepotLocker* myRewardChest = player->getRewardChest(); myRewardChest->setParent(item->getTile()); openContainer = myRewardChest; player->setLastDepotId(REWARD_CHEST_DEPOT); } else if (DepotLocker* depot = container->getDepotLocker()) { DepotLocker* myDepotLocker = player->getDepotLocker(depot->getDepotId()); myDepotLocker->setParent(depot->getParent()->getTile()); openContainer = myDepotLocker; player->setLastDepotId(depot->getDepotId()); } else { openContainer = container; } src/player.h Abaixo... DepotLocker* getDepotLocker(uint32_t depotId); ...Adicione: DepotLocker* getRewardChest(); src/player.cpp Abaixo... DepotChest* depotChest = new DepotChest(ITEM_DEPOT); ...Adicione: depotChest->setDepotId(depotId); Acima... void Player::sendCancelMessage(ReturnValue message) const ...Adicione: DepotLocker* Player::getRewardChest() { auto it = depotLockerMap.find(REWARD_CHEST_DEPOT); if (it != depotLockerMap.end()) { inbox->setParent(it->second); return it->second; } DepotLocker* rewardChest = new DepotLocker(ITEM_LOCKER1); rewardChest->setDepotId(REWARD_CHEST_DEPOT); rewardChest->setMaxLockerItems(1); rewardChest->internalAddThing(getDepotChest(REWARD_CHEST_DEPOT, true)); depotLockerMap[REWARD_CHEST_DEPOT] = rewardChest; return rewardChest; } On player.cpp, container.cpp, inbox.cpp Change: if (!item->isPickupable()) { Por: if (item->getID() != 21518 && !item->isPickupable()) { Adicione em @ data/actions/actions.xml <!-- Reward Chest System --> <action itemid="21584" script="reward_chest.lua"/> <action actionid="21584" script="reward_chest.lua"/> Crie @ data/actions/scripts/reward_chest.lua function onUse(player, item, fromPosition, target, toPosition, isHotkey) --Reward Chest if item:getId() == 21584 then if player:getExhaustion(REWARD_CHEST.STORAGE) > 0 then return player:sendCancelMessage('You need to wait ' .. string.diff(player:getStorageValue(REWARD_CHEST.STORAGE)-os.time()) .. ' before using this chest again.') end player:updateRewardChest() --Boss Corpse elseif item:getActionId() == 21584 then local reward = REWARD_CHEST.LOOT[tonumber(item:getAttribute('text'))][player:getGuid()] if reward ~= nil then local rewardBag = Container(doCreateItemEx(REWARD_CHEST.CONTAINER, 1)) addContainerItems(rewardBag, reward) if player:getCapacity() < rewardBag:getCapacity() then return player:sendCancelMessage(RETURNVALUE_NOTENOUGHCAPACITY) end if player:addItemEx(rewardBag, false) == RETURNVALUE_NOERROR then REWARD_CHEST.LOOT[tonumber(item:getAttribute('text'))][player:getGuid()] = nil player:sendCancelMessage('You have picked up a reward container.') else player:sendCancelMessage(RETURNVALUE_NOTENOUGHROOM) return true end end end return false end Adicione @ data/creaturescripts/creaturescripts.xml <event type="kill" name="RewardChest" script="reward_chest.lua"/> Registre em @data/creaturescripts/scripts/login.lua player:registerEvent("RewardChest") Adicione @ data/items/items.xml <item id="21518" article="a" name="reward container"> <attribute key="weight" value="1800" /> <attribute key="containersize" value="24" /> <attribute key="slotType" value="backpack" /> </item> <item id="21584" article="a" name="reward chest"> <attribute key="type" value="depot" /> <attribute key="containerSize" value="1" /> <attribute key="description" value="This chest contains your rewards earned in battles." /> </item> Add @ data/lib/core/player.lua function Player.setExhaustion(self, value, time) return self:setStorageValue(value, time + os.time()) end function Player.getExhaustion(self, value) local storage = self:getStorageValue(value) if storage <= 0 then return 0 end return storage - os.time() end Crie em @ data/creaturescripts/scripts/reward_chest.lua (download anexado nesse post) Download RELEMBRANDO CRÉDITOS APENAS DO CBRM DA OTLAND Editado Novembro 17, 2015 9 anos por kk4444 *Adicionar Imagens e Link de Download (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.