.Qual servidor ou website você utiliza como base?
Qual o motivo deste tópico?
Tenho esse codigo de war sistem porem o player nao recebe os itens iniciais, alguem pode me ajudar a fazer funcinar obrigado
warlogin
dofile("war_config.lua")
local warlogin = CreatureEvent("warlogin")
function warlogin.onLogin(player)
local vocation = player:getVocation():getId()
local promotion = player:getVocation():getPromotion()
local function getVocationName(player)
if vocation == 0 then
return "Newbie"
end
if vocation == 1 then
return "Sorcerer"
end
if vocation == 2 then
return "Druid"
end
if vocation == 3 then
return "Paladin"
end
if vocation == 4 then
return "Knight"
end
if vocation == 5 then
return "Master Sorcerer"
end
if vocation == 6 then
return "Elder Druid"
end
if vocation == 7 then
return "Royal Paladin"
end
if vocation == 8 then
return "Elite Knight"
end
return "Unknown"
end
local function getExpForLevel(level)
level = level - 1
return ((50 * level * level * level) - (150 * level * level) + (400 * level)) / 3
end
local function getMinimumLevel(skill)
if skill == "LEVEL" then
if player:getStorageValue(minimumLevelUp1Stor) == 1 then
return minimumLevelUp1
else
return minimumLevel
end
end
if vocation == 1 or vocation == 5 then
if skill == SKILL_CLUB or skill == SKILL_SWORD or skill == SKILL_AXE or skill == SKILL_DISTANCE then
return 10
end
if skill == SKILL_SHIELD then
if player:getStorageValue(sorcererShieldUp1Stor) == 1 then
return sorcererShieldUp1
else
return sorcererShield
end
end
if skill == "MAGIC" then
if player:getStorageValue(sorcererMagicUp1Stor) == 1 then
return sorcererMagicUp1
else
return sorcererMagic
end
end
end
if vocation == 2 or vocation == 6 then
if skill == SKILL_CLUB or skill == SKILL_SWORD or skill == SKILL_AXE or skill == SKILL_DISTANCE then
return 10
end
if skill == SKILL_SHIELD then
if player:getStorageValue(druidShieldUp1Stor) == 1 then
return druidShieldUp1
else
return druidShield
end
end
if skill == "MAGIC" then
if player:getStorageValue(druidMagicUp1Stor) == 1 then
return druidMagicUp1
else
return druidMagic
end
end
end
if vocation == 3 or vocation == 7 then
if skill == SKILL_CLUB or skill == SKILL_SWORD or skill == SKILL_AXE then
return 10
end
if skill == SKILL_DISTANCE then
if player:getStorageValue(paladinDistanceUp1Stor) == 1 then
return paladinDistanceUp1
else
return paladinDistance
end
end
if skill == SKILL_SHIELD then
if player:getStorageValue(paladinShieldUp1Stor) == 1 then
return paladinShieldUp1
else
return paladinShield
end
end
if skill == "MAGIC" then
if player:getStorageValue(paladinMagicUp1Stor) == 1 then
return paladinMagicUp1
else
return paladinMagic
end
end
end
if vocation == 4 or vocation == 8 then
if skill == SKILL_DISTANCE then
return 10
end
if skill == SKILL_CLUB or skill == SKILL_SWORD or skill == SKILL_AXE then
if player:getStorageValue(knightMeleeUp1Stor) == 1 then
return knightMeleeUp1
else
return knightMelee
end
end
if skill == SKILL_SHIELD then
if player:getStorageValue(knightShieldUp1Stor) == 1 then
return knightShieldUp1
else
return knightShield
end
end
if skill == "MAGIC" then
if player:getStorageValue(knightMagicUp1Stor) == 1 then
return knightMagicUp1
else
return knightMagic
end
end
end
end
local function getRemainingDoubleFragReward(player)
if player:getStorageValue(doubleFragRewardStor) >= 1 then
return player:getStorageValue(doubleFragRewardStor)
else
return 0
end
end
local function getRemainingExtraExp(player)
if player:getStorageValue(extraExpStor) >= 1 then
return player:getStorageValue(extraExpStor)
else
return 0
end
end
player:teleportTo(player:getTown():getTemplePosition())
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, everyLoginMessage)
if player:getLastLoginSaved() <= 0 then
if player:getGroup():getId() < 2 then
player:setStorageValue(fragStor, 0)
player:setStorageValue(deathStor, 0)
player:setStorageValue(doubleFragRewardStor, bonusFragReward)
player:setStorageValue(extraExpStor, bonusExpReward)
player:addExperience(getExpForLevel(startLevel) - player:getExperience())
end
if string.lower(promoteOnLogin) ~= "no" then
if player:getGroup():getId() < 2 then
player:setVocation(promotion)
end
end
if string.lower(giveFirstItems) ~= "no" then
if player:getGroup():getId() < 2 then
for _, v in ipairs(commonItems) do
player:addItem(v.itemid, v.count or 1)
end
local giveItems = firstItems[vocation]
if giveItems ~= nil then
for _, v in ipairs(giveItems) do
player:addItem(v.itemid, v.count or 1)
end
end
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have recieved your first items!")
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, newPlayerMessage)
end
end
end
if string.lower(enableMinimumLevel) ~= "no" then
if player:getLevel() < getMinimumLevel("LEVEL") then
if player:getGroup():getId() < 2 then
player:addExperience(getExpForLevel(getMinimumLevel("LEVEL")) - player:getExperience())
end
end
end
if string.lower(fullBlessOnLogin) ~= "no" then
if player:getGroup():getId() < 2 then
player:addPremiumDays(1)
player:addBlessing(1)
player:addBlessing(2)
player:addBlessing(3)
player:addBlessing(4)
player:addBlessing(5)
end
end
if string.lower(displayStatsOnLogin) ~= "no" then
if player:getGroup():getId() < 2 then
player:popupFYI("" .. player:getName() .. " the " .. getVocationName(player) .. " " ..
"\nKills: " .. player:getStorageValue(fragStor) .. " | Deaths: " .. player:getStorageValue(deathStor) .. " " ..
"\n " ..
"\nCharacter Stat: Current Level | (Minimum Level) " ..
"\n " ..
"\nExperience Level: " .. player:getLevel() .. " | (" .. getMinimumLevel("LEVEL") .. ") " ..
"\nMagic Level: " .. player:getMagicLevel() .. " | (" .. getMinimumLevel("MAGIC") .. ") " ..
"\nClub Fighting: " .. player:getSkillLevel(SKILL_CLUB) .. " | (" .. getMinimumLevel(SKILL_CLUB) .. ") " ..
"\nSword Fighting: " .. player:getSkillLevel(SKILL_SWORD) .. " | (" .. getMinimumLevel(SKILL_SWORD) .. ") " ..
"\nAxe Fighting: " .. player:getSkillLevel(SKILL_AXE) .. " | (" .. getMinimumLevel(SKILL_AXE) .. ") " ..
"\nDistance Fighting: " .. player:getSkillLevel(SKILL_DISTANCE) .. " | (" .. getMinimumLevel(SKILL_DISTANCE) .. ") " ..
"\nShielding: " .. player:getSkillLevel(SKILL_SHIELD) .. " | (" .. getMinimumLevel(SKILL_SHIELD) .. ") " ..
"\n " ..
"\nBONUS FRAGS REMAINING: " ..
"\nDouble GOLD: " .. getRemainingDoubleFragReward(player) .. " " ..
"\nExtra EXP: " .. getRemainingExtraExp(player) .. " " ..
"\n " ..
"\nPurchase upgrades on the website! " ..
"\n ")
end
end
if string.lower(enableMinimumSkills) ~= "no" then
if player:getGroup():getId() < 2 then
if vocation == 1 or vocation == 5 then
while player:getSkillLevel(SKILL_SHIELD) < getMinimumLevel(SKILL_SHIELD) do
player:addSkillTries(SKILL_SHIELD, player:getVocation():getRequiredSkillTries(SKILL_SHIELD, player:getSkillLevel(SKILL_SHIELD) + 1) - player:getSkillTries(SKILL_SHIELD))
end
while player:getBaseMagicLevel() < getMinimumLevel("MAGIC") do
player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + 1) - player:getManaSpent())
end
end
if vocation == 2 or vocation == 6 then
while player:getSkillLevel(SKILL_SHIELD) < getMinimumLevel(SKILL_SHIELD) do
player:addSkillTries(SKILL_SHIELD, player:getVocation():getRequiredSkillTries(SKILL_SHIELD, player:getSkillLevel(SKILL_SHIELD) + 1) - player:getSkillTries(SKILL_SHIELD))
end
while player:getBaseMagicLevel() < getMinimumLevel("MAGIC") do
player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + 1) - player:getManaSpent())
end
end
if vocation == 3 or vocation == 7 then
while player:getSkillLevel(SKILL_SHIELD) < getMinimumLevel(SKILL_SHIELD) do
player:addSkillTries(SKILL_SHIELD, player:getVocation():getRequiredSkillTries(SKILL_SHIELD, player:getSkillLevel(SKILL_SHIELD) + 1) - player:getSkillTries(SKILL_SHIELD))
end
while player:getSkillLevel(SKILL_DISTANCE) < getMinimumLevel(SKILL_DISTANCE) do
player:addSkillTries(SKILL_DISTANCE, player:getVocation():getRequiredSkillTries(SKILL_DISTANCE, player:getSkillLevel(SKILL_DISTANCE) + 1) - player:getSkillTries(SKILL_DISTANCE))
end
while player:getBaseMagicLevel() < getMinimumLevel("MAGIC") do
player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + 1) - player:getManaSpent())
end
end
if vocation == 4 or vocation == 8 then
while player:getSkillLevel(SKILL_SHIELD) < getMinimumLevel(SKILL_SHIELD) do
player:addSkillTries(SKILL_SHIELD, player:getVocation():getRequiredSkillTries(SKILL_SHIELD, player:getSkillLevel(SKILL_SHIELD) + 1) - player:getSkillTries(SKILL_SHIELD))
end
while player:getSkillLevel(SKILL_SWORD) < getMinimumLevel(SKILL_SWORD) do
player:addSkillTries(SKILL_SWORD, player:getVocation():getRequiredSkillTries(SKILL_SWORD, player:getSkillLevel(SKILL_SWORD) + 1) - player:getSkillTries(SKILL_SWORD))
end
while player:getSkillLevel(SKILL_AXE) < getMinimumLevel(SKILL_AXE) do
player:addSkillTries(SKILL_AXE, player:getVocation():getRequiredSkillTries(SKILL_AXE, player:getSkillLevel(SKILL_AXE) + 1) - player:getSkillTries(SKILL_AXE))
end
while player:getSkillLevel(SKILL_CLUB) < getMinimumLevel(SKILL_CLUB) do
player:addSkillTries(SKILL_CLUB, player:getVocation():getRequiredSkillTries(SKILL_CLUB, player:getSkillLevel(SKILL_CLUB) + 1) - player:getSkillTries(SKILL_CLUB))
end
while player:getBaseMagicLevel() < getMinimumLevel("MAGIC") do
player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + 1) - player:getManaSpent())
end
end
end
end
if string.lower(enableStartSkills) ~= "no" then
if player:getGroup():getId() < 2 then
if vocation == "sorcerer" or vocation == "master sorcerer" then
while player:getSkillLevel(SKILL_SHIELD) < getMinimumLevel(SKILL_SHIELD) do
player:addSkillTries(SKILL_SHIELD, player:getVocation():getRequiredSkillTries(SKILL_SHIELD, player:getSkillLevel(SKILL_SHIELD) + 1) - player:getSkillTries(SKILL_SHIELD))
end
while player:getBaseMagicLevel() < getMinimumLevel("MAGIC") do
player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + 1) - player:getManaSpent())
end
end
if vocation == "druid" or vocation == "elder druid" then
while player:getSkillLevel(SKILL_SHIELD) < getMinimumLevel(SKILL_SHIELD) do
player:addSkillTries(SKILL_SHIELD, player:getVocation():getRequiredSkillTries(SKILL_SHIELD, player:getSkillLevel(SKILL_SHIELD) + 1) - player:getSkillTries(SKILL_SHIELD))
end
while player:getBaseMagicLevel() < getMinimumLevel("MAGIC") do
player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + 1) - player:getManaSpent())
end
end
if vocation == "paladin" or vocation == "royal paladin" then
while player:getSkillLevel(SKILL_SHIELD) < getMinimumLevel(SKILL_SHIELD) do
player:addSkillTries(SKILL_SHIELD, player:getVocation():getRequiredSkillTries(SKILL_SHIELD, player:getSkillLevel(SKILL_SHIELD) + 1) - player:getSkillTries(SKILL_SHIELD))
end
while player:getSkillLevel(SKILL_DISTANCE) < getMinimumLevel(SKILL_DISTANCE) do
player:addSkillTries(SKILL_DISTANCE, player:getVocation():getRequiredSkillTries(SKILL_DISTANCE, player:getSkillLevel(SKILL_DISTANCE) + 1) - player:getSkillTries(SKILL_DISTANCE))
end
while player:getBaseMagicLevel() < getMinimumLevel("MAGIC") do
player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + 1) - player:getManaSpent())
end
end
if vocation == "knight" or vocation == "elite knight" then
while player:getSkillLevel(SKILL_SHIELD) < getMinimumLevel(SKILL_SHIELD) do
player:addSkillTries(SKILL_SHIELD, player:getVocation():getRequiredSkillTries(SKILL_SHIELD, player:getSkillLevel(SKILL_SHIELD) + 1) - player:getSkillTries(SKILL_SHIELD))
end
while player:getSkillLevel(SKILL_SWORD) < getMinimumLevel(SKILL_SWORD) do
player:addSkillTries(SKILL_SWORD, player:getVocation():getRequiredSkillTries(SKILL_SWORD, player:getSkillLevel(SKILL_SWORD) + 1) - player:getSkillTries(SKILL_SWORD))
end
while player:getSkillLevel(SKILL_AXE) < getMinimumLevel(SKILL_AXE) do
player:addSkillTries(SKILL_AXE, player:getVocation():getRequiredSkillTries(SKILL_AXE, player:getSkillLevel(SKILL_AXE) + 1) - player:getSkillTries(SKILL_AXE))
end
while player:getSkillLevel(SKILL_CLUB) < getMinimumLevel(SKILL_CLUB) do
player:addSkillTries(SKILL_CLUB, player:getVocation():getRequiredSkillTries(SKILL_CLUB, player:getSkillLevel(SKILL_CLUB) + 1) - player:getSkillTries(SKILL_CLUB))
end
while player:getBaseMagicLevel() < getMinimumLevel("MAGIC") do
player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + 1) - player:getManaSpent())
end
end
end
end
return true
end
warlogin:register()
warconfig
-- The Forgotten [WAR] Server (TFS 1.2 for Tibia 10.77)
-- This server is the successor to The 8.4-8.6 release Simple War OT
-- Credit to Mark Samman & all contributers to The Forgotten Server
-- Credit to Shawak for inspiring this style of configuration
-- Credit to Ninja & Printer for two scripts that I have adapted for the server (individually credited and referenced in the scripts)
startLevel = 120 -- What level do players start at?
maximumLevel = 140 -- What is the maximum level players can reach?
promoteOnLogin = "yes" -- Should players be promoted on login?
fullBlessOnLogin = "yes" -- Should players get full bless on login? This stops them dropping eq.
enableStartSkills = "yes" -- Should players start with preset skills (see lists below)
enableMinimumSkills = "yes" -- Ensures players do not fall below the skills set in this file
enableMinimumLevel = "yes" -- Ensures players do not fall below the minimum level set in this file
giveFirstItems = "yes" -- Should new players receive first items? (see lists below)
potionsInPz = "no" -- Can players use Potions in PZ?
potionsRemoveOnUse = "no" -- Do potions run out?
changeCoins = "no" -- Can players change coins? platinum -> gold etc.
displayStatsOnLogin = "yes" -- Should stats and minimum skills display each login?
expMultiplier = 0.015 -- PVP-E Exp multiplier (enemy experience * expMultiplier)
rewardItem = 2152 -- What is the item ID of the frag reward? (default: 2152 platinum coin)
rewardCount = 1 -- How many of the above item should the killer receive?
bonusFragReward = 5 -- How many bonus frag reward kills should each new player receive?
bonusExpReward = 5 -- How many bonus exp reward kills should each new player receive?
bonusExpMultiplier = 0.0075 -- How much extra exp should players get? (enemy experience * this value)
-- LOGIN MESSAGES
newPlayerMessage = "Welcome to The Forgotten WAR Server. As a new player you have been gifted 5 bonus gold & exp frags! This server is the successor to the popular 'Simple War OT' release. Please note that the server is still in BETA testing."
everyLoginMessage = "Please be aware that this server is still in BETA testing. Report all issues directly to
[email protected] - Thank you"
-- MAP CONFIGURATION
rotateMaps = "no" -- Should the map automatically change? Interval set in globalevents.xml (default 30 minutes)
numberOfMaps = 5 -- Number of maps to rotate between?
startMap = 1 -- Which map should the server start on?
mapChangeText = "The map has been changed! Next change in 30 minutes!"
mapPositions = {
[1] = {x=32369, y=32241, z=7},
[2] = {x=32957, y=32076, z=7},
[3] = {x=32360, y=31782, z=7},
[4] = {x=33217, y=31814, z=8},
[5] = {x=32097, y=32219, z=7},
[6] = {x=1000, y=1000, z=7}
}
----MINIMUM PLAYER STATS---------------------------------------
--ALL PLAYERS--
minimumLevel = 120
minimumLevelUp1 = 140
--SORCERER--
sorcererMagic = 70
sorcererMagicUp1 = 80
sorcererShield = 25
sorcererShieldUp1 = 30
--DRUID--
druidMagic = 70
druidMagicUp1 = 80
druidShield = 25
druidShieldUp1 = 30
--PALADIN--
paladinMagic = 20
paladinMagicUp1 = 25
paladinShield = 70
paladinShieldUp1 = 80
paladinDistance = 95
paladinDistanceUp1 = 105
--KNIGHT--
knightMagic = 9
knightMagicUp1 = 10
knightShield = 85
knightShieldUp1 = 95
knightMelee = 90
KnightMeleeUp1 = 100
----POTION RESTORE---------------------------------------------
smhpL = 60 -- Small health potion. These values are the lowest and highest possible restores.
smhpH = 90
hpL = 125 -- Health potion
hpH = 175
mpL = 75 -- Mana potion
mpH = 125
shpL = 250 -- Strong health potion
shpH = 350
smpL = 115 -- Strong mana potion
smpH = 185
gsphL = 270 -- Great spirit potion (health)
gsphH = 330
gspmL = 130 -- Great spirit potion (mana)
gspmH = 170
ghpL = 425 -- Great health potion
ghpH = 575
gmpL = 150 -- Great mana potion
gmpH = 250
uhpL = 650 -- Ultimate health potion
uhpH = 850
----FIRST ITEMS------------------------------------------------
commonItems = {
---------ALL VOCATIONS---------
{itemid=1988, count=1}, -- backpack
{itemid=2120, count=1}, -- rope
{itemid=5710, count=1}, -- shovel
{itemid=2420, count=1}, -- machete
{itemid=2789, count=10}, -- brown mushrooms
{itemid=2305, count=1}, -- fire bomb rune
{itemid=2261, count=1}, -- destroy field rune
}
firstItems = {
{ ---------SORCERER ITEMS---------
{itemid=2323, count=1}, -- hat of the mad
{itemid=8871, count=1}, -- focus cape
{itemid=7730, count=1}, -- blue legs
{itemid=2195, count=1}, -- boots of haste
{itemid=8902, count=1}, -- spellbook of mind control
{itemid=2187, count=1}, -- wand of inferno
{itemid=2268, count=1}, -- sd
{itemid=2273, count=1}, -- uh
{itemid=7590, count=1}, -- gmp
{itemid=2293, count=1}, -- mw
},
{ ---------DRUID ITEMS---------
{itemid=2323, count=1}, -- hat of the mad
{itemid=8871, count=1}, -- focus cape
{itemid=7730, count=1}, -- blue legs
{itemid=2195, count=1}, -- boots of haste
{itemid=8902, count=1}, -- spellbook of mind control
{itemid=2183, count=1}, -- hailstorm rod
{itemid=2268, count=1}, -- sd
{itemid=2273, count=1}, -- uh
{itemid=7590, count=1}, -- gmp
{itemid=2293, count=1}, -- mw
{itemid=2269, count=1}, -- wg
{itemid=2278, count=1}, -- para
},
{ ---------PALADIN ITEMS---------
{itemid=2493, count=1}, -- demon helmet
{itemid=8891, count=1}, -- paladin armor
{itemid=7730, count=1}, -- blue legs
{itemid=2195, count=1}, -- boots of haste
{itemid=2514, count=1}, -- mastermind shield
{itemid=7368, count=1}, -- assassin stars
{itemid=2268, count=1}, -- sd
{itemid=2273, count=1}, -- uh
{itemid=8472, count=1}, -- gsp
{itemid=7589, count=1}, -- smp
{itemid=7588, count=1}, -- shp
{itemid=2293, count=1}, -- mw
},
{ ---------KNIGHT ITEMS---------
{itemid=2493, count=1}, -- demon helmet
{itemid=2472, count=1}, -- magic plate armor
{itemid=2470, count=1}, -- golden legs
{itemid=2195, count=1}, -- boots of haste
{itemid=2514, count=1}, -- mastermind shield
{itemid=2400, count=1}, -- magic sword
{itemid=7620, count=1}, -- mp
{itemid=7591, count=1}, -- ghp
{itemid=8473, count=1}, -- uhp
{itemid=2273, count=1}, -- uh
{itemid=2293, count=1}, -- mw
}
}
-- PLAYER STORAGES
doubleFragRewardStor = 24021
extraExpStor = 24022
minimumLevelUp1Stor = 24023
sorcererMagicUp1Stor = 24024
sorcererShieldUp1Stor = 24025
druidMagicUp1Stor = 24026
druidShieldUp1Stor = 24027
paladinMagicUp1Stor = 24028
paladinShieldUp1Stor = 24029
paladinDistanceUp1Stor = 24030
knightMagicUp1Stor = 24031
knightShieldUp1Stor = 24032
knightMeleeUp1Stor = 24033
fragStor = 24034
deathStor = 24035
-- GLOBAL STORAGES
currentMap = 34021