Ir para conteúdo
  • Cadastre-se

[GESIOR] Task Shop TFS 1.0


Posts Recomendados

Olá, venho trazer para vocês um sistema de Task que vi em um servidor e nunca tinha encontrado em nenhum lugar antes e achei bem interessante. 

Como funciona? Você completa a task, ganha direito matar o boss/exp/itens 'editavel' e ganha pontos para usar no Shopping do servidor. 

 

25655.jpg

 

Bom, vamos ao sistema:

 

Em data/globalevents/scripts crie um arquivo chamado shoptask.lua e adicione o code a seguir:

-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 18
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
function onThink(interval, lastExecution)
  local result_plr = db.storeQuery("SELECT * FROM z_ots_shoptaskcomunication")
  if(result_plr ~= false) then
  repeat
  local id = tonumber(result.getDataInt(result_plr, "id"))
  local action = tostring(result.getDataString(result_plr, "action"))
  local delete = tonumber(result.getDataInt(result_plr, "delete_it"))
  local cid = getPlayerByName(tostring(result.getDataString(result_plr, "name")))
  if(cid) then
  local itemtogive_id = tonumber(result.getDataInt(result_plr, "param1"))
  local itemtogive_count = tonumber(result.getDataInt(result_plr, "param2"))
  local container_id = tonumber(result.getDataInt(result_plr, "param3"))
  local container_count = tonumber(result.getDataInt(result_plr, "param4"))
  local add_item_type = tostring(result.getDataString(result_plr, "param5"))
  local add_item_name = tostring(result.getDataString(result_plr, "param6"))
  local received_item = 0
  local full_weight = 0
  if(add_item_type == 'container') then
  container_weight = getItemWeight(container_id, 1)
  if(isItemRune(itemtogive_id)) then
  items_weight = container_count * getItemWeight(itemtogive_id, 1)
  else
  items_weight = container_count * getItemWeight(itemtogive_id, itemtogive_count)
  end
  full_weight = items_weight + container_weight
  else
  full_weight = getItemWeight(itemtogive_id, itemtogive_count)
  if(isItemRune(itemtogive_id)) then
  full_weight = getItemWeight(itemtogive_id, 1)
  else
  full_weight = getItemWeight(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)
  received_item = doPlayerAddItemEx(cid, new_item)
  end
  if(type(received_item) == "number" and received_item == RETURNVALUE_NOERROR) then
  doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')
  db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
  db.query("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
  else
  doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop 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 shop 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
  until not result.next(result_plr)
  result.free(result_plr)
  end
  return true
end

Em data/globalevents/globalevents.xml adicione a seguinte tag:

<globalevent name="Shop" interval="60000" script="shoptask.lua" />

Pronto. A parte do servidor ta safo, vamos adicionar a database os codigos a seguir:

                  ALTER TABLE `accounts` ADD `task_points` INTEGER(11) NOT NULL DEFAULT 0;

                  ALTER TABLE `accounts` ADD `task_points_stats` INT NOT NULL DEFAULT '0';

 CREATE TABLE `z_shoptask_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_shoptask_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_shoptask_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_shoptaskcomunication` (
                        `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;

Pronto, terminamos quase tudo né? Servidor, Database.. Falta Web.

 

Irei deixar a vocês uma php pronto para download, mas se vocês quiserem usar o de vocês basta trocar.

 

shop_system para shoptask_system
premium_points para shoptask_points

premium points para shoptask points
z_shop_offer para z_shoptask_offer
shopsystem para shoptask
z_shop_history_pacc para z_shoptask_history_pacc
z_shop_history_item para z_shoptask_history_item

z_ots_comunication para z_ots_shoptaskcomunication

 

shoptask.php

 

Agora é só adicionar no seu layout.

Vá em layouts.php adicione abaixo de buypoints:

                    <a href='?subtopic=shoptask'>
                                        <div id='submenu_shoptask' 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_shoptask' class='ActiveSubmenuItemIcon'style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
                                                <div class='SubmenuitemLabel'>Shop Task</div>
                                                <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
                                        </div>
                                </a>

 

Bem é isso, é meio similar ao Guild Shop, porém ele usa o sistema de task. Então vamos ao sistema.

 

Vamos em data/creaturescript/creaturescript.xml e adicione as seguintes Tags;

	<event type="modalwindow" name="taskw" script="task_window.lua"/>

	<event type="kill" name="KillingInTheNameOf" script="task.lua"/>

Em seguida vá em scripts e adicione.

 

Crie um task.lua e adicione.

local questCreatures =
{
["troll"] = {questStarted = 65000, questStorage = 65100, creatureStorage = 15000, killsRequired = 100, raceName = "Trolls"},
["frost troll"] = {questStarted = 65000, questStorage = 65100, creatureStorage = 15001, killsRequired = 100, raceName = "Trolls"},
["furious troll"] = {questStarted = 65000, questStorage = 65100, creatureStorage = 15002, killsRequired = 100, raceName = "Trolls"},
["island troll"] = {questStarted = 65000, questStorage = 65100, creatureStorage = 15003, killsRequired = 100, raceName = "Trolls"},
["swamp troll"] = {questStarted = 65000, questStorage = 65100, creatureStorage = 15004, killsRequired = 100, raceName = "Trolls"},
["troll champion"] = {questStarted = 65000, questStorage = 65100, creatureStorage = 15005, killsRequired = 100, raceName = "Trolls"},
["troll legionnaire"] = {questStarted = 65000, questStorage = 65100, creatureStorage = 15006, killsRequired = 100, raceName = "Trolls"},
["goblin"] = {questStarted = 65001, questStorage = 65101, creatureStorage = 15007, killsRequired = 5, raceName = "Goblins"},
["goblin assassin"] = {questStarted = 65001, questStorage = 65101, creatureStorage = 15008, killsRequired = 5, raceName = "Goblins"},
["goblin leader"] = {questStarted = 65001, questStorage = 65101, creatureStorage = 15009, killsRequired = 5, raceName = "Goblins"},
["goblin scavenger"] = {questStarted = 65001, questStorage = 65101, creatureStorage = 15010, killsRequired = 5, raceName = "Goblins"},
["rotworm"] = {questStarted = 65002, questStorage = 65102, creatureStorage = 15011, killsRequired = 300, raceName = "Rotworms"},
["carriom worm"] = {questStarted = 65002, questStorage = 65102, creatureStorage = 15012, killsRequired = 300, raceName = "Rotworms"},
["cyclops"] = {questStarted = 65003, questStorage = 65103, creatureStorage = 15013, killsRequired = 500, raceName = "Cyclops"},
["cyclops smith"] = {questStarted = 65003, questStorage = 65103, creatureStorage = 15014, killsRequired = 500, raceName = "Cyclops"},
["cyclops drone"] = {questStarted = 65003, questStorage = 65103, creatureStorage = 15015, killsRequired = 500, raceName = "Cyclops"},
["crocodile"] = {questStarted = 14007, questStorage = 14107, creatureStorage = 15016, killsRequired = 300, raceName = "Crocodiles"},
["tarantula"] = {questStarted = 14008, questStorage = 14108, creatureStorage = 15017, killsRequired = 300, raceName = "Tarantulas"},
["carniphila"] = {questStarted = 14009, questStorage = 14109, creatureStorage = 15018, killsRequired = 150, raceName = "Carniphilas"},
["stone golem"] = {questStarted = 14010, questStorage = 14110, creatureStorage = 15019, killsRequired = 200, raceName = "Stone Golems"},
["mammoth"] = {questStarted = 14011, questStorage = 14111, creatureStorage = 15020, killsRequired = 300, raceName = "Mammoths"},
["ice golem"] = {questStarted = 14012, questStorage = 14112, creatureStorage = 15021, killsRequired = 300, raceName = "Ice Golems"},
["quara predator scout"] = {questStarted = 14013, questStorage = 14113, creatureStorage = 15022, killsRequired = 300, raceName = "Quaras Scout"},
["quara constrictor scout"] = {questStarted = 14013, questStorage = 14113, creatureStorage = 15023, killsRequired = 300, raceName = "Quaras Scout"},
["quara hydromancer scout"] = {questStarted = 14013, questStorage = 14113, creatureStorage = 15024, killsRequired = 300, raceName = "Quaras Scout"},
["quara mantassin scout"] = {questStarted = 14013, questStorage = 14113, creatureStorage = 15025, killsRequired = 300, raceName = "Quaras Scout"},
["quara pincher scout"] = {questStarted = 14013, questStorage = 14113, creatureStorage = 15026, killsRequired = 300, raceName = "Quaras Scout"},
["quara predator"] = {questStarted = 14014, questStorage = 14114, creatureStorage = 15027, killsRequired = 300, raceName = "Quaras"},
["quara constrictor"] = {questStarted = 14014, questStorage = 14114, creatureStorage = 15028, killsRequired = 300, raceName = "Quaras"},
["quara hydromancer"] = {questStarted = 14014, questStorage = 14114, creatureStorage = 15029, killsRequired = 300, raceName = "Quaras"},
["quara mantassin"] = {questStarted = 14014, questStorage = 14114, creatureStorage = 15030, killsRequired = 300, raceName = "Quaras"},
["quara pincher"] = {questStarted = 14014, questStorage = 14114, creatureStorage = 15031, killsRequired = 300, raceName = "Quaras"},
["water elemental"] = {questStarted = 14015, questStorage = 14115, creatureStorage = 15032, killsRequired = 70, raceName = "Water Elementals"},
["roaring water elemental"] = {questStarted = 14015, questStorage = 14115, creatureStorage = 15033, killsRequired = 70, raceName = "Water Elementals"},
["slick water elemental"] = {questStarted = 14015, questStorage = 14115, creatureStorage = 15034, killsRequired = 70, raceName = "Water Elementals"},
["massive water elemental"] = {questStarted = 14015, questStorage = 14115, creatureStorage = 15035, killsRequired = 70, raceName = "Water Elementals"},
["earth elemental"] = {questStarted = 14016, questStorage = 14116, creatureStorage = 15036, killsRequired = 70, raceName = "Earth Elementals"},
["jagged earth elemental"] = {questStarted = 14016, questStorage = 14116, creatureStorage = 15037, killsRequired = 70, raceName = "Earth Elementals"},
["massive earth elemental"] = {questStarted = 14016, questStorage = 14116, creatureStorage = 15038, killsRequired = 70, raceName = "Earth Elementals"},
["muddy earth elemental"] = {questStarted = 14016, questStorage = 14116, creatureStorage = 15039, killsRequired = 70, raceName = "Earth Elementals"},
["energy elemental"] = {questStarted = 14017, questStorage = 14117, creatureStorage = 15040, killsRequired = 70, raceName = "Energy Elementals"},
["charged energy elemental"] = {questStarted = 14017, questStorage = 14117, creatureStorage = 15041, killsRequired = 70, raceName = "Energy Elementals"},
["massive energy elemental"] = {questStarted = 14017, questStorage = 14117, creatureStorage = 15042, killsRequired = 70, raceName = "Energy Elementals"},
["overcharged energy elemental"] = {questStarted = 14017, questStorage = 14117, creatureStorage = 15043, killsRequired = 70, raceName = "Energy Elementals"},
["fire elemental"] = {questStarted = 14018, questStorage = 14118, creatureStorage = 15044, killsRequired = 70, raceName = "Fire Elementals"},
["blazing fire elemental"] = {questStarted = 14018, questStorage = 14118, creatureStorage = 15045, killsRequired = 70, raceName = "Fire Elementals"},
["blistering fire elemental"] = {questStarted = 14018, questStorage = 14118, creatureStorage = 15046, killsRequired = 70, raceName = "Fire Elementals"},
["massive fire elemental"] = {questStarted = 14018, questStorage = 14118, creatureStorage = 15047, killsRequired = 70, raceName = "Fire Elementals"},
["mutated rat"] = {questStarted = 14019, questStorage = 14119, creatureStorage = 15048, killsRequired = 200, raceName = "Mutated Rats"},
["giant spider"] = {questStarted = 14020, questStorage = 14120, creatureStorage = 15049, killsRequired = 500, raceName = "Giant Spiders"},
["hydra"] = {questStarted = 14021, questStorage = 14121, creatureStorage = 15050, killsRequired = 500, raceName = "Hydras"},
["sea serpent"] = {questStarted = 14001, questStorage = 14101, creatureStorage = 15051, killsRequired = 500, raceName = "Sea Serpents"},
["behemoth"] = {questStarted = 14022, questStorage = 14122, creatureStorage = 15052, killsRequired = 500, raceName = "Behemoths"},
["serpent spawn"] = {questStarted = 14002, questStorage = 14102, creatureStorage = 15053, killsRequired = 375, raceName = "Serpents Spawn"},
["green djinn"] = {questStarted = 65022, questStorage = 65122, creatureStorage = 15054, killsRequired = 125, raceName = "Green Djinns"},
["efreet"] = {questStarted = 65022, questStorage = 65122, creatureStorage = 15055, killsRequired = 125, raceName = "Green Djinns"},
["blue djinn"] = {questStarted = 65023, questStorage = 65123, creatureStorage = 15056, killsRequired = 125, raceName = "Blue Djinns"},
["marid"] = {questStarted = 65023, questStorage = 65123, creatureStorage = 15057, killsRequired = 125, raceName = "Blue Djinns"},
["pirate buccaneer"] = {questStarted = 65024, questStorage = 65124, creatureStorage = 15058, killsRequired = 300, raceName = "Pirates"},
["pirate corsair"] = {questStarted = 65024, questStorage = 65124, creatureStorage = 15059, killsRequired = 300, raceName = "Pirates"},
["pirate cutthroat"] = {questStarted = 65024, questStorage = 65124, creatureStorage = 15060, killsRequired = 300, raceName = "Pirates"},
["pirate ghost"] = {questStarted = 65024, questStorage = 65124, creatureStorage = 15061, killsRequired = 300, raceName = "Pirates"},
["pirate marauder"] = {questStarted = 65024, questStorage = 65124, creatureStorage = 15062, killsRequired = 300, raceName = "Pirates"},
["pirate skeleton"] = {questStarted = 65024, questStorage = 65124, creatureStorage = 15063, killsRequired = 300, raceName = "Pirates"},
["minotaur"] = {questStarted = 14004, questStorage = 14104, creatureStorage = 15070, killsRequired = 500, raceName = "Minotaurs"},
["necromancer"] = {questStarted = 14003, questStorage = 14103, creatureStorage = 15071, killsRequired = 1000, raceName = "Magicians"},
["priestess"] = {questStarted = 14003, questStorage = 14103, creatureStorage = 15072, killsRequired = 1000, raceName = "Magicians"},
["dragon"] = {questStarted = 65030, questStorage = 65130, creatureStorage = 15065, killsRequired = 500, raceName = "Dragons"},
["dragon lord"] = {questStarted = 65030, questStorage = 65130, creatureStorage = 15066, killsRequired = 500, raceName = "Dragons"},
["frost dragon"] = {questStarted = 65030, questStorage = 65130, creatureStorage = 15067, killsRequired = 500, raceName = "Dragons"},
["ghastly dragon"] = {questStarted = 65030, questStorage = 65130, creatureStorage = 15068, killsRequired = 500, raceName = "Dragons"},
["undead dragon"] = {questStarted = 65030, questStorage = 65130, creatureStorage = 15069, killsRequired = 500, raceName = "Dragons"},
["demon"] = {questStarted = 14023, questStorage = 14123, creatureStorage = 15075, killsRequired = 6666, raceName = "Demons"}
}
local msgType = MESSAGE_STATUS_CONSOLE_ORANGE
function onKill(cid, target, lastHit)
local creature = questCreatures[getCreatureName(target):lower()]
if creature then
if isPlayer(target) then return true end
if getCreatureStorage(cid, creature.questStarted) > 0 then
if getCreatureStorage(cid, creature.questStorage) < creature.killsRequired then
if getCreatureStorage(cid, creature.questStorage) < 0 then
doCreatureSetStorage(cid, creature.questStorage, 0)
end
if (not isSummon(target)) then
if getCreatureStorage(cid, creature.creatureStorage) < 0 then
doCreatureSetStorage(cid, creature.creatureStorage, 0)
end
doCreatureSetStorage(cid, creature.questStorage, getCreatureStorage(cid, creature.questStorage) + 1)
doCreatureSetStorage(cid, creature.creatureStorage, getCreatureStorage(cid, creature.creatureStorage) + 1)
doPlayerSendTextMessage(cid, msgType, "[Mission]: " .. getCreatureStorage(cid,creature.questStorage) .. "/" .. creature.killsRequired .. " " .. creature.raceName .. " defeated.")
end
end
end
end
return true
end

depois task_window e adicione;

function onModalWindow(cid, modalWindowId, buttonId, choiceId)
	if modalWindowId ~= 1900 then
		return false
	end
	
	local rank = getCreatureStorage(cid, rankStorage)
	if rank < 0 then
		doCreatureSetStorage(cid, rankStorage, 0)
	end
					
	local r_string = function() if tasks[choiceId].repeatable then return "repeatable" end return "not repeatable" end
	local r_article_string = function (id, amount)
		task_item_word = ""
		if amount > 1 then
			task_item_word = task_item_word .. amount .. "x " .. getItemName(id)
		else
			if ItemType(itemId):getArticle() == "" then
				task_item_word = task_item_word .. getItemName(id)
			else
				task_item_word = task_item_word .. ItemType(itemId):getArticle() .. " " .. getItemName(id)
			end
		end
	return task_item_word
	end
	local storage_string = {[80000] = "The Snapper",
[80001] = "Demodras",
[80002] = "The Hide",
[80003] = "The Bloodtusk",
[80004] = "The Shardhead",
[80005] = "Thul",
[80006] = "Esmeralda",
[80007] = "The Old Widow",
[80008] = "The Many",
[80009] = "The Leviathan",
[80010] = "The Stonecracker",
[80011] = "The Noxious Spawn",
[80012] = "Merikh The Slaughterer",
[80013] = "Fahim The Wise",
[80014] = "pirate leader",
[80015] = "The Horned Fox",
[80016] = "Necropharus"
	}

	if buttonId == 1 then -- confirm task
		if getCreatureStorage(cid, tasks[choiceId].questStarted) < 1 then
			doCreatureSetStorage(cid, tasks[choiceId].questStarted, 1)
			doCreatureSetStorage(cid, tasks[choiceId].questStorage, 0)
			doCreatureSay(taskNPCuid, "In this mission you have to hunt " .. tasks[choiceId].killsRequired .. " " .. tasks[choiceId].raceName .. " down. Good luck!", TALKTYPE_PRIVATE_NP, false, cid, getThingPos(taskNPCuid))
		else
			if getCreatureStorage(cid, tasks[choiceId].questStarted) == 1 then
				if tasks[choiceId].killsRequired > getCreatureStorage(cid, tasks[choiceId].questStorage) then
					doPlayerPopupFYI(cid,"Status: Active\nKills: " .. getCreatureStorage(cid, tasks[choiceId].questStorage) .. "/" .. tasks[choiceId].killsRequired .. " (" .. tasks[choiceId].killsRequired - getCreatureStorage(cid, tasks[choiceId].questStorage) .. " left)\n\nThis mission is " .. r_string() .. ".")
					sendTaskWindow(cid)
				else
					doCreatureSetStorage(cid, tasks[choiceId].questStarted, 2)
					task_reward_str = "Reward(s):\n"
					for i = 1, table.maxn(tasks[choiceId].rewards) do
						if(tasks[choiceId].rewards[i].enable) then
							if isInArray({"boss", "teleport", 1}, tasks[choiceId].rewards[i].type) then
								doTeleportThing(cid, tasks[choiceId].rewards[i].values)
								task_reward_str = task_reward_str .. "You have been teleported.\n"
							elseif isInArray({"exp", "experience", 2}, tasks[choiceId].rewards[i].type) then
								doPlayerAddExperience(cid, tasks[choiceId].rewards[i].values)
								task_reward_str = task_reward_str .. "+ " .. tasks[choiceId].rewards[i].values .. " exp\n"
							elseif isInArray({"item", 3}, tasks[choiceId].rewards[i].type) then
								doPlayerAddItem(cid, tasks[choiceId].rewards[i].values[1], tasks[choiceId].rewards[i].values[2])
								task_reward_str = task_reward_str .. r_article_string(tasks[choiceId].rewards[i].values[1], tasks[choiceId].rewards[i].values[2]) .. "\n"
							elseif isInArray({"money", 4}, tasks[choiceId].rewards[i].type) then
								doPlayerAddMoney(cid, tasks[choiceId].rewards[i].values)
								task_reward_str = task_reward_str .. "+ " .. tasks[choiceId].rewards[i].values .. " gp\n"
							elseif isInArray({"storage", "stor", 5}, tasks[choiceId].rewards[i].type) then
								doCreatureSetStorage(cid, tasks[choiceId].rewards[i].values[1], tasks[choiceId].rewards[i].values[2])
								task_reward_str = task_reward_str .. "Chance to duel " .. storage_string[tasks[choiceId].rewards[i].values[1]] .. ".\n"
							elseif isInArray({"points", "rank", 2}, tasks[choiceId].rewards[i].type) then
							db.query("UPDATE `accounts` SET `task_points` = `task_points` + " .. tasks[choiceId].rewards[i].values .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
								doCreatureSetStorage(cid, rankStorage, getCreatureStorage(cid, rankStorage) + tasks[choiceId].rewards[i].values)
								task_reward_str = task_reward_str .. "+ " .. tasks[choiceId].rewards[i].values .. " rank points.\n"
							else
								print("[Warning - Npc::KillingInTheNameOf] Wrong reward type: " .. (tasks[choiceId].rewards[i].type or "nil") .. ", reward could not be loaded.")
							end
						end
					end
					if task_reward_str == "Reward(s):\n" then
						doPlayerPopupFYI(cid,task_reward_str .. "none")
					else
						doPlayerPopupFYI(cid,task_reward_str)
					end
					doCreatureSay(taskNPCuid, "Great job" .. (((rank > 4 and rank < 10) and (", Huntsman") or (rank > 9 and rank < 20) and (", Ranger") or (rank > 19 and rank < 30) and (", Big Game Hunter") or (rank > 29 and rank < 50) and (", Trophy Hunter") or (rank > 49) and (", Elite Hunter")) or ", my Beginner") .. "! Here is your reward. Keep hunting and good luck!", TALKTYPE_PRIVATE_NP, false, cid, getThingPos(taskNPCuid))
				end
			else
				if tasks[choiceId].repeatable then
					for i = 1, table.maxn(tasks[choiceId].rewards) do
						if isInArray({"storage", "stor", 5}, tasks[choiceId].rewards[i].type) then
							doPlayerPopupFYI(cid,"To repeat this mission again, fight with " .. storage_string[tasks[choiceId].rewards[i].values[1]] .. " first.")
							break
						end
						if i == table.maxn(tasks[choiceId].rewards) then
							doPlayerPopupFYI(cid,"You can't repeat this mission.")
						end
					end
				else
					doPlayerPopupFYI(cid,"You can't repeat this mission.")
				end
				sendTaskWindow(cid)
			end
		end
	elseif buttonId == 255 then
		doPlayerPopupFYI(cid,"Please use a button.")
		sendTaskWindow(cid)
	end
	
return true
end

Agora vamos até data\lib e crie e adicione;

rankStorage = 32150

THESNAPPER = {80000, 1}
DEMODRAS = {80001, 1}
HIDE = {80002, 1}
THEBLOODTUSK = {80003, 1}
SHARDHEAD = {80004, 1}
THUL = {80005, 1}
ESMERALDA = {80006, 1}
THEOLDWIDOW = {80007, 1}
THEMANY = {80008, 1}
LEVIATHAN = {80009, 1}
STONECRACKER = {80010, 1}
THENOXIUSSPAWN = {80011, 1}
MERIKHTHESLAUGHTERER = {80012, 1}
FAHIMTHEWISE = {80013, 1}
RANDOMPIRATEBOSS = {80014, 1}
THEHORNEDFOX = {80015, 1}
NECROPHARUS = {80016, 1}

tasks =
{
[1] = {questStarted = 65000, questStorage = 65100, killsRequired = 100, raceName = "Trolls", repeatable = false, rewards = {{enable = true, type = "exp", values = 40000}, {enable = true, type = "money", values = 4000}}},
[2] = {questStarted = 65001, questStorage = 65101, killsRequired = 150, raceName = "Goblins", repeatable = false, rewards = {{enable = true, type = "exp", values = 70000}, {enable = true, type = "money", values = 5000}}},
[3] = {questStarted = 65002, questStorage = 65102, killsRequired = 300, raceName = "Rotworms", repeatable = false, rewards = {{enable = true, type = "exp", values = 100000}, {enable = true, type = "money", values = 6000}}},
[4] = {questStarted = 65003, questStorage = 65103, killsRequired = 500, raceName = "Cyclops", repeatable = false, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "money", values = 8000}}},
[5] = {questStarted = 14007, questStorage = 14107, killsRequired = 300, raceName = "Crocodiles", repeatable = true, rewards = {{enable = true, type = "exp", values = 100000}, {enable = true, type = "storage", values = THESNAPPER}, {enable = true, type = "points", values = 2}}},
[6] = {questStarted = 14008, questStorage = 14108, killsRequired = 300, raceName = "Tarantulas", repeatable = true, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "storage", values = HIDE}, {enable = true, type = "points", values = 2}}},
[7] = {questStarted = 14009, questStorage = 14109, killsRequired = 150, raceName = "Carniphilas", repeatable = false, rewards = {{enable = true, type = "exp", values = 250000}, {enable = true, type = "money", values = 15000}}},
[8] = {questStarted = 14010, questStorage = 14110, killsRequired = 200, raceName = "Stone Golems", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 15000}}},
[9] = {questStarted = 14011, questStorage = 14111, killsRequired = 300, raceName = "Mammoths", repeatable = true, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "storage", values = THEBLOODTUSK}, {enable = true, type = "points", values = 2}}},
[10] = {questStarted = 14012, questStorage = 14112, killsRequired = 300, raceName = "Ice Golems", repeatable = true, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "storage", values = SHARDHEAD}, {enable = true, type = "points", values = 2}}},
[11] = {questStarted = 14013, questStorage = 14113, killsRequired = 300, raceName = "Quaras Scout", repeatable = true, rewards = {{enable = true, type = "exp", values = 250000}, {enable = true, type = "money", values = 25000}}},
[12] = {questStarted = 14014, questStorage = 14114, killsRequired = 300, raceName = "Quaras", repeatable = true, rewards = {{enable = true, type = "exp", values = 300000}, {enable = true, type = "storage", values = THUL}, {enable = true, type = "points", values = 2}}},
[13] = {questStarted = 14015, questStorage = 14115, killsRequired = 70, raceName = "Water Elementals", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 20000}}},
[14] = {questStarted = 14016, questStorage = 14116, killsRequired = 70, raceName = "Earth Elementals", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 20000}}},
[15] = {questStarted = 14017, questStorage = 14117, killsRequired = 70, raceName = "Energy Elementals", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 20000}}},
[16] = {questStarted = 14018, questStorage = 14118, killsRequired = 70, raceName = "Fire Elementals", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 20000}}},
[17] = {questStarted = 14019, questStorage = 14119, killsRequired = 200, raceName = "Mutated Rats", repeatable = true, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "storage", values = ESMERALDA}, {enable = true, type = "points", values = 2}}},
[18] = {questStarted = 14020, questStorage = 14120, killsRequired = 500, raceName = "Giant Spiders", repeatable = true, rewards = {{enable = true, type = "exp", values = 250000}, {enable = true, type = "storage", values = THEOLDWIDOW}, {enable = true, type = "points", values = 2}}},
[19] = {questStarted = 14021, questStorage = 14121, killsRequired = 500, raceName = "Hydras", repeatable = true, rewards = {{enable = true, type = "storage", values = THEMANY}, {enable = true, type = "points", values = 4}}},
[20] = {questStarted = 14001, questStorage = 14101, killsRequired = 500, raceName = "Sea Serpents", repeatable = true, rewards = {{enable = true, type = "storage", values = LEVIATHAN}, {enable = true, type = "points", values = 4}}},
[21] = {questStarted = 14022, questStorage = 14122, killsRequired = 500, raceName = "Behemoths", repeatable = true, rewards = {{enable = true, type = "storage", values = STONECRACKER}, {enable = true, type = "points", values = 4}}},
[22] = {questStarted = 14002, questStorage = 14102, killsRequired = 375, raceName = "Serpents Spawn", repeatable = true, rewards = {{enable = true, type = "storage", values = THENOXIOUSSPAWN}, {enable = true, type = "points", values = 4}}},
[23] = {questStarted = 65022, questStorage = 65122, killsRequired = 125, raceName = "Green Djinns", repeatable = true, rewards = {{enable = true, type = "exp", values = 230000}, {enable = true, type = "money", values = 5000}, {enable = true, type = "storage", values = MERIKHTHESLAUGHTERER}}},
[24] = {questStarted = 65023, questStorage = 65123, killsRequired = 125, raceName = "Blue Djinns", repeatable = true, rewards = {{enable = true, type = "exp", values = 230000}, {enable = true, type = "money", values = 5000}, {enable = true, type = "storage", values = FAHIMTHEWISE}}},
[25] = {questStarted = 65024, questStorage = 65124, killsRequired = 300, raceName = "Pirates", repeatable = false, rewards = {{enable = true, type = "exp", values = 300000}, {enable = true, type = "money", values = 40000}, {enable = true, type = "storage", values = RANDOMPIRATEBOSS}}},
[26] = {questStarted = 14004, questStorage = 14104, killsRequired = 500, raceName = "Minotaurs", repeatable = false, rewards = {{enable = true, type = "storage", values = THEHORNEDFOX}}},
[27] = {questStarted = 14003, questStorage = 14103, killsRequired = 1000, raceName = "Magicians", repeatable = false, rewards = {{enable = true, type = "storage", values = NECROPHARUS}}},
[28] = {questStarted = 65030, questStorage = 65130, killsRequired = 500, raceName = "Dragons", repeatable = true, rewards = {{enable = true, type = "storage", values = DEMODRAS}, {enable = true, type = "exp", values = 400000}}},
[29] = {questStarted = 14023, questStorage = 14123, killsRequired = 6666, raceName = "Demons", repeatable = false, rewards = {{enable = true, type = "exp", values = 1000000}, {enable = true, type = "item", values = {10305,1}}}}}

function getTasksStarted(cid)
local tmp = {}
for k, v in pairs(tasks) do
if getCreatureStorage(cid, v.questStarted) == 1 then
table.insert(tmp, k)
end
end
return tmp
end

function getTaskByName(name)
for k, v in pairs(tasks) do
if v.raceName:lower() == name:lower() then
return k
end
end
return false
end

function sendTaskWindow(cid)
taskWindow = ModalWindow(1900, "Mission Management", "Select a task:")
local task_status = {}

if taskWindow:getId() == 1900 then
    taskWindow:addButton(1, "Select")
	taskWindow:setDefaultEnterButton(1)
    taskWindow:addButton(2, "Cancel")
	taskWindow:setDefaultEscapeButton(2)
	for i = 1, #tasks do
		if getCreatureStorage(cid, tasks[i].questStarted) == 2 then
			task_status[i] = "[completed]"
		else
			if getCreatureStorage(cid, tasks[i].questStarted) == 1 then
				task_status[i] = "[" .. getCreatureStorage(cid, tasks[i].questStorage) .. "/" .. tasks[i].killsRequired .. "]"
			else
				if getCreatureStorage(cid, tasks[i].questStarted) < 1 then
					task_status[i] = tasks[i].killsRequired
				else
					task_status[i] = tasks[i].killsRequired .. " [unknown]"
				end
			end
		end
		
		if getCreatureStorage(cid, tasks[i].questStarted) == 1 and getCreatureStorage(cid, tasks[i].questStorage) >= tasks[i].killsRequired then
			taskWindow:addChoice(i, tasks[i].raceName .. " [click for reward]")
		
		else
			taskWindow:addChoice(i, tasks[i].raceName .. ", " .. task_status[i])
		end
	end
end
taskWindow:sendToPlayer(cid)
return true
end

Agora vamos até data\npc crie Victor.xml e adicione

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Victor" script="Victor.lua" walkinterval="2000" floorchange="0">
	<health now="150" max="150" />
	<look type="131" head="76" body="20" legs="116" feet="1" addons="1" />
<parameters>

<parameter key="message_greet" value="Ola, eu posso te ajudar com algumas missões, e como recompensa te darei exp e direito a matar alguns bosses diga {task}"/>

        </parameters>

</npc>

agora vamos até scripts crie Victor.lua e adicione

local choose = {}

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

function creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
if isInArray({"task", "tasks"}, msg:lower()) then
selfSay("Here.", cid)
taskNPCuid = getNpcCid()
if getPlayerStorageValue(cid, 32150) < 0 then setPlayerStorageValue(cid, 32150, 0) end
return sendTaskWindow(cid)
end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

25656.jpg

 

 

 

Caso vocês queiram adicionar a recompensa no próprio sistema de task de vocês basta adicionar na recompensa a seguinte query.

db.query("UPDATE `accounts` SET `task_points` = `task_points` + " .. tasks[choiceId].rewards[i].values .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")

Pronto, terminamos. 

 

 

Créditos: Jobs.

 

Tópico exclusivo para o TK.

Editado por Jobs (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Em nome da comunidade do TK, muito obrigado pela contribuição! :wow:
Seu tópico de conteúdo foi aprovado e será movido para a seção adequada. Você ganhou 1 REP+!

Se quiser sua dúvida tirada, mande PM com os links, e não com a dúvida (outros podem ter a mesma dúvida, e o fórum serve para ser usado).

 

Tópicos:


 

yNlhRVC.png

 

55px-Judo_yellow_belt.svg.png

Link para o post
Compartilhar em outros sites
  • 5 weeks later...

Onde realizo esse passo ?

shop_system para shoptask_system

premium_points para shoptask_points

premium points para shoptask points

z_shop_offer para z_shoptask_offer

shopsystem para shoptask

z_shop_history_pacc para z_shoptask_history_pacc

z_shop_history_item para z_shoptask_history_item

z_ots_comunication para z_ots_shoptaskcomunication

Editado por Nuzzy (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

agr deu esse erro:

 

Error occured!

Error ID: ObjectData::getCustomField - Field task_points does not exist in data / is not loaded.
More info: 

File: C:\xampp\htdocs\classes/objectdata.php   Line: 52
File: C:\xampp\htdocs\pages/shoptask.php   Line: 10
File: C:\xampp\htdocs\system/load.page.php   Line: 7
File: C:\xampp\htdocs/index.php   Line: 38

Link para o post
Compartilhar em outros sites

Onde realizo esse passo ?

shop_system para shoptask_system

premium_points para shoptask_points

premium points para shoptask points

z_shop_offer para z_shoptask_offer

shopsystem para shoptask

z_shop_history_pacc para z_shoptask_history_pacc

z_shop_history_item para z_shoptask_history_item

z_ots_comunication para z_ots_shoptaskcomunication

 

isso é o shop php do seu gesior, no caso eu dexei um pronto, mas se você quiser usar qualquer outro, é só você mudar de acordo com o texto.

por exemplo, aonde está Premium_points você vai por shoptask_points.

quando entro no sie apareçe isso:

 

Shop is currently closed. [to admin: edit it in 'config/config.php']

 

lá em config.php, vai na parte do shop.

 

$config['site']['shop_system'] = 1;

$config['site']['shoptask_system'] = 1;

 

vai ficar tipo assim

è que to sem site aqui, mas não tem erro. è só criar uma copia.

agr deu esse erro:

 

Error occured!

Error ID: ObjectData::getCustomField - Field task_points does not exist in data / is not loaded.

More info: 

File: C:\xampp\htdocs\classes/objectdata.php   Line: 52

File: C:\xampp\htdocs\pages/shoptask.php   Line: 10

File: C:\xampp\htdocs\system/load.page.php   Line: 7

File: C:\xampp\htdocs/index.php   Line: 38

 

vai em classes/account.php e procure essa linha:

public $data = array('name' => null

 

adicione no final desta linha o task_shop

Foi você que criou ? 

 

Parabéns é um belo sistema.

 

Sim, a ideia foi minha, eu apenas modifiquei algumas coisas do Guild_SHOP.

Editado por Jobs (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 6 months later...
  • 3 months later...
Lua Script Error: [Npc interface]
data/npc/scripts/victor.lua:onCreatureSay
data/lib/task_window.lua:82: attempt to call global 'getCreatureStorage' (a nil value)
stack traceback:
        [C]: in function 'getCreatureStorage'
        data/lib/task_window.lua:82: in function 'callback'
        data/npc/lib/npcsystem/npchandler.lua:430: in function 'onCreatureSay'
        data/npc/scripts/victor.lua:10: in function <data/npc/scripts/victor.lua:10

 da esse erro mas eu achei esse para o victor.lua

 

local choose = {}
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)  npcHandler:onCreatureAppear(cid)  end
function onCreatureDisappear(cid)  npcHandler:onCreatureDisappear(cid)  end
function onCreatureSay(cid, type, msg)  npcHandler:onCreatureSay(cid, type, msg)  end
function onThink()  npcHandler:onThink()  end
function creatureSayCallback(cid, type, msg)
    local player = Player(cid)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
    local taskWindow = ModalWindow(1900, "Mission Management", "Select a task:")
    if isInArray({"task", "tasks"}, msg:lower()) then
        selfSay("Here.", cid)
        taskNPCuid = getNpcCid()
        if player:getStorageValue(32150) < 0 then player:setStorageValue(32150, 0) end
        return taskWindow:sendToPlayer(cid)
    end
    return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

ai abre a janela, so que nao aparece nada  só select ou cancel

Link para o post
Compartilhar em outros sites
48 minutos atrás, fabiobillz disse:

Lua Script Error: [Npc interface]
data/npc/scripts/victor.lua:onCreatureSay
data/lib/task_window.lua:82: attempt to call global 'getCreatureStorage' (a nil value)
stack traceback:
        [C]: in function 'getCreatureStorage'
        data/lib/task_window.lua:82: in function 'callback'
        data/npc/lib/npcsystem/npchandler.lua:430: in function 'onCreatureSay'
        data/npc/scripts/victor.lua:10: in function <data/npc/scripts/victor.lua:10

 da esse erro mas eu achei esse para o victor.lua

 


local choose = {}
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)  npcHandler:onCreatureAppear(cid)  end
function onCreatureDisappear(cid)  npcHandler:onCreatureDisappear(cid)  end
function onCreatureSay(cid, type, msg)  npcHandler:onCreatureSay(cid, type, msg)  end
function onThink()  npcHandler:onThink()  end
function creatureSayCallback(cid, type, msg)
    local player = Player(cid)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
    local taskWindow = ModalWindow(1900, "Mission Management", "Select a task:")
    if isInArray({"task", "tasks"}, msg:lower()) then
        selfSay("Here.", cid)
        taskNPCuid = getNpcCid()
        if player:getStorageValue(32150) < 0 then player:setStorageValue(32150, 0) end
        return taskWindow:sendToPlayer(cid)
    end
    return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

ai abre a janela, so que nao aparece nada  só select ou cancel

 

qual a versão do seu tfs?

Link para o post
Compartilhar em outros sites
Em 06/07/2016 at 15:41, fabiobillz disse:

1.2

 

 

Tenta assim

 

rankStorage = 32150

THESNAPPER = {80000, 1}
DEMODRAS = {80001, 1}
HIDE = {80002, 1}
THEBLOODTUSK = {80003, 1}
SHARDHEAD = {80004, 1}
THUL = {80005, 1}
ESMERALDA = {80006, 1}
THEOLDWIDOW = {80007, 1}
THEMANY = {80008, 1}
LEVIATHAN = {80009, 1}
STONECRACKER = {80010, 1}
THENOXIUSSPAWN = {80011, 1}
MERIKHTHESLAUGHTERER = {80012, 1}
FAHIMTHEWISE = {80013, 1}
RANDOMPIRATEBOSS = {80014, 1}
THEHORNEDFOX = {80015, 1}
NECROPHARUS = {80016, 1}

tasks =
{
[1] = {questStarted = 65000, questStorage = 65100, killsRequired = 100, raceName = "Trolls", repeatable = false, rewards = {{enable = true, type = "exp", values = 40000}, {enable = true, type = "money", values = 4000}}},
[2] = {questStarted = 65001, questStorage = 65101, killsRequired = 150, raceName = "Goblins", repeatable = false, rewards = {{enable = true, type = "exp", values = 70000}, {enable = true, type = "money", values = 5000}}},
[3] = {questStarted = 65002, questStorage = 65102, killsRequired = 300, raceName = "Rotworms", repeatable = false, rewards = {{enable = true, type = "exp", values = 100000}, {enable = true, type = "money", values = 6000}}},
[4] = {questStarted = 65003, questStorage = 65103, killsRequired = 500, raceName = "Cyclops", repeatable = false, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "money", values = 8000}}},
[5] = {questStarted = 14007, questStorage = 14107, killsRequired = 300, raceName = "Crocodiles", repeatable = true, rewards = {{enable = true, type = "exp", values = 100000}, {enable = true, type = "storage", values = THESNAPPER}, {enable = true, type = "points", values = 2}}},
[6] = {questStarted = 14008, questStorage = 14108, killsRequired = 300, raceName = "Tarantulas", repeatable = true, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "storage", values = HIDE}, {enable = true, type = "points", values = 2}}},
[7] = {questStarted = 14009, questStorage = 14109, killsRequired = 150, raceName = "Carniphilas", repeatable = false, rewards = {{enable = true, type = "exp", values = 250000}, {enable = true, type = "money", values = 15000}}},
[8] = {questStarted = 14010, questStorage = 14110, killsRequired = 200, raceName = "Stone Golems", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 15000}}},
[9] = {questStarted = 14011, questStorage = 14111, killsRequired = 300, raceName = "Mammoths", repeatable = true, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "storage", values = THEBLOODTUSK}, {enable = true, type = "points", values = 2}}},
[10] = {questStarted = 14012, questStorage = 14112, killsRequired = 300, raceName = "Ice Golems", repeatable = true, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "storage", values = SHARDHEAD}, {enable = true, type = "points", values = 2}}},
[11] = {questStarted = 14013, questStorage = 14113, killsRequired = 300, raceName = "Quaras Scout", repeatable = true, rewards = {{enable = true, type = "exp", values = 250000}, {enable = true, type = "money", values = 25000}}},
[12] = {questStarted = 14014, questStorage = 14114, killsRequired = 300, raceName = "Quaras", repeatable = true, rewards = {{enable = true, type = "exp", values = 300000}, {enable = true, type = "storage", values = THUL}, {enable = true, type = "points", values = 2}}},
[13] = {questStarted = 14015, questStorage = 14115, killsRequired = 70, raceName = "Water Elementals", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 20000}}},
[14] = {questStarted = 14016, questStorage = 14116, killsRequired = 70, raceName = "Earth Elementals", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 20000}}},
[15] = {questStarted = 14017, questStorage = 14117, killsRequired = 70, raceName = "Energy Elementals", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 20000}}},
[16] = {questStarted = 14018, questStorage = 14118, killsRequired = 70, raceName = "Fire Elementals", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 20000}}},
[17] = {questStarted = 14019, questStorage = 14119, killsRequired = 200, raceName = "Mutated Rats", repeatable = true, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "storage", values = ESMERALDA}, {enable = true, type = "points", values = 2}}},
[18] = {questStarted = 14020, questStorage = 14120, killsRequired = 500, raceName = "Giant Spiders", repeatable = true, rewards = {{enable = true, type = "exp", values = 250000}, {enable = true, type = "storage", values = THEOLDWIDOW}, {enable = true, type = "points", values = 2}}},
[19] = {questStarted = 14021, questStorage = 14121, killsRequired = 500, raceName = "Hydras", repeatable = true, rewards = {{enable = true, type = "storage", values = THEMANY}, {enable = true, type = "points", values = 4}}},
[20] = {questStarted = 14001, questStorage = 14101, killsRequired = 500, raceName = "Sea Serpents", repeatable = true, rewards = {{enable = true, type = "storage", values = LEVIATHAN}, {enable = true, type = "points", values = 4}}},
[21] = {questStarted = 14022, questStorage = 14122, killsRequired = 500, raceName = "Behemoths", repeatable = true, rewards = {{enable = true, type = "storage", values = STONECRACKER}, {enable = true, type = "points", values = 4}}},
[22] = {questStarted = 14002, questStorage = 14102, killsRequired = 375, raceName = "Serpents Spawn", repeatable = true, rewards = {{enable = true, type = "storage", values = THENOXIOUSSPAWN}, {enable = true, type = "points", values = 4}}},
[23] = {questStarted = 65022, questStorage = 65122, killsRequired = 125, raceName = "Green Djinns", repeatable = true, rewards = {{enable = true, type = "exp", values = 230000}, {enable = true, type = "money", values = 5000}, {enable = true, type = "storage", values = MERIKHTHESLAUGHTERER}}},
[24] = {questStarted = 65023, questStorage = 65123, killsRequired = 125, raceName = "Blue Djinns", repeatable = true, rewards = {{enable = true, type = "exp", values = 230000}, {enable = true, type = "money", values = 5000}, {enable = true, type = "storage", values = FAHIMTHEWISE}}},
[25] = {questStarted = 65024, questStorage = 65124, killsRequired = 300, raceName = "Pirates", repeatable = false, rewards = {{enable = true, type = "exp", values = 300000}, {enable = true, type = "money", values = 40000}, {enable = true, type = "storage", values = RANDOMPIRATEBOSS}}},
[26] = {questStarted = 14004, questStorage = 14104, killsRequired = 500, raceName = "Minotaurs", repeatable = false, rewards = {{enable = true, type = "storage", values = THEHORNEDFOX}}},
[27] = {questStarted = 14003, questStorage = 14103, killsRequired = 1000, raceName = "Magicians", repeatable = false, rewards = {{enable = true, type = "storage", values = NECROPHARUS}}},
[28] = {questStarted = 65030, questStorage = 65130, killsRequired = 500, raceName = "Dragons", repeatable = true, rewards = {{enable = true, type = "storage", values = DEMODRAS}, {enable = true, type = "exp", values = 400000}}},
[29] = {questStarted = 14023, questStorage = 14123, killsRequired = 6666, raceName = "Demons", repeatable = false, rewards = {{enable = true, type = "exp", values = 1000000}, {enable = true, type = "item", values = {10305,1}}}}}

function getTasksStarted(cid)
local tmp = {}
for k, v in pairs(tasks) do
if getPlayerStorageValue(cid, v.questStarted) == 1 then
table.insert(tmp, k)
end
end
return tmp
end

function getTaskByName(name)
for k, v in pairs(tasks) do
if v.raceName:lower() == name:lower() then
return k
end
end
return false
end

function sendTaskWindow(cid)
taskWindow = ModalWindow(1900, "Mission Management", "Select a task:")
local task_status = {}

if taskWindow:getId() == 1900 then
    taskWindow:addButton(1, "Select")
	taskWindow:setDefaultEnterButton(1)
    taskWindow:addButton(2, "Cancel")
	taskWindow:setDefaultEscapeButton(2)
	for i = 1, #tasks do
		if getPlayerStorageValue(cid, tasks[i].questStarted) == 2 then
			task_status[i] = "[completed]"
		else
			if getPlayerStorageValue(cid, tasks[i].questStarted) == 1 then
				task_status[i] = "[" .. getPlayerStorageValue(cid, tasks[i].questStorage) .. "/" .. tasks[i].killsRequired .. "]"
			else
				if getPlayerStorageValue(cid, tasks[i].questStarted) < 1 then
					task_status[i] = tasks[i].killsRequired
				else
					task_status[i] = tasks[i].killsRequired .. " [unknown]"
				end
			end
		end
		
		if getPlayerStorageValue(cid, tasks[i].questStarted) == 1 and getPlayerStorageValue(cid, tasks[i].questStorage) >= tasks[i].killsRequired then
			taskWindow:addChoice(i, tasks[i].raceName .. " [click for reward]")
		
		else
			taskWindow:addChoice(i, tasks[i].raceName .. ", " .. task_status[i])
		end
	end
end
taskWindow:sendToPlayer(cid)
return true
end

 

Link para o post
Compartilhar em outros sites
  • 2 weeks later...
Em 12/07/2016 at 20:34, Jobs disse:

 

Tenta assim

 


rankStorage = 32150

THESNAPPER = {80000, 1}
DEMODRAS = {80001, 1}
HIDE = {80002, 1}
THEBLOODTUSK = {80003, 1}
SHARDHEAD = {80004, 1}
THUL = {80005, 1}
ESMERALDA = {80006, 1}
THEOLDWIDOW = {80007, 1}
THEMANY = {80008, 1}
LEVIATHAN = {80009, 1}
STONECRACKER = {80010, 1}
THENOXIUSSPAWN = {80011, 1}
MERIKHTHESLAUGHTERER = {80012, 1}
FAHIMTHEWISE = {80013, 1}
RANDOMPIRATEBOSS = {80014, 1}
THEHORNEDFOX = {80015, 1}
NECROPHARUS = {80016, 1}

tasks =
{
[1] = {questStarted = 65000, questStorage = 65100, killsRequired = 100, raceName = "Trolls", repeatable = false, rewards = {{enable = true, type = "exp", values = 40000}, {enable = true, type = "money", values = 4000}}},
[2] = {questStarted = 65001, questStorage = 65101, killsRequired = 150, raceName = "Goblins", repeatable = false, rewards = {{enable = true, type = "exp", values = 70000}, {enable = true, type = "money", values = 5000}}},
[3] = {questStarted = 65002, questStorage = 65102, killsRequired = 300, raceName = "Rotworms", repeatable = false, rewards = {{enable = true, type = "exp", values = 100000}, {enable = true, type = "money", values = 6000}}},
[4] = {questStarted = 65003, questStorage = 65103, killsRequired = 500, raceName = "Cyclops", repeatable = false, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "money", values = 8000}}},
[5] = {questStarted = 14007, questStorage = 14107, killsRequired = 300, raceName = "Crocodiles", repeatable = true, rewards = {{enable = true, type = "exp", values = 100000}, {enable = true, type = "storage", values = THESNAPPER}, {enable = true, type = "points", values = 2}}},
[6] = {questStarted = 14008, questStorage = 14108, killsRequired = 300, raceName = "Tarantulas", repeatable = true, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "storage", values = HIDE}, {enable = true, type = "points", values = 2}}},
[7] = {questStarted = 14009, questStorage = 14109, killsRequired = 150, raceName = "Carniphilas", repeatable = false, rewards = {{enable = true, type = "exp", values = 250000}, {enable = true, type = "money", values = 15000}}},
[8] = {questStarted = 14010, questStorage = 14110, killsRequired = 200, raceName = "Stone Golems", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 15000}}},
[9] = {questStarted = 14011, questStorage = 14111, killsRequired = 300, raceName = "Mammoths", repeatable = true, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "storage", values = THEBLOODTUSK}, {enable = true, type = "points", values = 2}}},
[10] = {questStarted = 14012, questStorage = 14112, killsRequired = 300, raceName = "Ice Golems", repeatable = true, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "storage", values = SHARDHEAD}, {enable = true, type = "points", values = 2}}},
[11] = {questStarted = 14013, questStorage = 14113, killsRequired = 300, raceName = "Quaras Scout", repeatable = true, rewards = {{enable = true, type = "exp", values = 250000}, {enable = true, type = "money", values = 25000}}},
[12] = {questStarted = 14014, questStorage = 14114, killsRequired = 300, raceName = "Quaras", repeatable = true, rewards = {{enable = true, type = "exp", values = 300000}, {enable = true, type = "storage", values = THUL}, {enable = true, type = "points", values = 2}}},
[13] = {questStarted = 14015, questStorage = 14115, killsRequired = 70, raceName = "Water Elementals", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 20000}}},
[14] = {questStarted = 14016, questStorage = 14116, killsRequired = 70, raceName = "Earth Elementals", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 20000}}},
[15] = {questStarted = 14017, questStorage = 14117, killsRequired = 70, raceName = "Energy Elementals", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 20000}}},
[16] = {questStarted = 14018, questStorage = 14118, killsRequired = 70, raceName = "Fire Elementals", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 20000}}},
[17] = {questStarted = 14019, questStorage = 14119, killsRequired = 200, raceName = "Mutated Rats", repeatable = true, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "storage", values = ESMERALDA}, {enable = true, type = "points", values = 2}}},
[18] = {questStarted = 14020, questStorage = 14120, killsRequired = 500, raceName = "Giant Spiders", repeatable = true, rewards = {{enable = true, type = "exp", values = 250000}, {enable = true, type = "storage", values = THEOLDWIDOW}, {enable = true, type = "points", values = 2}}},
[19] = {questStarted = 14021, questStorage = 14121, killsRequired = 500, raceName = "Hydras", repeatable = true, rewards = {{enable = true, type = "storage", values = THEMANY}, {enable = true, type = "points", values = 4}}},
[20] = {questStarted = 14001, questStorage = 14101, killsRequired = 500, raceName = "Sea Serpents", repeatable = true, rewards = {{enable = true, type = "storage", values = LEVIATHAN}, {enable = true, type = "points", values = 4}}},
[21] = {questStarted = 14022, questStorage = 14122, killsRequired = 500, raceName = "Behemoths", repeatable = true, rewards = {{enable = true, type = "storage", values = STONECRACKER}, {enable = true, type = "points", values = 4}}},
[22] = {questStarted = 14002, questStorage = 14102, killsRequired = 375, raceName = "Serpents Spawn", repeatable = true, rewards = {{enable = true, type = "storage", values = THENOXIOUSSPAWN}, {enable = true, type = "points", values = 4}}},
[23] = {questStarted = 65022, questStorage = 65122, killsRequired = 125, raceName = "Green Djinns", repeatable = true, rewards = {{enable = true, type = "exp", values = 230000}, {enable = true, type = "money", values = 5000}, {enable = true, type = "storage", values = MERIKHTHESLAUGHTERER}}},
[24] = {questStarted = 65023, questStorage = 65123, killsRequired = 125, raceName = "Blue Djinns", repeatable = true, rewards = {{enable = true, type = "exp", values = 230000}, {enable = true, type = "money", values = 5000}, {enable = true, type = "storage", values = FAHIMTHEWISE}}},
[25] = {questStarted = 65024, questStorage = 65124, killsRequired = 300, raceName = "Pirates", repeatable = false, rewards = {{enable = true, type = "exp", values = 300000}, {enable = true, type = "money", values = 40000}, {enable = true, type = "storage", values = RANDOMPIRATEBOSS}}},
[26] = {questStarted = 14004, questStorage = 14104, killsRequired = 500, raceName = "Minotaurs", repeatable = false, rewards = {{enable = true, type = "storage", values = THEHORNEDFOX}}},
[27] = {questStarted = 14003, questStorage = 14103, killsRequired = 1000, raceName = "Magicians", repeatable = false, rewards = {{enable = true, type = "storage", values = NECROPHARUS}}},
[28] = {questStarted = 65030, questStorage = 65130, killsRequired = 500, raceName = "Dragons", repeatable = true, rewards = {{enable = true, type = "storage", values = DEMODRAS}, {enable = true, type = "exp", values = 400000}}},
[29] = {questStarted = 14023, questStorage = 14123, killsRequired = 6666, raceName = "Demons", repeatable = false, rewards = {{enable = true, type = "exp", values = 1000000}, {enable = true, type = "item", values = {10305,1}}}}}

function getTasksStarted(cid)
local tmp = {}
for k, v in pairs(tasks) do
if getPlayerStorageValue(cid, v.questStarted) == 1 then
table.insert(tmp, k)
end
end
return tmp
end

function getTaskByName(name)
for k, v in pairs(tasks) do
if v.raceName:lower() == name:lower() then
return k
end
end
return false
end

function sendTaskWindow(cid)
taskWindow = ModalWindow(1900, "Mission Management", "Select a task:")
local task_status = {}

if taskWindow:getId() == 1900 then
    taskWindow:addButton(1, "Select")
	taskWindow:setDefaultEnterButton(1)
    taskWindow:addButton(2, "Cancel")
	taskWindow:setDefaultEscapeButton(2)
	for i = 1, #tasks do
		if getPlayerStorageValue(cid, tasks[i].questStarted) == 2 then
			task_status[i] = "[completed]"
		else
			if getPlayerStorageValue(cid, tasks[i].questStarted) == 1 then
				task_status[i] = "[" .. getPlayerStorageValue(cid, tasks[i].questStorage) .. "/" .. tasks[i].killsRequired .. "]"
			else
				if getPlayerStorageValue(cid, tasks[i].questStarted) < 1 then
					task_status[i] = tasks[i].killsRequired
				else
					task_status[i] = tasks[i].killsRequired .. " [unknown]"
				end
			end
		end
		
		if getPlayerStorageValue(cid, tasks[i].questStarted) == 1 and getPlayerStorageValue(cid, tasks[i].questStorage) >= tasks[i].killsRequired then
			taskWindow:addChoice(i, tasks[i].raceName .. " [click for reward]")
		
		else
			taskWindow:addChoice(i, tasks[i].raceName .. ", " .. task_status[i])
		end
	end
end
taskWindow:sendToPlayer(cid)
return true
end

 

entao o problema esta no vitor que abre windows e  nao mostra as tasks

Editado por fabiobillz (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
2 horas atrás, fabiobillz disse:

entao o problema esta no vitor que abre windows e  nao mostra as tasks

 

Eu testei no meu servidor que hoje é tfs 1.2, 10.95 e sim, eu fui tentar adicionar e estava dando o mesmo erro que o seu, ai troquei algumas funções, na hora que você escolhe a Task ele não vai. È por causa do tfs, mudou algumas funções =(

 

Mas se você quiser, você pode adicionar outro sistema de task e apenas adicionar a a tag pra adicionar os pontos.

Link para o post
Compartilhar em outros sites

 

10 minutos atrás, Jobs disse:

 

Eu testei no meu servidor que hoje é tfs 1.2, 10.95 e sim, eu fui tentar adicionar e estava dando o mesmo erro que o seu, ai troquei algumas funções, na hora que você escolhe a Task ele não vai. È por causa do tfs, mudou algumas funções =(

 

Mas se você quiser, você pode adicionar outro sistema de task e apenas adicionar a a tag pra adicionar os pontos.

putz é foda, mas como faz isso? tem algum sistema de task? o meu nao ta somando os mostros mortos

Editado por fabiobillz
falto algo (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
3 minutos atrás, fabiobillz disse:

 

putz é foda, mas como faz isso?

 

No script que você estiver usando, na parte de recompensas você adiciona a tag e no value você tem que por "points = 3" por exemplo

è como se fosse colocar items,

 

{enable = true, type = "money", values = 20000}}},
{enable = true, type = "points", values = 5}}},

db.query("UPDATE `accounts` SET `task_points` = `task_points` + " .. tasks[choiceId].rewards[i].values .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")

 

Editado por Jobs (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
Em 21/07/2016 at 23:52, Jobs disse:

 

No script que você estiver usando, na parte de recompensas você adiciona a tag e no value você tem que por "points = 3" por exemplo

è como se fosse colocar items,

 

{enable = true, type = "money", values = 20000}}},
{enable = true, type = "points", values = 5}}},


db.query("UPDATE `accounts` SET `task_points` = `task_points` + " .. tasks[choiceId].rewards[i].values .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")

 

--[[
	TODO
		Unite all related variables / functions in a table
		rewrite functions like "getTasksByPlayer" to "Player.getTasks"
]]

RANK_NONE = 0
RANK_JOIN = 1
RANK_HUNTSMAN = 2
RANK_RANGER = 3
RANK_BIGGAMEHUNTER = 4
RANK_TROPHYHUNTER = 5
RANK_ELITEHUNTER = 6

REWARD_MONEY = 1
REWARD_EXP = 2
REWARD_ACHIEVEMENT = 3
REWARD_STORAGE = 4
REWARD_POINT = 5
REWARD_ITEM = 6

QUESTSTORAGE_BASE = 1500
JOIN_STOR = 100157
KILLSSTORAGE_BASE = 65000
REPEATSTORAGE_BASE = 48950
POINTSSTORAGE = 2500
tasks =
{
	[1] = {killsRequired = 100, raceName = "Trolls", level = {6, 19}, premium = true, creatures = {"troll", "troll champion", "island troll", "swamp troll"}, rewards = {{type = "exp", value = {200}},{type = "money", value = {200}}}},
	[2] = {killsRequired = 150, raceName = "Goblins", level = {6, 19}, premium = true, creatures = {"goblin", "goblin assassin", "goblin leader"}, rewards = {{type = "exp", value = {300}},{type = "money", value = {250}}}},
	[3] = {killsRequired = 300, raceName = "Crocodiles", level = {6, 49}, premium = true, creatures = {"crocodile"}, rewards = {{type = "exp", value = {800}},{type = "achievement", value = {"Blood-Red Snapper"}},{type = "storage", value = {35000, 1}},{type = "points", value = {1}}}},
	[4] = {killsRequired = 300, raceName = "Badgers", level = {6, 49}, premium = true, creatures = {"badger"}, rewards = {{type = "exp", value = {500}},{type = "points", value = {1}}}},
	[5] = {killsRequired = 300, raceName = "Tarantulas", level = {6, 49}, premium = true, creatures = {"tarantula"}, rewards = {{type = "exp", value = {1500}},{type = "achievement", value = {"No More Hiding"}},{type = "storage", value = {35001, 1}},{type = "points", value = {2}}}},
	[6] = {killsRequired = 150, raceName = "Carniphilas", level = {6, 49}, premium = true, creatures = {"carniphila"}, rewards = {{type = "exp", value = {2500}},{type = "achievement", value = {"Rootless Behaviour"}},{type = "storage", value = {35002, 1}},{type = "points", value = {3}}}},
	[7] = {killsRequired = 200, raceName = "Stone Golems", level = {6, 49}, premium = true, creatures = {"stone golem"}, rewards = {{type = "exp", value = {2000}},{type = "points", value = {3}}}},
	[8] = {killsRequired = 300, raceName = "Mammoths", level = {6, 49}, premium = true, creatures = {"mammoth"}, rewards = {{type = "exp", value = {4000}},{type = "achievement", value = {"Meat Skewer"}},{type = "storage", value = {35003, 1}},{type = "points", value = {3}}}},
	[9] = {killsRequired = 300, raceName = "Gnarlhounds", level = {6, 49}, premium = true, creatures = {"gnarlhound"}, rewards = {{type = "exp", value = {1000}},{type = "points", value = {2}}}},
	[10] = {killsRequired = 300, raceName = "Terramites", level = {6, 49}, premium = true, creatures = {"terramite"}, rewards = {{type = "exp", value = {1000}},{type = "points", value = {2}}}},
	[11] = {killsRequired = 300, raceName = "Apes", level = {6, 49}, premium = true, creatures = {"kongra", "sibang", "merklin"}, rewards = {{type = "exp", value = {1000}},{type = "points", value = {2}}}},
	[12] = {killsRequired = 300, raceName = "Thornback Tortoises", level = {6, 49}, premium = true, creatures = {"thornback tortoise"}, rewards = {{type = "exp", value = {1500}},{type = "points", value = {2}}}},
	[13] = {killsRequired = 300, raceName = "Gargoyles", level = {6, 49}, premium = true, creatures = {"gargoyle"}, rewards = {{type = "exp", value = {1500}}}},
	[14] = {killsRequired = 300, raceName = "Ice Golems", level = {50, 79}, premium = true, creatures = {"ice golem"}, rewards = {{type = "exp", value = {12000}},{type = "achievement", value = {"Breaking The Ice"}},{type = "storage", value = {35004, 1}},{type = "points", value = {2}}}},
	[15] = {killsRequired = 400, raceName = "Quara Scouts", level = {50, 79}, premium = true, creatures = {"quara pincher scout", "quara predator scout", "quara hydromancer scout", "quara constrictor scout", "quara mantassin scout"}, rewards = {{type = "exp", value = {10000}},{type = "points", value = {2}}}},
	[16] = {killsRequired = 400, raceName = "Mutated Rats", level = {50, 79}, premium = true, creatures = {"mutated rat"}, rewards = {{type = "exp", value = {10000}},{type = "achievement", value = {"Twisted Mutation"}},{type = "storage", value = {35005, 1}},{type = "points", value = {2}}}},
	[17] = {killsRequired = 250, raceName = "Ancient Scarabs", level = {50, 79}, premium = true, creatures = {"ancient scarab"}, rewards = {{type = "exp", value = {15000}},{type = "achievement", value = {"Crawling Death"}},{type = "storage", value = {35006, 1}},{type = "points", value = {2}}}},
	[18] = {killsRequired = 300, raceName = "Wyverns", level = {50, 79}, premium = true, creatures = {"wyvern"}, rewards = {{type = "exp", value = {12000}},{type = "points", value = {2}}}},
	[19] = {killsRequired = 300, raceName = "Lancer Beetles", level = {50, 79}, premium = true, creatures = {"lancer beetle"}, rewards = {{type = "exp", value = {8000}},{type = "points", value = {2}}}},
	[20] = {killsRequired = 400, raceName = "Wailing Widows", level = {50, 79}, premium = true, creatures = {"wailing widow"}, rewards = {{type = "exp", value = {12000}},{type = "points", value = {3}}}},
	[21] = {killsRequired = 250, raceName = "Killer Caimans", level = {50, 79}, premium = true, creatures = {"killer caiman"}, rewards = {{type = "exp", value = {10000}},{type = "points", value = {2}}}},
	[22] = {killsRequired = 300, raceName = "Bonebeasts", level = {50, 79}, premium = true, creatures = {"bonebeast"}, rewards = {{type = "exp", value = {12000}},{type = "achievement", value = {"Spareribs for Dinner"}},{type = "storage", value = {35007, 1}},{type = "points", value = {2}}}},
	[23] = {killsRequired = 300, raceName = "Crystal Spiders", level = {50, 79}, creatures = {"crystal spider"}, premium = true, rewards = {{type = "exp", value = {15000}},{type = "achievement", value = {"Arachnoise"}},{type = "storage", value = {35008, 1}},{type = "points", value = {3}}}},
	[24] = {killsRequired = 300, raceName = "Mutated Tigers", level = {50, 79}, premium = true, creatures = {"mutated tiger"}, rewards = {{type = "exp", value = {12000}},{type = "points", value = {2}}}},
	[25] = {killsRequired = 600, raceName = "Underwater Quara", level = {80, 129}, premium = true, creatures = {"quara hydromancer", "quara predator", "quara constrictor", "quara mantassin", "quara pincher"}, rewards = {{type = "exp", value = {15000}},{type = "achievement", value = {"Back into the Abyss"}},{type = "storage", value = {35009, 1}},{type = "points", value = {3}}}},
	[26] = {killsRequired = 500, raceName = "Giant Spiders", level = {80, 129}, premium = true, creatures = {"giant spider"}, rewards = {{type = "exp", value = {20000}},{type = "achievement", value = {"Choking on Her Venom"}},{type = "storage", value = {35010, 1}},{type = "points", value = {3}}}},
	[27] = {killsRequired = 300, raceName = "Werewolves", level = {80, 129}, premium = true, creatures = {"werewolf"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Howly Silence"}},{type = "storage", value = {35011, 1}},{type = "points", value = {4}}}},
	[28] = {killsRequired = 400, raceName = "Nightmares", level = {80, 129}, premium = true, creatures = {"nightmare", "nightmare scion"}, rewards = {{type = "exp", value = {25000}},{type = "achievement", value = {"Dream is Over"}},{type = "storage", value = {35012, 1}},{type = "points", value = {3}}}},
	[29] = {killsRequired = 600, raceName = "Hellspawns", level = {80, 129}, premium = true, creatures = {"hellspawn"}, rewards = {{type = "exp", value = {25000}},{type = "achievement", value = {"Scorched Flames"}},{type = "storage", value = {35013, 1}}}},
	[30] = {killsRequired = 800, raceName = "High Class Lizards", level = {80, 129}, premium = true, creatures = {"lizard chosen", "lizard dragon priest", "lizard high guard", "lizard legionnaire"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Zzztill Zzztanding!"}},{type = "storage", value = {35014, 1}},{type = "points", value = {3}}}},
	[31] = {killsRequired = 600, raceName = "Stampors", level = {80, 129}, premium = true, creatures = {"stampor"}, rewards = {{type = "exp", value = {20000}},{type = "achievement", value = {"Stepped on a Big Toe"}},{type = "storage", value = {35015, 1}},{type = "points", value = {3}}}},
	[32] = {killsRequired = 500, raceName = "Brimstone Bugs", level = {80, 129}, premium = true, creatures = {"brimstone bug"}, rewards = {{type = "exp", value = {15000}},{type = "achievement", value = {"Something Smells"}},{type = "storage", value = {35016, 1}},{type = "points", value = {3}}}},
	[33] = {killsRequired = 400, raceName = "Mutated Bats", level = {80, 129}, premium = true, creatures = {"mutated bat"}, rewards = {{type = "exp", value = {20000}},{type = "achievement", value = {"Kapow!"}},{type = "storage", value = {35017, 1}},{type = "points", value = {2}}}},
	[34] = {killsRequired = 650, raceName = "Hydras", level = {130, 9999}, premium = true, creatures = {"hydra"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"One Less"}},{type = "storage", value = {35018, 1}},{type = "points", value = {3}}}},
	[35] = {killsRequired = 800, raceName = "Serpent Spawns", level = {130, 9999}, premium = true, creatures = {"serpent spawn"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Hissing Downfall"}},{type = "storage", value = {35019, 1}},{type = "points", value = {4}}}},
	[36] = {killsRequired = 500, raceName = "Medusae", level = {130, 9999}, premium = true, creatures = {"medusa"}, rewards = {{type = "exp", value = {40000}},{type = "achievement", value = {"The Serpent's Bride"}},{type = "storage", value = {35020, 1}},{type = "points", value = {5}}}},
	[37] = {killsRequired = 700, raceName = "Behemoths", level = {130, 9999}, premium = true, creatures = {"behemoth"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Just Cracked Me Up!"}},{type = "storage", value = {35021, 1}},{type = "points", value = {4}}}},
	[38] = {killsRequired = 900, raceName = "Sea Serpents and Young Sea Serpents", level = {130, 9999}, premium = true, creatures = {"sea serpent", "young sea serpent"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"The Drowned Sea God"}},{type = "storage", value = {35022, 1}},{type = "points", value = {4}}}},
	[39] = {killsRequired = 250, raceName = "Hellhounds", level = {130, 9999}, premium = true, creatures = {"hellhound"}, rewards = {{type = "exp", value = {40000}},{type = "achievement", value = {"The Gates of Hell"}},{type = "storage", value = {35023, 1}},{type = "points", value = {5}}}},
	[40] = {killsRequired = 500, raceName = "Ghastly Dragons", level = {130, 9999}, premium = true, creatures = {"ghastly dragon"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Beautiful Agony"}},{type = "storage", value = {35024, 1}},{type = "points", value = {5}}}},
	[41] = {killsRequired = 900, raceName = "Drakens", level = {130, 9999}, premium = true, creatures = {"draken spellweaver", "draken warmaster", "draken abomination", "draken elite"} , rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Enter zze Draken!"}},{type = "storage", value = {35025, 1}},{type = "points", value = {3}}}},
	[42] = {killsRequired = 650, raceName = "Destroyers", level = {130, 9999}, premium = true, creatures = {"destroyer"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Best there was!"}},{type = "storage", value = {35026, 1}},{type = "points", value = {4}}}},
	[43] = {killsRequired = 400, raceName = "Undead Dragons", level = {130, 9999}, premium = true, creatures = {"undead dragon"}, rewards = {{type = "exp", value = {50000}},{type = "achievement", value = {"Back from the Dead"}},{type = "storage", value = {35027, 1}},{type = "points", value = {6}}}},
	[44] = {killsRequired = 666, raceName = "Demons", level = {130, 9999}, rank = RANK_ELITEHUNTER, premium = true, creatures = {"demon"}, rewards = {{type = "storage", value = {41300, 1}}}},
	[45] = {killsRequired = 500, raceName = "Green Djinns or Efreets", level = {1, 9999}, storage = {12500, 1}, premium = true, creatures = {"green djinn", "efreet"}, rewards = {{type = "exp", value = {10000}},{type = "money", value = {5000}},{type = "storage", value = {35028, 1}}}},
	[46] = {killsRequired = 500, raceName = "Blue Djinns or Marids", level = {1, 9999}, storage = {12501, 1}, premium = true, creatures = {"blue djinn", "marid"}, rewards = {{type = "exp", value = {10000}},{type = "money", value = {5000}},{type = "storage", value = {35029, 1}}}},
	[47] = {killsRequired = 3000, raceName = "Pirates", level = {1, 9999}, storage = {12600, 1}, premium = true, creatures = {"pirate ghost", "pirate marauder", "pirate cutthroad", "pirate buccaneer", "pirate corsair", "pirate skeleton"}, rewards = {{type = "exp", value = {10000}},{type = "money", value = {5000}},{type = "storage", value = {35030, 1}}}},
	[48] = {killsRequired = 3000, raceName = "Pirates second task", level = {1, 9999}, storage = {REPEATSTORAGE_BASE + 47, 3}, norepeatable = true, premium = true, creatures = {"pirate ghost", "pirate marauder", "pirate cutthroad", "pirate buccaneer", "pirate corsair", "pirate skeleton"}, rewards = {{type = "exp", value = {10000}},{type = "money", value = {5000}},{type = "storage", value = {35031, 1}}}},
	[49] = {killsRequired = 5000, raceName = "Minotaurs", level = {1, 40}, storage = {12700, 1}, norepeatable = true, premium = false, creatures = {"minotaur", "minotaur mage", "minotaur archer"}, rewards = {{type = "storage", value = {35032, 1}}}},	
}

tasksByPlayer = 3
repeatTimes = 3

function Player.getPawAndFurRank(self)
	return (self:getStorageValue(POINTSSTORAGE) >= 100 and RANK_ELITEHUNTER or self:getStorageValue(POINTSSTORAGE) >= 70 and RANK_TROPHYHUNTER or self:getStorageValue(POINTSSTORAGE) >= 40 and RANK_BIGGAMEHUNTER or self:getStorageValue(POINTSSTORAGE) >= 20 and RANK_RANGER or self:getStorageValue(POINTSSTORAGE) >= 10 and RANK_HUNTSMAN or self:getStorageValue(JOIN_STOR) == 1 and RANK_JOIN or RANK_NONE)
end

function Player.getPawAndFurPoints(self)
	return math.max(self:getStorageValue(POINTSSTORAGE), 0)
end

function getTaskByName(name, table)
	local t = (table and table or tasks)
	for k, v in pairs(t) do
		if v.name then
			if v.name:lower() == name:lower() then
				return k
			end
		else
			if v.raceName:lower() == name:lower() then
				return k
			end
		end
	end
	return false
end

function Player.getTasks(self)
	local canmake = {}
	local able = {}
	for k, v in pairs(tasks) do
		if self:getStorageValue(QUESTSTORAGE_BASE + k) < 1 and self:getStorageValue(REPEATSTORAGE_BASE + k) < repeatTimes then
			able[k] = true
			if self:getLevel() < v.level[1] or self:getLevel() > v.level[2] then
				able[k] = false
			end
			if v.storage and self:getStorageValue(v.storage[1]) < v.storage[2] then
				able[k] = false
			end

			if v.rank then
				if self:getPawAndFurRank() < v.rank then
					able[k] = false
				end
			end

			if v.premium then
				if not self:isPremium() then
					able[k] = false
				end
			end

			if able[k] then
				canmake[#canmake + 1] = k
			end
		end
	end
	return canmake
end

function Player.canStartTask(self, name, table)
	local v = ""
	local id = 0
	local t = (table and table or tasks)
	for k, i in pairs(t) do
		if i.name then
			if i.name:lower() == name:lower() then
				v = i
				id = k
				break
			end
		else
			if i.raceName:lower() == name:lower() then
				v = i
				id = k
				break
			end
		end
	end
	if v == "" then
		return false
	end
	if self:getStorageValue(QUESTSTORAGE_BASE + id) > 0 then
		return false
	end
	if self:getStorageValue(REPEATSTORAGE_BASE +  id) >= repeatTimes or v.norepeatable and self:getStorageValue(REPEATSTORAGE_BASE +  id) > 0 then
		return false
	end
	if v.level and self:getLevel() >= v.level[1] and self:getLevel() <= v.level[2] then
		if v.premium then
			if self:isPremium() then
				if v.rank then
					if self:getPawAndFurRank() >= v.rank then
						if v.storage then
							if self:getStorageValue(v.storage[1]) >= v.storage then
								return true
							end
						else
							return true
						end
					end
				else
					return true
				end
			else
				return true
			end
		else
			return true
		end
	end
	return false
end

function Player.getStartedTasks(self)
	local tmp = {}
	for k, v in pairs(tasks) do
		if self:getStorageValue(QUESTSTORAGE_BASE + k) > 0 and self:getStorageValue(QUESTSTORAGE_BASE + k) < 2 then
			tmp[#tmp + 1] = k
		end
	end
	return tmp
end

--in case other scripts are using these functions, i'll let them here
function getPlayerRank(cid) local p = Player(cid) return p and p:getPawAndFurRank() end
function getPlayerTasksPoints(cid) local p = Player(cid) return p and p:getPawAndFurPoints() end
function getTasksByPlayer(cid) local p = Player(cid) return p and p:getTasks() end
function canStartTask(cid, name, table) local p = Player(cid) return p and p:canStartTask(name, table) end
function getPlayerStartedTasks(cid) local p = Player(cid) return p and p:getStartedTasks() end

onde eu colocaria aqui?

Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo