Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- quest costumeRefine begin
- state start begin
- -- Params: index[0-4],applyType,applyValue
- function set_attr(index,_appType,_appValue)
- item.set_value(index,_appType,_appValue)
- end
- -- Params: index[0-4] || return: applyType or 0 if null
- function get_attr(index)
- return item.get_attr(index)
- end
- function getRandomBonus()
- local _bonusTable = {{1,7500}, -- Max. HP +7500
- {17,5}, -- Strong against Half Human +5%
- {92,5}, -- Resistance from Half Human +5%
- {20,8}, -- Strong against Mystic +8%
- {19,8}, -- Strong against Orcs +8%
- {22,8}, -- Strong against Devil's +8%
- {18,8}, -- Strong against Animals +8%
- {21,8}, -- Strong against Undead +8%
- {63,5}, -- Strong against Monster +5%
- {95,8}, -- Strong vs Metin Stone +8%
- {16,7}, -- 7% Chance of Piercing Hit
- {15,7}, -- 7% Chance of Critical Hit
- {59,5}, -- 5% Strong against Warrior
- {60,5}, -- 5% Strong against Sura
- {61,5}, -- 5% Strong against Ninja
- {62,5}, -- 5% Strong against Shaman
- {78,5}, -- 5% Warrior Resistance
- {79,5}, -- 5% Sura Resistance
- {80,5}, -- 5% Ninja Resistance
- {81,5} -- 5% Shaman Resistance
- }
- local _rand = math.random(1,table.getn(_bonusTable))
- return _bonusTable[_rand][1], _bonusTable[_rand][2]
- end
- function switchBonus(_bType)
- local _bonusTable = {{1,7500}, -- Max. HP +7500
- {17,5}, -- Strong against Half Human +5%
- {92,5}, -- Resistance from Half Human +5%
- {20,8}, -- Strong against Mystic +8%
- {19,8}, -- Strong against Orcs +8%
- {22,8}, -- Strong against Devil's +8%
- {18,8}, -- Strong against Animals +8%
- {21,8}, -- Strong against Undead +8%
- {63,5}, -- Strong against Monster +5%
- {95,8}, -- Strong vs Metin Stone +8%
- {16,7}, -- 7% Chance of Piercing Hit
- {15,7}, -- 7% Chance of Critical Hit
- {59,5}, -- 5% Strong against Warrior
- {60,5}, -- 5% Strong against Sura
- {61,5}, -- 5% Strong against Ninja
- {62,5}, -- 5% Strong against Shaman
- {78,5}, -- 5% Warrior Resistance
- {79,5}, -- 5% Sura Resistance
- {80,5}, -- 5% Ninja Resistance
- {81,5} -- 5% Shaman Resistance
- }
- local _index
- for i=1,table.getn(_bonusTable) do
- if _bonusTable[i][1] == _bType then
- _index = i
- break
- end
- end
- local _newTable = _bonusTable
- table.remove(_newTable, _index)
- local _rand = math.random(1,table.getn(_newTable))
- return _newTable[_rand][1], _newTable[_rand][2]
- end
- -- Costume Refine system.
- when 20094.take begin
- local vnum = item.get_vnum()
- if vnum < 19000 or vnum > 19500 then
- if vnum < 45220 or vnum > 48369 then -- Ultimi costumi aggiunti: Faction War set from 47959 to 48369
- say_title("Sarto:")
- say("non posso migliorare questo oggetto")
- return
- end
- end
- --local refine_success = vnum + 9
- --local str_len = string.len(tostring(vnum))
- ---for i=1,str_len do
- --if string.sub(vnum,i,i) == '9' and i == str_len then
- if costumeRefine.get_attr(1) == 0 then
- if pc.count_item(710051) == 0 then
- say_title("Sarto:")
- say("")
- say("hai bisogno di questo item")
- say("")
- say_item_vnum(710051)
- return
- end
- say_title("Sarto:")
- say("Vuoi aggiungere un bnus al tuo costume")
- say("")
- say_item_vnum(vnum)
- say("")
- local s = select("Si", "No") if s == 2 then return end
- local _bonusType, _bonusValue = costumeRefine.getRandomBonus()
- pc.remove_item(710051)
- costumeRefine.set_attr(1,_bonusType,_bonusValue)
- say_title("Sarto:")
- say("")
- say_item_vnum(vnum)
- say("bonus aggiunto")
- --say("Bonus: ".._bonusType.." ".._bonusValue)
- return
- end
- if costumeRefine.get_attr(1) > 0 then
- if pc.count_item(710052) == 0 then
- say_title("Sarto:")
- say("")
- say("Hai isogno di un item")
- say("")
- say_item_vnum(710052)
- return
- end
- say_title("Sarto:")
- say("Desideri cambiare bonus al tuo costume?")
- say("")
- say_item_vnum(vnum)
- local s = select("Si", "No") if s == 2 then return end
- local _currBonus = costumeRefine.get_attr(1)
- local _newBonusT, _newBonusV = costumeRefine.switchBonus(_currBonus)
- pc.remove_item(710052)
- costumeRefine.set_attr(1,_newBonusT,_newBonusV)
- say_title("Sarto:")
- say("")
- say_item_vnum(vnum)
- say("Bonus cambiato con successo")
- --say("Bonus: ".._newBonusT.." ".._newBonusV)
- return
- end
- end
- when 20084.chat."Informazioni: migliorare un Costume" begin
- say_title("Sarto:")
- say("Trascina un Costume su di me per migliorarlo.[ENTER]Sui Costumi Migliorati e' possibile aggiungere un bonus.")
- say("")
- say_item_vnum(50367)
- say("Trascinalo di nuovo su di me per aggiungere un bonus, e nuovamente per cambiarlo.")
- say_reward("Ricorda che può fallire")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement