Ir para conteúdo

Guild Shop System 100% automatico [ModernACC]


BenitZz

Posts Recomendados

Testado:

Versao: 8.60 ate 9.82

 

Painel guildshop admin:

Adiciona items

Remove items

Add e Remove guild points

 

Como funciona?

É um sistema Guild Points, onde há uma Loja EXCLUSIVA para Guilds no Website, [ModernACC] assim Doadores e Guilds tem seu shop separado.

 

Primeiramente faça o Download: GuildShop

 

Depois de baixados coloque a pasta guildshop no:

xampp: c:\xampp\htdocs

Linux: /var/www

 

apos feito isso vamos executar as seguintes querys em sua database:

 


ALTER TABLE `accounts` ADD `guild_points` INT( 11 ) NOT NULL DEFAULT '0';

CREATE TABLE IF NOT EXISTS `guild_donation_history` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `method` varchar(256) NOT NULL,
 `receiver` varchar(256) NOT NULL,
 `buyer` varchar(256) NOT NULL,
 `account` varchar(256) NOT NULL,
 `points` int(11) NOT NULL,
 `date` int(10) NOT NULL,
 PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


CREATE TABLE IF NOT EXISTS `guild_history` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `product` int(11) NOT NULL,
 `session` varchar(256) NOT NULL,
 `player` varchar(256) NOT NULL,
 `date` int(10) NOT NULL,
 `processed` int(11) NOT NULL DEFAULT '0',
 PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=35 ;


CREATE TABLE IF NOT EXISTS `guild_offer` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `points` int(11) NOT NULL DEFAULT '0',
 `category` int(11) NOT NULL DEFAULT '1',
 `type` int(11) NOT NULL DEFAULT '1',
 `item` int(11) NOT NULL DEFAULT '0',
 `count` int(11) NOT NULL DEFAULT '0',
 `description` text NOT NULL,
 `name` varchar(256) NOT NULL,
 PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=81 ;


INSERT INTO `guild_offer` (`id`, `points`, `category`, `type`, `item`, `count`, `description`, `name`) VALUES
(3, 5, 1, 1, 0, 15, '', '15 days of VIP'),
(6, 3, 2, 5, 2160, 100, '', '100 Crystal Coins'),
(7, 2, 2, 5, 8266, 1, 'Protection holy -50%, death +8%.', 'Koshei''s Ancient Amulet'),
(8, 4, 2, 5, 11393, 1, 'Increases loot rate by 0.5% while using.', 'Lucky Clover Amulet'),
(10, 2, 3, 5, 8871, 1, 'Arm:9, magic level +1.<br>It can only be wielded properly by sorcerers and druids.', 'Focus Cape'),
(78, 7, 2, 5, 2366, 1, 'Recupera imediatamente toda sua stamina, pode ser usado uma vez.', 'Sweet Recovery Elixir'),
(79, 5, 2, 5, 9693, 1, 'Addon Doll(Escolha o Addon que você quiser). Digite !addon first(ou second) nomedoaddon.', 'Addon Doll 1x');

 

lembrando execute 1 de cada vez de preferencia para nao ter nenhum bug.

 

logo em seguida vamos criar a page do shop no modernacc entra com sua conta de admin no site entre e administration [Painel Admin] vai em pages e clique em Create Page depois em Page Name coloque guildshop e clica em Create na proxima page adicione:

 


<?php
include("guildshop/gifts.php");
?>

 

e cliqe em Edit Page para salvar, pronto shop system instalado, agora vamos pra parte para entregar o item automaticamente ao player, basta entrar em seu ot na pasta /data/globalevents/scripts crie um arquivo guildshop.lua e adicionar:

 


function onThink(interval, lastExecution, thinkInterval)

local result = db.getResult("SELECT * FROM guild_history WHERE `processed` = 0;")

if(result:getID() ~= -1) then
while(true) do
cid = getCreatureByName(tostring(result:getDataString("player")))
product = tonumber(result:getDataInt("product"))
itemr = db.getResult("SELECT * FROM guild_offer WHERE `id` = "..product..";")
if isPlayer(cid) then
local id = tonumber(itemr:getDataInt("item"))
local tid = tonumber(result:getDataInt("id"))
local count = tonumber(itemr:getDataInt("count"))
local tipe = tonumber(itemr:getDataInt("type"))
local productn = tostring(itemr:getDataString("name"))
if isInArray({5,8},tipe) then
if getPlayerFreeCap(cid) >= getItemWeightById(id, count) then
if isContainer(getPlayerSlotItem(cid, 3).uid) then
received = doAddContainerItem(getPlayerSlotItem(cid, 3).uid, id,count)
if received then
doItemSetAttribute(received, "description", 'Bought by ' .. getCreatureName(cid) .. ' [iD:' .. id .. '].')
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have received >> "..productn.." << from our guild shop system")
db.executeQuery("UPDATE `guild_history` SET `processed`='1' WHERE id = " .. tid .. ";")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, you don't have enough space on container to receive >> "..productn.." <<")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, you don't have a container to receive >> "..productn.." <<")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, you don't have enough capacity to receive >> "..productn.." << (You need: "..getItemWeightById(id, count).." Capacity)")
end
elseif isInArray({6,7},tipe) then
if tipe == 6 then
bcap = 8
bid = 1987
elseif tipe == 7 then
bcap = 20
bid = 1988
end
if isItemRune(id) then
count = 1
end
if getPlayerFreeCap(cid) >= (getItemWeightById(1987, 1) + getItemWeightById(id,count * bcap)) then
local bag = doCreateItemEx(bid, 1)
for i = 1,bcap do
doAddContainerItem(bag, id, count)
end
received = doPlayerAddItemEx(getPlayerSlotItem(cid, 3).uid, bag)
if received == RETURNVALUE_NOERROR then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have received >> "..productn.." << from our guild shop system")
db.executeQuery("UPDATE `guild_history` SET `processed`='1' WHERE id = " .. tid .. ";")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, you don't have enough space to receive >> "..productn.." <<")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, you don't have enough capacity to receive >> "..productn.." << (You need: "..getItemWeightById(id, count).." Capacity)")
end
end
end
itemr:free()
if not(result:next()) then
break
end
end
result:free()
end
return true
end

 

em seguida entre em globalevents.xml e adicione a linha:

 

<globalevent name="guildshop" interval="15000" event="script" value="guildshop.lua"/>

 

e logo em seguida vamo por o talkactions para as guild pegarem seus guild points, entre em /data/talkactions/scripts e crie uma arquivo com nome guildpoints.lua e adicione:

 


local playersNeeded = 8
local ipsNeeded = 6
local minimumLevel = 50
local storageId = 41578
local pointsForPlayer = 20

local function sendPlayersList(cid, list)
for i, pid in ipairs(list) do
local level = getPlayerLevel(pid) < minimumLevel and " - " .. getPlayerLevel(cid) .. " level " or ""
local valid = getCreatureStorage(pid, storageId) > 1 and " - already received!" or ""
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(pid) .. level)
end
end

function onSay(cid, words, param, channel)
if(getPlayerGuildLevel(cid) == 3) then
local leaderGuild = getPlayerGuildId(cid)
local players = getPlayersOnline()
local guildMembersValid = {}
local guildMembersInvalid = {}
for i, pid in ipairs(players) do
if(leaderGuild == getPlayerGuildId(pid)) then
if(getPlayerLevel(pid) >= minimumLevel and tonumber(getCreatureStorage(pid, storageId)) < 2) then
table.insert(guildMembersValid, pid)
else
table.insert(guildMembersInvalid, pid)
end
end
end

if(#guildMembersValid >= playersNeeded) then
local IPs = {}
for i, pid in ipairs(guildMembersValid) do
local ip = getPlayerIp(pid)
if(IPs[ip] == nil) then
IPs[ip] = ip
end
end
if(#IPs >= ipsNeeded) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Players that received points:")
sendPlayersList(cid, guildMembersValid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Players that did not receive points:")
sendPlayersList(cid, guildMembersInvalid)
local accounts = {}
for i, pid in ipairs(guildMembersValid) do
table.insert(accounts, getPlayerAccountId(pid))
doCreatureSetStorage(pid, storageId, os.time())
end
db.executeQuery("UPDATE `accounts` SET `guild_points` = `guild_points`+" .. pointsForPlayer .. " WHERE `id` IN (" .. table.concat(accounts, ',') .. ");")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, #guildMembersValid .. " players from your guild are valid (" .. playersNeeded .. " required), but you have together only " .. #IPs .. " IPs (" .. ipsNeeded .. " required)")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Valid players:")
sendPlayersList(cid, guildMembersValid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid players:")
sendPlayersList(cid, guildMembersInvalid)
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, #guildMembersValid .. " players from your guild are valid, " .. playersNeeded .. " required. Minimum level required is " .. minimumLevel)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Valid players:")
sendPlayersList(cid, guildMembersValid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid players:")
sendPlayersList(cid, guildMembersInvalid)
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Only guild leader can request points.")
end
return true
end

 

depois em talkactions.xml adicione a linha:

 

<talkaction log="yes" words="!guildpoints" script="guildpoints.lua" />

 

e pronto fim do tutorial qualquer duvida so perguntar e nao esqueça de agradecerem

 

Creditos:

A mim: Por ter quebrado a cabeça pra editar o shop para postar aqui

HastlerHost: Pelo Talkactions

Editado por BenitZz
Link para o comentário
Compartilhar em outros sites

Perfeito! onjogos inovando sempre, inclusive disponibilizando download gratuito.

parabens!

 

Obrigado tamo nessa tamo junto.

 

@up

 

Adicionado Painel Guild Shop agora remove e adiciona items, adiciona e remove gild points.

Link para o comentário
Compartilhar em outros sites

  • 3 weeks later...
logo em seguida vamos criar a page do shop no modernacc entra com sua conta de admin no site entre e administration [Painel Admin] vai em pages e clique em Create Page depois em Page Name coloque guildshop e clica em Create na proxima page adicione:

 

onde eu acho essa create page? não achei por nada.... ja cliquei na painel admin ( ADIMIN PAINEL ) só tem o trem de dar reload em spells e monster e criar novo latest news , oq eu faço?

Link para o comentário
Compartilhar em outros sites

  • 1 year later...
  • 11 months later...
×
×
  • Criar Novo...