samandriel
Active Member
- Joined
- Oct 19, 2016
- Messages
- 242
- Solutions
- 1
- Reaction score
- 46
I'm trying to make Dawnport possible in my 8.60 server, it's already working, changing vocation, giving items...
But there is a big problem, player can switch to sorcerer, get ML high and back to knight and be OP, same to mages, can get a big shielding and can change vocation.
Is anybody know how to convert ML/SKILLS when players change vocation in dawnport tile?
But there is a big problem, player can switch to sorcerer, get ML high and back to knight and be OP, same to mages, can get a big shielding and can change vocation.
Is anybody know how to convert ML/SKILLS when players change vocation in dawnport tile?
Code:
local tile = {
--[actionid] = {vocation id}
[65530] = {
vocid = 1,
weaponID = 2190, -- wand of vortex
extraItems = {
{itemID = 2287, count = 30}, -- lmm
{itemID = 2302, count = 15} -- FIREBALL
}
},
[65529] = {
vocid = 2,
weaponID = 2182, -- snakebite rod
extraItems = {
{itemID = 2287, count = 30}, -- lmm
{itemID = 2265, count = 5}, -- IH
{itemID = 2302, count = 10} -- FIREBALL
}
},
[65528] = {
vocid = 3,
weaponID = 2456, -- bow
extraItems = {
{itemID = 2544, count = 100}, -- arrows
{itemID = 2389, count = 3}, -- spear
{itemID = 2265, count = 5}, -- IH
{itemID = 2287, count = 5}, -- LMM
{itemID = 2302, count = 5} -- FIREBALL
}
},
[65527] = {
vocid = 4,
extraItems = {
{itemID = 2379, count = 1}, -- sword
{itemID = 2382, count = 1}, -- axe
{itemID = 2380, count = 1}, -- club
{itemID = 2265, count = 10} -- IH
}
}
}
function onStepIn(cid, item, position, fromPosition)
local r = tile[item.actionid]
if not r then
return true
end
local townid = 7
local pos = {x= 392, y=929, z=6}
local needcap
local extralvls = getPlayerLevel(cid) - 1
local vocation
local cap
local hp
local mp
if item.actionid == 65530 then -- sorc
doPlayerSetVocation(cid, 1)
needcap = 88
hp = (185) + (extralvls * 5)
mp = (35) + (extralvls * 30)
cap = (400) + (extralvls * 10)
-- convert ML and SKILLS
elseif item.actionid == 65529 then -- druid
doPlayerSetVocation(cid, 2)
needcap = 91
hp = (185) + (extralvls * 5)
mp = (35) + (extralvls * 30)
cap = (400) + (extralvls * 10)
-- convert ML and SKILLS
elseif item.actionid == 65528 then -- pally
doPlayerSetVocation(cid, 3)
needcap = 122
hp = (185) + (extralvls * 10)
mp = (35) + (extralvls * 15)
cap = (400) + (extralvls * 20)
-- convert ML and SKILLS
elseif item.actionid == 65527 then -- kina
doPlayerSetVocation(cid, 4)
needcap = 44
hp = (185) + (extralvls * 15)
mp = (35) + (extralvls * 5)
cap = (400) + (extralvls * 25)
-- convert ML and SKILLS
end
-- add stuff
setCreatureMaxHealth(cid, hp)
setCreatureMaxMana(cid, mp)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
doTeleportThing(cid, pos)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doPlayerSetTown(cid, townid)
doPlayerSetMaxCapacity(cid, cap)
-- add items
-- already recived
local queststatus = getPlayerStorageValue(cid, item.actionid)
if queststatus ~= -1 then
return true
end
-- dont have cap
if getPlayerFreeCap(cid) < needcap then
doTeleportThing(cid, fromPosition, false)
doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
doPlayerPopupFYI(cid, 'You need '.. needcap ..' OZ CAP to recive the items!')
return true
end
-- add items
-- weapon first
if r.weaponID then
doPlayerAddItem(cid, r.weaponID, 1)
end
-- other stuffs
if r.extraItems then
for i=1,#r.extraItems do
local item,count = r.extraItems[i].itemID, r.extraItems[i].count
doPlayerAddItem(cid, item, count)
end
end
setPlayerStorageValue(cid,item.actionid,1)
return true
end