[Duvida/Pedido] Sistema de guild com prefix
-
Quem Está Navegando 0 membros estão online
Nenhum usuário registrado visualizando esta página.
-
Conteúdo Similar
-
Por luanluciano93
Olá pessoal, estou desenvolvendo esse sistema vip para TFS 1.x, se precisarem de alguma função nova é só comentar, criei para usar em um servidor meu e resolvi postar, bom proveito a todos.
É só ir no arquivo data/lib/core/player.lua e adicionar esse código no começo do script:
-- ALTER TABLE `accounts` ADD `vip_time` BIGINT(20) NOT NULL DEFAULT 0; -- player:getVipTime() function Player.getVipTime(self) local resultId = db.storeQuery("SELECT `vip_time` FROM `accounts` WHERE `id` = '".. self:getAccountId() .."';") local time = resultId ~= false and result.getNumber(resultId, "vip_time") or 0 result.free(resultId) return time end -- player:isVip() function Player.isVip(self) return self:getVipTime() > os.time() and true or false end -- player:addVipDays(days) function Player.addVipDays(self, days) return(self:isVip() and tonumber((days * 86400))) and db.query("UPDATE `accounts` SET `vip_time` = '".. (self:getVipTime() + (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") or db.query("UPDATE `accounts` SET `vip_time` = '".. (os.time() + (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") end -- player:removeVipDays(days) function Player.removeVipDays(self, days) return(self:isVip() and tonumber((days * 86400))) and db.query("UPDATE `accounts` SET `vip_time` = '".. (self:getVipTime() - (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") or db.query("UPDATE `accounts` SET `vip_time` = '".. (os.time() - (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") end -- player:setVipDays(days) function Player.setVipDays(self, days) return db.query("UPDATE `accounts` SET `vip_time` = '".. (os.time() - (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") end -- player:removeVip() function Player.removeVip(self) db.query("UPDATE `accounts` SET `vip_time` = '0' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") end -- player:sendVipDaysMessage() function Player.sendVipDaysMessage(self) if self:isVip() then local vipTime = self:getVipTime() - os.time() local vipDays = 1 + (math.floor(vipTime / 86400)) return self:getVipTime() ~= false and self:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You have '.. vipDays .. ' vip day(s) in your account.') end end -- player:checkVipLogin() function Player.checkVipLogin(self) if self:getVipTime() > 0 and not self:isVip() then return self:removeVip() and self:teleportTo(self:getTown():getTemplePosition()) end end
As funções são:
• player:getVipTime() - Retorna o valor da tabela vip_time (igual esta na database).
• player:isVip() - Retorna se o player é vip ou não.
• player:addVipDays(days) - Usa-se em algum script para para adicionar dias de vip ao player (parâmetro de entrada "days").
• player:removeVipDays(days) - Usa-se em algum script para para remover dias de vip do player (parâmetro de entrada "days").
• player:setVipDays(days) - Usa-se em algum script para para mudar os dias de vip do player (parâmetro de entrada "days").
• player:removeVip() - Usa-se em algum script para para remover todo tempo de vip do player.
• player:sendVipDaysMessage() - Retorna uma mensagem no player mostrando os dias de vip que ainda restam ao player.
• player:checkVipLogin() - Checa se a vip do player acabou, se sim teleporta ele para o templo.
Qualquer dúvida ou erro/bug poste aqui.
-
Por Killua
Como funciona?
A cada monstro que vc mata, seus itens equipados ganham 1 de exp. Quando seus itens chegarem às quantidades de exp definidas, eles upam e ficam com o nome assim: Demon Helmet + 1. Helmets, armors, legs, e boots recebem 1 de arm a cada vez que upam. Armas recebem 1 de ataque e escudos 1 de defesa.
Para o monstro contar, ele deve dar um mínimo de exp (definido no script). O número de exp a que me refiro é aquele um presente no arquivo .xml.
Para instalar, crie Killua Items Upgrade.lua em data/creaturescripts/scripts e coloque:
Em data/creaturescripts/creaturescripts.xml coloque essas duas tags:
<event type="kill" name="Item level" event="script" value="Killua Items Upgrade.lua"/> <event type="login" name="Item levell" event="script" value="Killua Items Upgrade.lua"/> Configurando: Na tabela table_of_slots, coloque em quais slots os itens upam.
min_exp é a experiência mínima que o monstro deve ter para contar exp para o item. Se vc colocar 500, somente os monstros que tem exp igual ou superior a 500 no arquivo.xml vão valer.
exp_levels são os valores de exp que os itens devem atingir para upar. No meu caso, quando o item alcançar 50 de exp, ele upa para o level 1. Quando alcançar 50 de exp, upa para o level 2 e assim por diante.
-
Por Natanael Beckman
Obrigatoriamente leia tudo!
Atualizado 01/07/2014
Opa galera mais uma vez eu trazendo o melhor para todos.
Hoje vou postar o sistema de Guild de Points que eu utilizo em meu OTserver, acredito que dificilmente será encontrado por ae um tão completo e sem bugs igual o que será postado logo abaixo, é um sistema completo que é utilizado pelo líder da guild executando um comando que, se tiver de acordo com as regras que seram feitas por você, todos os membros da guild iram receber os pontos uma unica vez, lembrando que quando os pontos são adicionados a um player ele não receberá entrando em outra guild e não receberá criando outro personagem na conta, resumindo ele só receberá uma unica vez na conta e com um player só. E um dos detalhes que me causava dor de cabeça era que quando um líder executava o comando, quem estava online recebia os pontos, mais quem estava offline não recebia, isso acontecia normalmente porque tem guilds que contém 50, 70, 100 players, portanto nem sempre todos estavam online. O comando só pode ser executado uma vez por dia cada guild, para não gerar processamentos desnecessários e assim um mal funcionamento do servidor.
Cada administrador pode configurar seu sistema da forma que quiser, por ser um sistema muito simples, você pode bota que todos os players estejam no minimo level x, que a guild só possa executar o comando quando estiver quantidade x de players online, isso é bom porque traz um certa dificuldade para fraudes de pontos, e o sistema só vira bagunça dependendo do que você vai oferecer no seu shop guild, eu particularmente só utilizei esse comando porque muitas guilds grandes pediam pontos, eles me cobravam uma quantidade x de pontos e eu cobrava uma quantidade x de player então pra automatizar o processo e não ter dor de cabeça foi feito todo esse sistema. Se você analisar bem vai ver que tudo isso só gera mais crescimento ao seu servidor.
Bom, vamos ao sistema:
Em talkactions.xml, adicione a tag abaixo:
<talkaction words="!guildpoints" event="script" value="guildpoints.lua"/> Na pasta talkactions/scripts faça um .lua com o nome guildpoints e dentro dele adicione os coder abaixo: GuildPointsConfigs = { ExecuteIntervalHours = 24, NeedPlayersOnline = 10, NeedDiferentIps = 6, MinLevel = 80, AddPointsForAcc = 9 } function getGuildPlayersValidAccIDS(GuildID, MinLevel) local RanksIDS = {} local AccsID = {} local ValidAccsID = {} Query1 = db.getResult("SELECT `id` FROM `guild_ranks` WHERE guild_id = '".. GuildID .."'") if(Query1:getID() == -1) then return ValidAccsID end for i = 1, Query1:getRows() do table.insert(RanksIDS, Query1:getDataInt("id")) Query1:next() end Query2 = db.getResult("SELECT `account_id` FROM `players` WHERE `rank_id` IN (".. table.concat(RanksIDS, ', ') ..") AND `level` >= ".. MinLevel .."") if(Query2:getID() == -1) then return ValidAccsID end for i = 1, Query2:getRows() do local AccID = Query2:getDataInt("account_id") if #AccsID > 0 then for k = 1, #AccsID do if AccID == AccsID[k] then AddAccList = false break end AddAccList = true end if AddAccList then table.insert(AccsID, AccID) end else table.insert(AccsID, AccID) end Query2:next() end Query3 = db.getResult("SELECT `id` FROM `accounts` WHERE `guild_points_stats` = 0 AND `id` IN (".. table.concat(AccsID, ', ') ..")") if(Query3:getID() == -1) then return ValidAccsID end for i = 1, Query3:getRows() do local AccID = Query3:getDataInt("id") if #ValidAccsID > 0 then for k = 1, #ValidAccsID do if AccID == ValidAccsID[k] then AddAccList = false break end AddAccList = true end if AddAccList then table.insert(ValidAccsID, AccID) end else table.insert(ValidAccsID, AccID) end Query3:next() end return ValidAccsID end function onSay(cid, words, param, channel) if(getPlayerGuildLevel(cid) == 3) then local GuildID = getPlayerGuildId(cid) Query = db.getResult("SELECT `last_execute_points` FROM `guilds` WHERE id = '".. GuildID .."'") if(Query:getID() == -1) then return true end if Query:getDataInt("last_execute_points") < os.time() then local GuildMembers = {} local GuildMembersOnline = {} local PlayersOnline = getPlayersOnline() for i, pid in ipairs(PlayersOnline) do if getPlayerGuildId(pid) == GuildID then if getPlayerLevel(pid) >= GuildPointsConfigs.MinLevel then table.insert(GuildMembersOnline, pid) end end end if #GuildMembersOnline >= GuildPointsConfigs.NeedPlayersOnline then local IPS = {} for i, pid in ipairs(GuildMembersOnline) do local PlayerIP = getPlayerIp(pid) if #IPS > 0 then for k = 1, #IPS do if PlayerIP == IPS[k] then AddIPList = false break end AddIPList = true end if AddIPList then table.insert(IPS, PlayerIP) end else table.insert(IPS, PlayerIP) end end if #IPS >= GuildPointsConfigs.NeedDiferentIps then local ValidAccounts = getGuildPlayersValidAccIDS(GuildID, GuildPointsConfigs.MinLevel) db.executeQuery("UPDATE `guilds` SET `last_execute_points` = ".. os.time() +(GuildPointsConfigs.ExecuteIntervalHours * 3600) .." WHERE `guilds`.`id` = ".. GuildID ..";") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "".. #ValidAccounts .." Players received points") if #ValidAccounts > 0 then db.executeQuery("UPDATE `accounts` SET `guild_points` = `guild_points` + " ..GuildPointsConfigs.AddPointsForAcc .. ", `guild_points_stats` = ".. os.time() .." WHERE `id` IN (" .. table.concat(ValidAccounts, ',') ..");") for i, pid in ipairs(GuildMembersOnline) do local PlayerMSGAccID = getPlayerAccountId(pid) for k = 1, #ValidAccounts do if PlayerMSGAccID == ValidAccounts[k] then doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "You received "..GuildPointsConfigs.AddPointsForAcc .." guild points.") break end end end end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Only ".. #IPS .." players are valid, you need ".. GuildPointsConfigs.NeedDiferentIps .." players with different ips.") end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Has only ".. #GuildMembersOnline .." players online you need ".. GuildPointsConfigs.NeedPlayersOnline .." players online at least from level ".. GuildPointsConfigs.MinLevel ..".") end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "The command can only be run once every "..GuildPointsConfigs.ExecuteIntervalHours .." hours.") end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Only guild leader can request points.") end return true end No coder acima bem no inicio tem as linhas seguintes para configurar:
ExecuteIntervalHours = 24, ( Intervalo para execução do comando, ae está de 24 em 24hrs)
NeedPlayersOnline = 10, (Quantos players é preciso está online para poder executar o comando.)
NeedDiferentIps = 6, (Quantos IPS diferentes são necessários para executar o comando no exemplo ae tem 6.)
MinLevel = 80, (Aqui adicione o level minimo, é necessário que todos os player da guild tenha o level pedido para o lider executar o comando.)
AddPointsForAcc = 9, (Aqui é a quantidade de pontos para adicionar em cada player da guild.)
Em data/globalevents/scripts crie um arquivo chamado shopguild.lua e adicione o code a seguir:
local SHOP_MSG_TYPE = MESSAGE_EVENT_ORANGE local SQL_interval = 30 function onThink(interval, lastExecution) local result_plr = db.getResult("SELECT * FROM z_ots_guildcomunication WHERE `type` = 'login';") if(result_plr:getID() ~= -1) then while(true) do local id = tonumber(result_plr:getDataInt("id")) local action = tostring(result_plr:getDataString("action")) local delete = tonumber(result_plr:getDataInt("delete_it")) local cid = getCreatureByName(tostring(result_plr:getDataString("name"))) if isPlayer(cid) then local itemtogive_id = tonumber(result_plr:getDataInt("param1")) local itemtogive_count = tonumber(result_plr:getDataInt("param2")) local container_id = tonumber(result_plr:getDataInt("param3")) local container_count = tonumber(result_plr:getDataInt("param4")) local add_item_type = tostring(result_plr:getDataString("param5")) local add_item_name = tostring(result_plr:getDataString("param6")) local received_item = 0 local full_weight = 0 if add_item_type == 'container' then container_weight = getItemWeightById(container_id, 1) if isItemRune(itemtogive_id) == TRUE then items_weight = container_count * getItemWeightById(itemtogive_id, 1) else items_weight = container_count * getItemWeightById(itemtogive_id, itemtogive_count) end full_weight = items_weight + container_weight else full_weight = getItemWeightById(itemtogive_id, itemtogive_count) if isItemRune(itemtogive_id) == TRUE then full_weight = getItemWeightById(itemtogive_id, 1) else full_weight = getItemWeightById(itemtogive_id, itemtogive_count) end end local free_cap = getPlayerFreeCap(cid) if full_weight <= free_cap then if add_item_type == 'container' then local new_container = doCreateItemEx(container_id, 1) local iter = 0 while iter ~= container_count do doAddContainerItem(new_container, itemtogive_id, itemtogive_count) iter = iter + 1 end received_item = doPlayerAddItemEx(cid, new_container) else local new_item = doCreateItemEx(itemtogive_id, itemtogive_count) doItemSetAttribute(new_item, "description", "This item can only be used by the player ".. getPlayerName(cid) .."!") doItemSetAttribute(new_item, "aid", getPlayerGUID(cid)+10000) received_item = doPlayerAddItemEx(cid, new_item) end if received_item == RETURNVALUE_NOERROR then doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS GuildShop.') db.executeQuery("DELETE FROM `z_ots_guildcomunication` WHERE `id` = " .. id .. ";") db.executeQuery("UPDATE `z_shopguild_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";") else doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS GuildShop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.') end else doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS GuildShop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '.. SQL_interval ..' seconds to get it.') end end if not(result_plr:next()) then break end end result_plr:free() end return true end Em data/globalevents/globalevents.xml adicione a seguinte tag:
<globalevent name="shopguild" interval="300" event="script" value="shopguild.lua"/> Certo, a parte do servidor é esta, ta feita, vamos adicionar a database o coder a seguir:
ALTER TABLE `accounts` ADD `guild_points` INTEGER(11) NOT NULL DEFAULT 0; ALTER TABLE `accounts` ADD `guild_points_stats` INT NOT NULL DEFAULT '0'; ALTER TABLE `guilds` ADD `last_execute_points` INT NOT NULL DEFAULT '0'; CREATE TABLE `z_shopguild_offer` ( `id` int(11) NOT NULL auto_increment, `points` int(11) NOT NULL default '0', `itemid1` int(11) NOT NULL default '0', `count1` int(11) NOT NULL default '0', `itemid2` int(11) NOT NULL default '0', `count2` int(11) NOT NULL default '0', `offer_type` varchar(255) default NULL, `offer_description` text NOT NULL, `offer_name` varchar(255) NOT NULL, `pid` INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`)) CREATE TABLE `z_shopguild_history_item` ( `id` int(11) NOT NULL auto_increment, `to_name` varchar(255) NOT NULL default '0', `to_account` int(11) NOT NULL default '0', `from_nick` varchar(255) NOT NULL, `from_account` int(11) NOT NULL default '0', `price` int(11) NOT NULL default '0', `offer_id` int(11) NOT NULL default '0', `trans_state` varchar(255) NOT NULL, `trans_start` int(11) NOT NULL default '0', `trans_real` int(11) NOT NULL default '0', PRIMARY KEY (`id`)) CREATE TABLE `z_shopguild_history_pacc` ( `id` int(11) NOT NULL auto_increment, `to_name` varchar(255) NOT NULL default '0', `to_account` int(11) NOT NULL default '0', `from_nick` varchar(255) NOT NULL, `from_account` int(11) NOT NULL default '0', `price` int(11) NOT NULL default '0', `pacc_days` int(11) NOT NULL default '0', `trans_state` varchar(255) NOT NULL, `trans_start` int(11) NOT NULL default '0', `trans_real` int(11) NOT NULL default '0', PRIMARY KEY (`id`)) CREATE TABLE IF NOT EXISTS `z_ots_guildcomunication` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `type` varchar(255) NOT NULL, `action` varchar(255) NOT NULL, `param1` varchar(255) NOT NULL, `param2` varchar(255) NOT NULL, `param3` varchar(255) NOT NULL, `param4` varchar(255) NOT NULL, `param5` varchar(255) NOT NULL, `param6` varchar(255) NOT NULL, `param7` varchar(255) NOT NULL, `delete_it` int(2) NOT NULL DEFAULT '1', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=13107; Olha estamos quase finalizando tudo, só precisamos terminar a parte de web.
O meu GuildShop eu copiei meu shopsystem.php e fiz umas modificações, simples você pode fazer o mesmo é menos trabalhoso.
Copie o shopsystem.php renomeie para shopguild.php, após abra-o e modifique como manda a seguir:
shop_system para shopguild_system
premium_points para guild_points
premium points para guild points
z_shop_offer para z_shopguild_offer
shopsystem para shopguild
z_shop_history_pacc para z_shopguild_history_pacc
z_shop_history_item para z_shopguild_history_item
z_ots_comunication para z_ots_guildcomunication
Ou utilize este já pronto:
shopguild.php
O shopguildadmin.php está no link abaixo, basta fazer o mesmo procedimento:
shopguildadmin.php
Em index.php add:
case "shopguild"; $topic = "Shop Guild"; $subtopic = "shopguild"; include("shopguild.php"); break; case "shopguildadmin"; $topic = "ShopGuild Admin"; $subtopic = "shopguildadmin"; include("shopguildadmin.php"); break; Vá em config.php adicione:
$config['site']['shopguild_system'] = 1; $config['site']['access_adminguild_panel'] = 9; Vá em layouts.php adicione abaixo de buypoints:
<a href='?subtopic=shopguild'> <div id='submenu_shopguild' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)'onMouseOut='MouseOutSubmenuItem(this)'> <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div> <div id='ActiveSubmenuItemIcon_shopguild' class='ActiveSubmenuItemIcon'style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div> <div class='SubmenuitemLabel'>Shop Guild</div> <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div> </div> </a> Em layouts.php add depois do shopadmin:
if($group_id_of_acc_logged >= $config['site']['access_adminguild_panel']) echo "<a href='?subtopic=shopadmin'> <div id='submenu_shopguildadmin' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)'onMouseOut='MouseOutSubmenuItem(this)'> <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div> <div id='ActiveSubmenuItemIcon_shopguildadmin' class='ActiveSubmenuItemIcon'style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div> <div class='SubmenuitemLabel'><font color=red>! ShopGuild Admin !</font></div> <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div> </div> </a>"; Em shopsystem.php procure por:
elseif($action == 'show_history') { if(!$logged) { $main_content .= 'Please login first.'; } else{ $items_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_item').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';'); if(is_object($items_history_received)) { foreach($items_history_received as $item_received) { if($account_logged->getId() == $item_received['to_account']) $char_color = 'green'; else $char_color = 'red'; $items_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$item_received['to_name'].'</font></td><td>'; if($account_logged->getId() == $item_received['from_account']) $items_received_text .= '<i>Your account</i>'; else $items_received_text .= $item_received['from_nick']; $items_received_text .= '</td><td>'.$item_received['offer_id'].'</td><td>'.$item_received['price'].' Points</td><td>'.date("j F Y, H:i:s", $item_received['trans_start']).'</td>'; if($item_received['trans_real'] > 0) $items_received_text .= '<td>'.date("j F Y, H:i:s",$item_received['trans_real']).'</td>'; else $items_received_text .= '<td><b><font color="red">Not realized yet.</font></b></td>'; $items_received_text .= '</tr>'; } } $paccs_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_pacc').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';'); if(is_object($paccs_history_received)) { foreach($paccs_history_received as $pacc_received) { if($account_logged->getId() == $pacc_received['to_account']) $char_color = 'green'; else $char_color = 'red'; $paccs_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$pacc_received['to_name'].'</font></td><td>'; if($account_logged->getId() == $pacc_received['from_account']) $paccs_received_text .= '<i>Your account</i>'; else $paccs_received_text .= $pacc_received['from_nick']; $paccs_received_text .= '</td><td>'.$pacc_received['pacc_days'].' days</td><td>'.$pacc_received['price'].' Points</td><td>'.date("j F Y, H:i:s", $pacc_received['trans_real']).'</td></tr>'; } } $main_content .= '<center><h1>Transactions History</h1></center>'; if(!empty($items_received_text)) $main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="6"><font color="white" size="4"><b> Item Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Offer name</b></td><td><b>Cost</b></td><td><b>Bought on page</b></td><td><b>Received on '.$config['server']['serverName'].'</b></td></tr>'.$items_received_text.'</table><br />'; if(!empty($paccs_received_text)) $main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="5"><font color="white" size="4"><b> Pacc Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Duration</b></td><td><b>Cost</b></td><td><b>Added:</b></td></tr>'.$paccs_received_text.'</table><br />'; if(empty($paccs_received_text) && empty($items_received_text)) $main_content .= 'You did not buy/receive any items or PACC.'; } } Troque por:
elseif($action == 'show_history') { if(!$logged) { $main_content .= 'Please login first.'; } else{ $items_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_item').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';'); if(is_object($items_history_received)) { foreach($items_history_received as $item_received) { if($account_logged->getId() == $item_received['to_account']) $char_color = 'green'; else $char_color = 'red'; $items_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$item_received['to_name'].'</font></td><td>'; if($account_logged->getId() == $item_received['from_account']) $items_received_text .= '<i>Your account</i>'; else $items_received_text .= $item_received['from_nick']; $items_received_text .= '</td><td>'.$item_received['offer_id'].'</td><td>'.$item_received['price'].' Points</td><td>'.date("j F Y, H:i:s", $item_received['trans_start']).'</td>'; if($item_received['trans_real'] > 0) $items_received_text .= '<td>'.date("j F Y, H:i:s",$item_received['trans_real']).'</td>'; else $items_received_text .= '<td><b><font color="red">Not realized yet.</font></b></td>'; $items_received_text .= '</tr>'; } } $itemsguild_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shopguild_history_item').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';'); if(is_object($itemsguild_history_received)) { foreach($itemsguild_history_received as $itemguild_received) { if($account_logged->getId() == $itemguild_received['to_account']) $char_color = 'green'; else $char_color = 'red'; $itemsguild_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$itemguild_received['to_name'].'</font></td><td>'; if($account_logged->getId() == $itemguild_received['from_account']) $itemsguild_received_text .= '<i>Your account</i>'; else $itemsguild_received_text .= $itemguild_received['from_nick']; $itemsguild_received_text .= '</td><td>'.$itemguild_received['offer_id'].'</td><td>'.$itemguild_received['price'].' Points</td><td>'.date("j F Y, H:i:s", $itemguild_received['trans_start']).'</td>'; if($itemguild_received['trans_real'] > 0) $itemsguild_received_text .= '<td>'.date("j F Y, H:i:s",$itemguild_received['trans_real']).'</td>'; else $itemsguild_received_text .= '<td><b><font color="red">Not realized yet.</font></b></td>'; $itemsguild_received_text .= '</tr>'; } } $paccs_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_pacc').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';'); if(is_object($paccs_history_received)) { foreach($paccs_history_received as $pacc_received) { if($account_logged->getId() == $pacc_received['to_account']) $char_color = 'green'; else $char_color = 'red'; $paccs_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$pacc_received['to_name'].'</font></td><td>'; if($account_logged->getId() == $pacc_received['from_account']) $paccs_received_text .= '<i>Your account</i>'; else $paccs_received_text .= $pacc_received['from_nick']; $paccs_received_text .= '</td><td>'.$pacc_received['pacc_days'].' days</td><td>'.$pacc_received['price'].' Points</td><td>'.date("j F Y, H:i:s", $pacc_received['trans_real']).'</td></tr>'; } } $paccsguild_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shopguild_history_pacc').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';'); if(is_object($paccsguild_history_received)) { foreach($paccsguild_history_received as $paccguild_received) { if($account_logged->getId() == $paccguild_received['to_account']) $char_color = 'green'; else $char_color = 'red'; $paccsguild_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$paccguild_received['to_name'].'</font></td><td>'; if($account_logged->getId() == $paccguild_received['from_account']) $paccsguild_received_text .= '<i>Your account</i>'; else $paccsguild_received_text .= $paccguild_received['from_nick']; $paccsguild_received_text .= '</td><td>'.$paccguild_received['pacc_days'].' days</td><td>'.$paccguild_received['price'].' Points</td><td>'.date("j F Y, H:i:s", $paccguild_received['trans_real']).'</td></tr>'; } } $main_content .= '<center><h1>Transactions History</h1></center>'; if(!empty($items_received_text)) $main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="6"><font color="white" size="4"><b> ShopServer Item Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Offer name</b></td><td><b>Cost</b></td><td><b>Bought on page</b></td><td><b>Received on '.$config['server']['serverName'].'</b></td></tr>'.$items_received_text.'</table><br />'; if(!empty($itemsguild_received_text)) $main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="6"><font color="white" size="4"><b> ShopGuild Item Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Offer name</b></td><td><b>Cost</b></td><td><b>Bought on page</b></td><td><b>Received on '.$config['server']['serverName'].'</b></td></tr>'.$itemsguild_received_text.'</table><br />'; if(!empty($paccs_received_text)) $main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="5"><font color="white" size="4"><b> ShopServer VIP Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Duration</b></td><td><b>Cost</b></td><td><b>Added:</b></td></tr>'.$paccs_received_text.'</table><br />'; if(!empty($paccsguild_received_text)) $main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="5"><font color="white" size="4"><b> ShopGuild VIP Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Duration</b></td><td><b>Cost</b></td><td><b>Added:</b></td></tr>'.$paccsguild_received_text.'</table><br />'; if(empty($paccs_received_text) && empty($items_received_text)) $main_content .= 'You did not buy/receive any items or PACC.'; if(empty($paccsguild_received_text) && empty($itemsguild_received_text)) $main_content .= 'You did not buy/receive any items or PACC.'; } } Finalmente terminamos!
Bom todo esse processo é feito só para facilitar tudo pra você e o player e pra diferenciar o Shop System do Shop Guild, porque um sustenta as despesas do server e o outro atrai player, porque pra conseguir player é preciso ter player.
Galera acredito que não esteja faltando nada, espero que gostem e tudo que eu poder fazer para nossas melhoras estarei postando, me desculpem meus erros de português mais o que importa aqui é o script está correto, abraços!
Créditos:
Natanael Beckman
LukeSkywalker (Raphael Luiz) .lua 100%
Não proíbo ninguém de copia o tópico só peço que onde você adicione inclua os créditos mencionados.
-
Por Sekk
Bom, procurei esse Castle por MUITO TEMPO, mas não achei em NENHUM LUGAR DA INTERNET. Ontem, eu estava vendo alguns mapas do @Deathrocks, e vi nos prints, que o mapa possuia o evento que eu queria!
Então baixei o mapa e extrai o evento, então venho lhes trazer!
Nome: Castle 24H
Cliente: 8.6
Versão TFS: 0.4
Tipo: Evento
Bom, para começar, vamos em actions/scripts e crie 2 arquivos:
castledoor1.lua
castlewar1.lua
Agora em actions.xml adicione as tags:
Agora em monster/traps crie 3 arquivos:
porta.xml
protectcastle.xml
statue.xml
Agora em monsters.xml adicione as tags:
Vamos para movements/scripts e crie 2 arquivos:
castlewar2.lua
level.lua
Agora em movements.xml adicione as tags:
Pronto. Agora você só precisa baixar o mapa, inserir o mesmo ao seu servidor, configurar os teleports, e as hunts dentro do castle etc.
PRINTS:
1ª parte
2ª parte:
Obs.: Todos os ActionID e monsters já estão no mapa! Você só precisa configurar as coordenadas dos teleports, e o que possui no castle!
Obs².: Tudo o que você pode configurar, já está escrito em cada script!
Créditos:
@DeathRocks
PC98
mapa.rar
-
Por gpedro
Testado: MySQL & SQLite
Distro: TFS 0.4_SVN & TFS 0.3.6
MySQL
ALTER TABLE `players` ADD `resets` INT(11) NOT NULL DEFAULT "0"; SQLite ALTER TABLE players ADD resets INTEGER not null default 0 Adicionando nas sources player.h procure por: uint32_t level; logo abaixo, adicione: uint32_t resets; iologindata.cpp procure por query << "SELECT `id`, `account_id`, `group_id`, `world_id`, `sex`, `vocation`, `experience`, `level`," substitua por: query << "SELECT `id`, `account_id`, `group_id`, `world_id`, `sex`, `vocation`, `experience`, `level`, `resets`, " procure por player->level = std::max((uint32_t)1, (uint32_t)result->getDataInt("level")); logo abaixo adicione: player->resets = (uint32_t)result->getDataInt("resets"); procure por query << "`maglevel` = " << player->magLevel << ", "; logo abaixo adicione: query << "`resets` = " << player->resets << ", "; players.cpp procure por: s << " (Level " << level << ")"; substitua por: s << " (Level " << level << ") [Reset " << resets << "]"; players.h procure por: void setPromotionLevel(uint32_t pLevel); logo abaixo adicione: uint32_t getResets() { return resets;} void setResets(int32_t amount) { resets += amount; if (resets < 0) {resets = 0;} } luascript.cpp para 0.3.6 static int32_t luaDoPlayerSetIdleTime(lua_State* L); logo abaixo adicione: static int32_t luaGetResets(lua_State* L); static int32_t luaSetResets(lua_State* L); talkactions.xml <talkaction words="!rank;/rank" event="script" value="ranks.lua"/> <talkaction words="!reset;/reset" script="reset.lua"/> ranks.lua
Créditos: Dark Skyllen, Marcryzius, Mock, Kydrai, Cykotitan, gpedro*.
* adaptação para 0.4
-
Posts Recomendados
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.