Jump to content

Go-piratia

Administrators
  • Posts

    552
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Go-piratia

  1. --[[ *###########################################################################* # -Boss NPC by 7n6.- # # If used please give credit or I will break your server Kappa. # # (But seriously don't remove credits...) # *###########################################################################* ******************************************************************************************************************************* ############################################################################################################################### ******************************************************************************************************************************* MissionSdk.lua : ActionsProc : elseif actions[i].func == BossRecord.Reload then local ret = BossRecord.Reload(character) ******************************************************************************************************************************* ##################################################Installation################################################################# ******************************************************************************************************************************* This extension requires hook.lua and serialize.lua. Add the above statement to actionsproc in missionsdk.lua. Add an npc with the BossRecordNpc function to any map, make sure to add its name to the BossRecord.Name table. Specify the savepath for the savefile in BossRecord.SavePath ******************************************************************************************************************************* ##################################################Adding more bosses########################################################### ******************************************************************************************************************************* BossRecord.Tracked holds all the bosses being tracked. EG: [885] = {Name = 'Black Dragon SS' , Respawn = 60}, 885 is the ID of the mob Black Dragon SS is the name of the mob 60 is the respawn time (in seconds) of the mob. ******************************************************************************************************************************* ##################################################Notes######################################################################## ******************************************************************************************************************************* If there is more than one of a boss, the system will not work. This is becuase the killing of the second one would reset the timer. I will fix this at some point but it is a low priority. When you are going to close the server, use &lua BossRecord.Clear() before closing it. Originaly this was hooked to Stop(), but due to overflow issues after updateall it isnt anymore. ]] --*******************************************************************************************************************************-- --##################################################Config#######################################################################-- --*******************************************************************************************************************************-- --BossRecord Object BossRecord = {} --Save path for the save file BossRecord.SavePath = GetResPath("script/New Extension/Data/BossLog.txt") --Initial page BossRecord.MessagePage = 1 --Page that begins the list BossRecord.ListPage = 2 --Messages in the npc BossRecord.Messages = { "Showing Stats for ", "Last killed by: ", "Last killed at: ", "Next respawn at: ", "Next Page", "Back", "--------", "Hello, which mob do you want to check?", "I can check boss respawn times for you!", } --table of all boss npc names. Required for the reload function to work. BossRecord.Name = { "Boss NPC" } --Prevents overflow when server is closing. --Makes the clear function only run once BossRecord.ShutDown = false --Table of all mobs being tracked. BossRecord.Tracked = { [789] = {Name = 'Black Dragon' , Respawn = (60*60*24)}, [805] = {Name = 'Barborosa' , Respawn = (60*60*3)}, [807] = {Name = 'Deathsoul Commander' , Respawn = (60*60*3)}, [1109] = {Name = 'Fury Kara' , Respawn = (60*60*24)}, [1105] = {Name = 'Firm Guard' , Respawn = (60*60*24)}, [1117] = {Name = 'Morpheus Abyss Demon' , Respawn = (60*60*24)}, [1113] = {Name = 'Vicous Relic Protector' , Respawn = (60*60*24)}, [776] = {Name = 'Fox Sage' , Respawn = (60*30)}, [855] = {Name = 'Aberrance Blood Pollywog' , Respawn = (60*30)}, [757] = {Name = 'Pirate Captain 008' , Respawn = (60*60)}, [786] = {Name = 'Lizardman Warrior Commander' , Respawn = (60*30)}, [788] = {Name = 'Evil Tribal Chieftian' , Respawn = (60*30)}, } --*******************************************************************************************************************************-- --##################################################NPC functions################################################################-- --*******************************************************************************************************************************-- --NPC function function BossRecordNpc() BossRecord.RefreshTrigger() Talk(BossRecord.MessagePage,BossRecord.Messages[9]) Text(BossRecord.MessagePage,"View Boss List",JumpPage,BossRecord.ListPage) Talk(BossRecord.ListPage,BossRecord.Messages[8]) BossRecord.GenerateList() end --Creates the trigger to reload the npc function BossRecord.RefreshTrigger() InitTrigger() TriggerAction( 1, BossRecord.Reload) TriggerAction( 1, JumpPage,1) Start( GetMultiTrigger(), 1) end --Generates the pages listing the bosses. --7 per page function BossRecord.GenerateList() local page = BossRecord.ListPage local count = 0 local total = 0 for i,v in pairs(BossRecord.Tracked) do total = total + 1 end local pages = math.ceil(total/7) + 2 local Table = table.load(BossRecord.SavePath,"r") for i,v in pairs(BossRecord.Tracked) do if count == 7 then Text(page,BossRecord.Messages[5],JumpPage,page + 1) page = page + 1 Talk(page,BossRecord.Messages[8]) count = 0 end local Status = BossRecord.GetStatus(i) Text(page,v.Name.." "..Status,JumpPage,pages) BossRecord.GeneratePage(pages,i,page,Status) pages = pages + 1 count = count + 1 end end --Returns the status of the boss (dead or alive) function BossRecord.GetStatus(i) local Table = table.load(BossRecord.SavePath,"r") local Status = "Alive" if Table[i] ~= nil and Table[i].Respawn ~= BossRecord.Messages[7] then if BossRecord.SystemTimeNow() < Table[i].Respawn then Status = "Dead" end end return Status end --Generates the stat pages of the boss function BossRecord.GeneratePage(page,i,backPage,Status) local Table = table.load(BossRecord.SavePath,"r") local firstLine = BossRecord.PadString(BossRecord.Messages[1]..BossRecord.Tracked[i].Name) local secondLine = BossRecord.PadString(BossRecord.Messages[2]..Table[i].KilledBy) local thirdLine = BossRecord.PadString(BossRecord.Messages[3]..BossRecord.ConvertTime(Table[i].Time)) local fourthLine = BossRecord.PadString(BossRecord.Messages[4]..BossRecord.ConvertTime(Table[i].Respawn)) if Status == "Alive" then fourthLine = BossRecord.PadString(BossRecord.Messages[4].."Alive") end Talk(page,firstLine..secondLine..thirdLine..fourthLine) Text(page,BossRecord.Messages[6],JumpPage,backPage) end --*******************************************************************************************************************************-- --##################################################Mob Functions################################################################-- --*******************************************************************************************************************************-- --Function runs when a mob dies. --If it is being tracked, records time and killer. function BossRecord.CheckDead(mob,role) local ID = GetChaTypeID(mob) if BossRecord.Tracked[ID] ~= nil then local Table = table.load(BossRecord.SavePath,"r") Table[ID] ={ KilledBy = GetChaDefaultName(role), Time = BossRecord.SystemTimeNow(), Respawn = BossRecord.SystemTimeNow() + BossRecord.Tracked[GetChaTypeID(mob)].Respawn } table.save(Table,BossRecord.SavePath,"w") end end --*******************************************************************************************************************************-- --##################################################Time functions###############################################################-- --*******************************************************************************************************************************-- --Returns the standard unix time function BossRecord.SystemTimeNow() local TimeNow = os.date("*t") local Value = os.time{day = TimeNow.day ,month = TimeNow.month,year = TimeNow.year,hour = TimeNow.hour, min = TimeNow.min,sec = TimeNow.sec} return Value end --Converts time into a readable format. function BossRecord.ConvertTime(Time) if Time == BossRecord.Messages[7] then return Time end return os.date("%c",Time) end --*******************************************************************************************************************************-- --##################################################System functions#############################################################-- --*******************************************************************************************************************************-- --Reloads the npc, updates display function BossRecord.Reload() for i,v in pairs(BossRecord.Name) do NpcInfoReload(v,BossRecordNpc) end end --Pads string to 42 chars. function BossRecord.PadString(str) local Len = string.len(str) local Lines = math.ceil(Len/42) if Len == 42 then return str end if Len < 42 then for i = 1,42-Len do str = str.." " end end return str end --Ensures the mobs are declared in the table function BossRecord.Initial() local CheckTable = io.open(BossRecord.SavePath,"r") if CheckTable~=nil then io.close(CheckTable) else table.save({},BossRecord.SavePath,"w") end local Table = table.load(BossRecord.SavePath,"r") for i,v in pairs(BossRecord.Tracked) do if Table[i] == nil then Table[i] = { KilledBy = BossRecord.Messages[7], Time = BossRecord.Messages[7], Respawn = BossRecord.Messages[7], } end end table.save(Table,BossRecord.SavePath,"w") end BossRecord.Initial() --Function called on server close. --Clears all data, as mobs respawn. --Is not called on updateall, as it doesnt force respawns. function BossRecord.Clear() if BossRecord.ShutDown == false then local Table = table.load(BossRecord.SavePath,"r") for i,v in pairs(Table) do Table[i] = { KilledBy = BossRecord.Messages[7], Time = BossRecord.Messages[7], Respawn = BossRecord.Messages[7], } end table.save(Table,BossRecord.SavePath,"w") BossRecord.ShutDown = true end end --*******************************************************************************************************************************-- --##################################################Hooks########################################################################-- --*******************************************************************************************************************************-- --Hooks --Hook:AddPreHook("Stop",BossRecord.Clear) --Disabled due to issue Hook:AddPreHook("GetExp_PKM",BossRecord.CheckDead)
  2. Go-piratia

    [Lua]VIP

    --[[ *###########################################################################* # -Simple VIP by 7n6.- # # If used please give credit or I will break your server Kappa. # # (But seriously don't remove credits...) # *###########################################################################* ******************************************************************************************************************************* ############################################################################################################################### ******************************************************************************************************************************* Installation: 1) Change VIP.SavePath to your desired save path. 2) Change VIP.State to the state you wish to add to a VIP player 3) Add lines to iteminfo eg: 8967 VIP 10 Seconds n1216 10130016 0 0 0 0 0 0 31 0 0 0 0 0 1 1 1 1 1 0 200 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 AddVIP 0 0 0 0,0 0 0 Use to get VIP 8968 VIP 1 Day n1216 10130016 0 0 0 0 0 0 31 0 0 0 0 0 1 1 1 1 1 0 200 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 AddVIP 0 0 0 0,0 0 0 Use to get VIP 8969 VIP 7 Days n1216 10130016 0 0 0 0 0 0 31 0 0 0 0 0 1 1 1 1 1 0 200 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 AddVIP 0 0 0 0,0 0 0 Use to get VIP 4) Adjust VIP.Items to have the ID of the item as the index, and the time in seconds that the item will add upon use as the value eg : [8967] = 10, Means item 8967 will add 10 seconds to VIP. 5) Load this file with DoFile() ******************************************************************************************************************************* ############################################################################################################################### ******************************************************************************************************************************* ]] --Create VIP object VIP = {} --Declare save path VIP.SavePath = GetResPath("script/New Extension/Data/VIP.txt") --State to add to VIP players VIP.State = 234 --Items to add VIP --[8967] = 10 : means item 8967 when used gives VIP for 10 seconds VIP.Items = { [8967] = 10, [8968] = (60 * 60 * 24), [8969] = (7 * 60 * 60 * 24), } --Function to create the savefile upon first load function VIP.Initial(file) Table = io.open(file,"r") if Table~=nil then io.close(Table) else table.save({},file,"w") end end VIP.Initial(VIP.SavePath) --Item function to add to the VIP time. --If you use a vip item while already vip, it adds to your vip time function AddVIP(role,Item) local PID = GetRoleID(role) local ID = GetItemID(Item) local Time = VIP.Items[ID] local data = table.load(VIP.SavePath,"r") if Time ~= nil then if VIP.CheckVIP(role) == false then data[PID] = VIP.SystemTimeNow() end data[PID] = data[PID] + Time end table.save(data,VIP.SavePath,"w") AttrRecheck(role) end --Function returns true if user is currently vip, false if they are not function VIP.CheckVIP(role) local data = table.load(VIP.SavePath,"r") local PID = GetRoleID(role) if data[PID] == nil or data[PID] <= VIP.SystemTimeNow() then return false else return true end end --Hooked on AttrRecheck, so will check each time players stats update function VIP.AddState(role) if VIP.CheckVIP(role) == true then AddState(role,role,VIP.State,1,0) else if GetChaStateLv ( role , VIP.State ) > 0 then RemoveState ( role , VIP.State ) end end end --Returns systemtime in seconds. function VIP.SystemTimeNow() local TimeNow = os.date("*t") local Value = os.time{day = TimeNow.day ,month = TimeNow.month,year = TimeNow.year,hour = TimeNow.hour, min = TimeNow.min,sec = TimeNow.sec} return Value end Hook:AddPreHook("AttrRecheck",VIP.AddState)
  3. --[[ *###########################################################################* # -Question NPC by 7n6.- # # If used please give credit or I will break your server Kappa. # # (But seriously don't remove credits...) # *###########################################################################* NPC : 198 Questions 1 11 0 217900,279300 217900,279300 0 Argent City 3 0 QuestionNPC 0 MissionSdk.lua: ConditionsTest : elseif conditions[i].func == QuestionNpc.CheckAnswer then local ret = QuestionNpc.CheckAnswer(conditions[i].p1,conditions[i].p2) if ret ~= LUA_TRUE then return LUA_FALSE end elseif conditions[i].func == QuestionNpc.CheckAlreadyAnswered then local ret = QuestionNpc.CheckAlreadyAnswered(character,conditions[i].p1) if ret ~= LUA_TRUE then return LUA_FALSE end elseif conditions[i].func == QuestionNpc.CheckTime then local ret = QuestionNpc.CheckTime(conditions[i].p1) if ret ~= LUA_TRUE then return LUA_FALSE end elseif conditions[i].func == QuestionNpc.CheckLevel then local ret = QuestionNpc.CheckLevel(character,conditions[i].p1) if ret ~= LUA_TRUE then return LUA_FALSE end MissionSdk.lua: ActionProc: elseif actions[i].func == QuestionNpc.ErrorPage then local ret = QuestionNpc.ErrorPage( character) elseif actions[i].func == QuestionNpc.Reload then local ret = QuestionNpc.Reload() ******************************************************************************************************************************* ############################################################################################################################### ******************************************************************************************************************************* Installation and use: Installation: 1) Add the above lines to your MissionSdk.lua 2) Add a NPC on any map. 3) If you change the name of this NPC, change the QuestionNpc.Name table to that NPCs name. 4) If you are adding multiple question NPCs, add each name to the QuestionNpc.Name table. 5) Edit the QuestionNpc.SavePath variable to your desired save path. 6) Load this file using DoFile() Adding a new question: To add a new question, add to the QuestionNpc.Questions table. Each question can have up to 8 possible answers, but only 1 correct answer. Each possible answer can be up to 42 characters long. You can use MinLevel and MaxLevel to change level requirements (also can be left as nil) Update the shown questions: To refresh the questions, call the QuestionNpc.Reload() function. Add questions to an NPC: To add questions to an NPC, use the QuestionNpc.CreateQuestion(int,int) function. The first (int) param is the page the question will be linked from. The second (int) param is the page the question will be on. Remember, you can only have up to 8 questions per page. Reseting players who have already answered: To reset if players have already answered questions, call the QuestionNpc.ClearResults() function. Editing messages: To edit the error or success messages, change the : QuestionNpc.FullBag QuestionNpc.WrongAnswer QuestionNpc.CorrectAnswer QuestionNpc.AlreadyAnswered Variables. Refresh questions automaticly: Set QuestionNpc.RefreshDelay to an integer. This causes questions to refresh after that many seconds. If you want this to also clear records, set QuestionNpc.ClearOnRefresh to true. ******************************************************************************************************************************* ############################################################################################################################### ******************************************************************************************************************************* ]] --QuestionNpc Object QuestionNpc = {} --SavePath for the table to check if a player has answered the question already. QuestionNpc.SavePath = GetResPath("script/New Extension/Data/CharsAlreadyAnswered.txt") --Table to check if a player has answered the question already. QuestionNpc.CharsAlreadyAnswered = {} --Table containing the currently active questions QuestionNpc.ChosenQuestions = {} --Start page for the question NPC QuestionNpc.StartPage = 1 --Stored error message for the player QuestionNpc.Error = "" --Stores time of last refresh QuestionNpc.Time = 0 --The 4 possible error messages. QuestionNpc.FullBag = "Bag is full. Can not answer question." QuestionNpc.WrongAnswer = "Wrong answer!" QuestionNpc.CorrectAnswer = "Correct answer!" QuestionNpc.AlreadyAnswered = "You have already answered this question." --Table containing all Question Npcs names QuestionNpc.Name = {"Questions"} --Initial text from the npc. QuestionNpc.Talk = "Hello. I will ask you a question, and if you answer correctly you win a prize!" --Set a delay in seconds for automaticly refreshing questions. --Doesn't persist after restart (this is intentional, as questions are always refreshed on restart) --Set to 0 to disable. QuestionNpc.RefreshDelay = 0 --Setting this to true will clear question records after a refresh. QuestionNpc.ClearOnRefresh = false --Table containing all questions, answers and prizes. QuestionNpc.Questions = { {MaxLevel = 20 , MinLevel = 5,Question = "17 + 1", Answers = {17,18,19,30,20,19,1,1,1},Answer = 2, Reward = {ID = 2, Amount = 1} }, {MaxLevel = 20 , MinLevel = 5,Question = "What is the capital of England?", Answers = {"London","Ireland","E"},Answer = 1, Reward = {ID = 3, Amount = 1} }, {MaxLevel = 20 , MinLevel = 5,Question = "18 + 1", Answers = {17,18,19},Answer = 3, Reward = {ID = 4, Amount = 1} }, {MaxLevel = 20 , MinLevel = 5,Question = "20 + 1", Answers = {17,18,21},Answer = 3, Reward = {ID = 5, Amount = 1} }, {MaxLevel = 20 , MinLevel = 5,Question = "Who am I?", Answers = {"7n6","Him","You"},Answer = 1, Reward = {ID = 6, Amount = 1} } } --Initially creating file for the table, to avoid server hang if file not found on first run. function QuestionNpc.Initial() Table = io.open(QuestionNpc.SavePath,"r") if Table~=nil then QuestionNpc.CharsAlreadyAnswered = table.load(QuestionNpc.SavePath,"r") io.close(Table) else table.save({},QuestionNpc.SavePath,"w") end end QuestionNpc.Initial() --Npc function. function QuestionNPC() QuestionNpc.RefreshTimer() Talk(QuestionNpc.StartPage,QuestionNpc.Talk) QuestionNpc.CreateQuestion(QuestionNpc.StartPage,2) QuestionNpc.CreateQuestion(QuestionNpc.StartPage,3) QuestionNpc.CreateQuestion(QuestionNpc.StartPage,4) end --Timer to automaticly refresh the questions after X seconds. function QuestionNpc.RefreshTimer() if QuestionNpc.RefreshDelay ~= 0 then InitTrigger() TriggerCondition( 1, QuestionNpc.CheckTime , QuestionNpc.RefreshDelay ) TriggerAction( 1, JumpPage,QuestionNpc.StartPage) TriggerAction( 1, QuestionNpc.Reload) TriggerFailure( 1, JumpPage,QuestionNpc.StartPage) Start( GetMultiTrigger(), 1) end end --Checks the current time against the stored time of last refresh. function QuestionNpc.CheckTime(Seconds) local Time = QuestionNpc.SystemTimeNow() if Time >= (QuestionNpc.Time + Seconds) then QuestionNpc.Time = Time return 1 else return 0 end end --Generates the question page. function QuestionNpc.CreateQuestion(link,page) if QuestionNpc.CheckRemainingQuestions() == false then return end local TotalQuestions = table.getn(QuestionNpc.Questions) local ChosenQuestion = math.random(1,TotalQuestions) while (QuestionNpc.ChosenQuestions[ChosenQuestion] ~= nil) do ChosenQuestion = math.random(1,TotalQuestions) end QuestionNpc.ChosenQuestions[ChosenQuestion] = true Text(link,QuestionNpc.Questions[ChosenQuestion].Question,JumpPage,page) Talk(page,QuestionNpc.Questions[ChosenQuestion].Question) for i,v in pairs(QuestionNpc.Questions[ChosenQuestion].Answers) do InitTrigger() TriggerCondition( 1, QuestionNpc.CheckLevel,ChosenQuestion) TriggerCondition( 1, QuestionNpc.CheckAlreadyAnswered,ChosenQuestion) TriggerCondition( 1, QuestionNpc.CheckAnswer,ChosenQuestion,i) TriggerAction( 1, GiveItem, QuestionNpc.Questions[ChosenQuestion].Reward.ID,QuestionNpc.Questions[ChosenQuestion].Reward.Amount,1) TriggerAction( 1, QuestionNpc.ErrorPage) TriggerFailure( 1, QuestionNpc.ErrorPage) Text(page,v,MultiTrigger,GetMultiTrigger(),1) end end --Prevents a hang if you try to add more questions than you have defined. function QuestionNpc.CheckRemainingQuestions() local TotalQuestions = table.getn(QuestionNpc.Questions) for i,v in pairs(QuestionNpc.Questions) do if QuestionNpc.ChosenQuestions[i] == nil then return true else if i == TotalQuestions then return false end end end end --Checks if the selected answer is correct. function QuestionNpc.CheckAnswer(QuestionID,AnswerID) if QuestionNpc.Questions[QuestionID].Answer == AnswerID then QuestionNpc.Error = QuestionNpc.CorrectAnswer return 1 else QuestionNpc.Error = QuestionNpc.WrongAnswer return 0 end end --Checks that the player is high enough to answer the question. function QuestionNpc.CheckLevel(role,QuestionID) local MaxLevel = QuestionNpc.Questions[QuestionID].MaxLevel local MinLevel = QuestionNpc.Questions[QuestionID].MinLevel local Level = GetChaAttr(role,0) if MaxLevel == nil then MaxLevel = Level end if MinLevel == nil then MinLevel = 0 end if Level > MaxLevel or Level < MinLevel then QuestionNpc.Error = QuestionNpc.MultiLinePadString("You must be between level "..MinLevel.." and "..MaxLevel.." to answer this question.") return 0 end return 1 end --Checks that the user has space for the prize, and hasnt previosuly answered. --Also records an attempt at answering this question. function QuestionNpc.CheckAlreadyAnswered(role,QuestionID) if GetChaFreeBagGridNum ( role ) < 1 then QuestionNpc.Error = QuestionNpc.FullBag return 0 end QuestionNpc.CharsAlreadyAnswered = table.load(QuestionNpc.SavePath,"r") if QuestionNpc.CharsAlreadyAnswered[GetRoleID(role)] == nil then QuestionNpc.CharsAlreadyAnswered[GetRoleID(role)] = {} end if QuestionNpc.CharsAlreadyAnswered[GetRoleID(role)][QuestionID] ~= nil then QuestionNpc.Error = QuestionNpc.AlreadyAnswered return 0 else QuestionNpc.CharsAlreadyAnswered[GetRoleID(role)][QuestionID] = true table.save(QuestionNpc.CharsAlreadyAnswered,QuestionNpc.SavePath,"w") return 1 end end --Display a message to the user, dependant on their input. function QuestionNpc.ErrorPage(role) HelpInfo(role,0,QuestionNpc.Error) end --Clears question records, allowing users to answer the same questions again. function QuestionNpc.ClearResults() QuestionNpc.CharsAlreadyAnswered = table.load(QuestionNpc.SavePath,"r") table.save({},QuestionNpc.SavePath,"w") end --Reload question NPC, changes the displayed questions function QuestionNpc.Reload() QuestionNpc.Time = QuestionNpc.SystemTimeNow() QuestionNpc.ChosenQuestions = {} for i,v in pairs(QuestionNpc.Name) do NpcInfoReload(v,QuestionNPC) end if QuestionNpc.ClearOnRefresh == true then QuestionNpc.ClearResults() end end --Returns the standard Unix time. function QuestionNpc.SystemTimeNow() local TimeNow = os.date("*t") local Value = os.time{day = TimeNow.day ,month = TimeNow.month,year = TimeNow.year,hour = TimeNow.hour, min = TimeNow.min,sec = TimeNow.sec} return Value end --Pads string to 42 chars. function QuestionNpc.PadString(str) local Len = string.len(str) local Lines = math.ceil(Len/42) if Len == 42 then return str end if Len < 42 then for i = 1,42-Len do str = str.." " end end return str end --Pad a string to multiple lines function QuestionNpc.MultiLinePadString (str) local words = split(str, " ") local finalStrings = {} local Lines = 0 finalStrings[Lines] = "" for i,v in words do if string.len(finalStrings[Lines]) + string.len(v) > 42 then finalStrings[Lines] = QuestionNpc.PadString(finalStrings[Lines]) Lines = Lines + 1 finalStrings[Lines] = "" end finalStrings[Lines] = finalStrings[Lines]..v.." " end local finalString = "" for i = 0, Lines do finalString = finalString..finalStrings[i] end return finalString end
  4. В skillinfo.txt заменить навыки покорителя морей на 0213 Tornado 1 4,10;16,10 1,-1 1,-1 1,-1 -1 2 1 0 -1 211,2 1 1 1 800 4 1 0 0 0 0 0 SkillSp_Jf 0 0 0 0 Skill_Jf_End 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SkillCooldown_Jf 1 1 12 -1 100 -1 272 0 0 0,0 0,0 0 -1 -1 0 0 101 -1 273 0 0 0 s0213.tga 0 0 Equip Wind Coral to twirl target up into the air Duration of 3.5s at Level 1. Requires Wind Coral to be equipped. Increases duration by 0.5s per skill level Consumes 27 SP at Level 1. Increases by 2 SP per skill level 0 0214 Lightning Bolt 1 4,10;16,10 1,-1 1,-1 1,-1 -1 2 1 0 -1 210,1 1 1 1 800 4 1 0 0 0 0 0 SkillSp_Lj 0 0 0 0 Skill_Lj_End 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SkillCooldown_Lj 1 1 12 -1 102 2 269 0 0 0,0 0,0 0 -1 -1 0 0 103 -1 270 0 0 0 s0214.tga 0 0 Equip Thunder Coral to strike target with lightning Damage is determined by skill level and Spirit. Requires Thunder Coral to be equiped Consumes 27 SP at Level 1. Increases by 2 SP per skill level 0 0215 Entanglement 1 4,10;16,10 1,-1 1,-1 1,-1 -1 2 1 0 -1 213,5 1 2 2 800 4 1 0 0 0 0 0 SkillSp_Hzcr 0 0 0 0 Skill_Hzcr_End 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SkillCooldown_Hzcr 1 1 7 0 104 -1 275 0 0 0,0 0,0 0 -1 -1 0 0 105 -1 276 0 0 0 s0215.tga 0 0 Uses seaweed to bind and damage target Deals target 5 damage per sec over 6s. Increases damage by 1 point and duration by 2s per skill level Consumes 21 SP at Level 1. Increases by 1 SP per skill level 0 0216 Conch Ray 1 16,10 1,-1 1,-1 1,-1 -1 2 1 0 -1 212,5 1 1 1 600 4 2 0 0 1 0 0 SkillSp_Bkcj 0 0 SkillArea_Line_Bkcj 0 Skill_Bkcj_End 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SkillCooldown_Bkcj 1 1 13 0 106 6,-1 265,266 0,0 0 0,0 0,0 0 -1 -1 0 0 107 2 267 0 0 0 s0216.tga 0 0 Uses Strike Coral to damage targets in a straight line Damage is determined by skill level and Spirit. Requires Strike Coral to be equipped Consumes 23 SP at Level 1. Increases by 3 SP per skill level 0 0217 Tail Wind 1 16,10 1,-1 1,-1 1,-1 -1 2 1 1 -1 213,4 1 2 2 0 2 2 0 0 3 0 0 SkillSp_Sf 0 0 SkillArea_Circle_Sf 0 Skill_Sf_End 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SkillCooldown_Sf 1 1 12 0 108 -1 285 0 0 247,0 0,0 -1 -1 -1 0 0 -1 -1 286 0 0 0 s0217.tga 0 0 Uses Wind Coral to summon wind to boost sailing speed of ships in an area Requires Wind Coral to be equipped Consumes 23 SP at Level 1. Increases by 3 SP per skill level 0 0218 Whirlpool 1 16,10 1,-1 1,-1 1,-1 -1 2 1 0 -1 217,4 1 2 2 1000 5 2 0 0 3 0 SkillArea_State_Xw SkillSp_Xw 0 0 SkillArea_Circle_Xw 0 Skill_Xw_End 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SkillCooldown_Xw 1 1 12 0 110 -1 278 0 0 247,0 0,0 -1 -1 -1 0 0 111 -1 0 0 279 0 s0218.tga 0 0 Creates a whirlpool to decrease movement speed of hostile ships within range Effect increases with each level Consumes 21 SP at Level 1. Increases by 1 SP per skill level 0 0219 Fog 1 16,10 1,-1 1,-1 1,-1 -1 2 1 0 -1 217,2 1 2 2 800 4 2 0 0 3 0 SkillArea_State_Mw SkillSp_Mw 0 0 SkillArea_Circle_Mw 0 Skill_Mw_End 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SkillCooldown_Mw 1 1 12 0 112 -1 281 0 0 247,0 0,0 -1 -1 -1 0 0 -1 -1 282 0 0 0 s0219.tga 0 0 Uses Fog Coral to decrease attack of enemies within range Requires Fog Coral to be equipped Consumes 21 SP at Level 1. Increases by 1 SP per skill level 0 0220 Lightning Curtain 1 16,10 1,-1 1,-1 1,-1 -1 2 1 0 -1 214,8 1 2 3 600 4 2 0 0 3 0 SkillArea_State_Lm SkillSp_Lm 0 0 SkillArea_Circle_Lm 0 Skill_Lm_End 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SkillCooldown_Lm 1 1 12 0 114 -1 288 0 0 247,0 0,0 -1 -1 -1 0 0 115 -1 289 0 290 0 s0220.tga 0 0 Uses Thunder Coral to create a thunderstorm that damages targets in range Effect increases with each level. Requires Thunder Coral to be equipped Consumes 21 SP at Level 1. Increases by 1 SP per skill level 0
  5. В ItemEffect.lua добавляем функцию Tickets = {} Tickets[332] = "Spring Town" Tickets[563] = "Summer Island" Tickets[583] = "Autumn Island" Tickets[2445] = "Caribbean" Tickets[2446] = "Skeletar Isle" Tickets[2447] = "Skeletar Isle" Tickets[2491] = "Naval Isle" Tickets[2844] = "Abaddon 4" Tickets[2883] = "Christmas Village" Tickets[3048] = "Thundoria Castle" Tickets[3049] = "Thundoria Harbor" Tickets[3050] = "Sacred Snow Mountain" Tickets[3051] = "Andes Forest Haven" Tickets[3052] = "Oasis Haven" Tickets[3053] = "Icespire Haven" Tickets[3054] = "Lone Tower Entrance" Tickets[3055] = "Barren Cavern Entrance" Tickets[3056] = "Abandon Mine 2" Tickets[3057] = "Silver Mine 2" Tickets[3058] = "Silver Mine 3" Tickets[3059] = "Lone Tower 2" Tickets[3060] = "Lone Tower 3" Tickets[3070] = "Lone Tower 4" Tickets[3071] = "Lone Tower 5" Tickets[3072] = "Lone Tower 6" Tickets[3073] = "Abandon Mine 1" Tickets[3076] = "Spring Town" Tickets[3141] = "" Tickets[3142] = "" Tickets[3828] = "Thundoria Castle" Tickets[3829] = "Thundoria Harbor" Tickets[3830] = "Sacred Snow Mountain" Tickets[3831] = "Andes Forest Haven" Tickets[3832] = "Oasis Haven" Tickets[3833] = "Icespire Haven" Tickets[3834] = "Lone Tower Entrance" Tickets[3835] = "Barren Cavern Entrance" Tickets[3836] = "Abandon Mine 2" Tickets[3837] = "Silver Mine 2" Tickets[3838] = "Silver Mine 3" Tickets[3839] = "Lone Tower 2" Tickets[3840] = "Lone Tower 3" Tickets[3841] = "Lone Tower 4" Tickets[3842] = "Lone Tower 5" Tickets[3843] = "Lone Tower 6" Tickets[3847] = "Abandon Mine 1" Tickets[4602] = "Argent City" Tickets[4603] = "Shaitan City" Tickets[4604] = "Icicle Castle" Tickets[5619] = "Spring Town" Tickets[5620] = "Summer Island" Tickets[5621] = "Autumn Island" Tickets[5622] = "Caribbean" Tickets[5623] = "Abaddon 4" Tickets[5624] = "Sacred Snow Mountain" Tickets[5625] = "Thundoria Castle" Tickets[6205] = "Winter Island" Tickets[6398] = "Icespire Haven" Tickets[6399] = "Andes Forest Haven" Tickets[6400] = "Thundoria Harbor" Tickets[6401] = "Sacred Snow Mountain" Tickets[6454] = "Abandon Mine 1" Tickets[6455] = "Caribbean" Tickets[7543] = "Astral Isle" Tickets[7656] = "Demonic Dimension Entrance" Tickets[8929] = "Black Dragon Lair 4 Entrance" Tickets_ProhibitedMap = {} Tickets_ProhibitedMap[1] = "garner2" Tickets_ProhibitedMap[2] = "prisonisland" function Ticket(role, Item) local ItemID = GetItemID(Item) if (Hp(role) < Mxhp(role) * 0.5) or (Sp(role) < Mxsp(role) * 0.5) then SystemNotice(role, "You need to have at least half of your max HP and SP to teleport.") UseItemFailed(role) return end if ChaIsBoat(role) == 1 then SystemNotice(role, "Cannot use while sailing!") UseItemFailed(role) return end for j = 1, table.getn(Tickets_ProhibitedMap) do if GetChaMapName(role) == Tickets_ProhibitedMap[j] then SystemNotice(role, "Cannot use a ticket inside this map.") UseItemFailed(role) return end end k = DelBagItem(role, ItemID, 1) if k == 1 then MoveCity(role, Tickets[ItemID]) else UseItemFailed(role) return end end Всем предметам в ItemInfo.txt нужно переписать функцию на Ticket
  6. В variable.lua добавляем: OnlineEvent = false В файл function.lua в функцию cha_timer добавляем: -- Set Hours, Default is 24 hours means 1 day local SetHours = 24 local Level = GetChaAttr(role, ATTR_LV) if OnlineEvent == true and math.mod(now_tick, SetHours * 3600) == 0 and now_tick > 0 and Level > 75 then local Prize = {} -- Put the Item ID Prize[1] = 192 -- Chest of Kylin Prize[2] = 2843 -- Rightful Chest of Black Dragon Prize[3] = 2842 -- Carcass of Death -- Getting in Random local i = math.random(1, 3) -- Add Prize local cha = TurnToCha(role) local ItemName = GetItemName(Prize[i]) GiveItem(cha, 0, Prize[i], 1, 4) -- Send notice to Player SystemNotice(cha, "Congratulations! You have been online for " .. SetHours .. " hours long and you've been awarded a " .. ItemName .. "! #10") end Теперь раз в 24 часа, если он был онлайн все это время и больше 75 уровня, будет получать один из 3х подарков. Скрипт можно поменять и выдавать игроку награда каждые 15 минут и только на определенных картах. Так же можно активировать и деактивировать систему следующим образом. На Gm аккаунте пишем в локальный чат: Для включения &lua_all OnlineEvent = true или Для выключения &lua_all OnlineEvent = false Не забываем это сделать хотя бы на одной карте каждого из GameServer
  7. В iteminfo.txt добавляем xxxx Остановка опыта n0539 10130005 0 0 0 0 0 0 41 0 0 0 0 0 1 1 1 1 99 0 84 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 You wont gain any exp from any mobs with me in your inventory :) 0 В файле resource/scripts/calculate/exp_and_level.lua ищем exp_up = exp_up * EXP_RAID_STATE и выше или ниже добавляем: local checkstone = CheckBagItem( TurnToCha(t[i]), XXXX ) -- ID из Iteminfo.txt if checkstone > 0 then exp_up = 0 SystemNotice ( TurnToCha(t[i]) , "No EXP Stone activated! You obtained no exp from this mob" ) end Теперь если этот предмет находится в инвентаре персонаж не будет получать опыт
  8. Скрипт устанавливает кулдаун на использование предмета. Добавляем в ItemEffect.lua Gyosa = {} function ItemUse_SSSJ ( role , Item ) local name = GetChaDefaultName(role) if Gyosa[name] == nil then Gyosa[name] = { UsedTime = os.time() } end local cooldown = Gyosa[name].UsedTime - os.time() if cooldown > 0 then SystemNotice(role,"Gyoza cooldown on effect wait "..cooldown.." second(s) to use again!") UseItemFailed(role) return end mxhp = GetChaAttr(role,ATTR_MXHP) hp_resume = mxhp * 0.3 hp = hp + hp_resume if hp > mxhp then hp = mxhp end SetCharaAttr(hp, role, ATTR_HP) Gyosa[name].UsedTime = os.time()+10 end
  9. В exp_and_level.lua добавляем следующий код: GetExp_New_original = GetExp_New GetExp_New = function (dead , atk) GetExp_New_original(dead , atk ) custom_GetExp_New(dead,atk) end -- *********************************** -- Kill Modes -- *********************************** function custom_GetExp_New(ignore, dead, atk) local map_name = GetChaMapName (atk) if ValidCha(atk) == 0 then return end local a = Check_Combat_Mod(dead , atk ) -- Player kills Monster if a == 1 then PK_combo (atk,dead) end -- Player kills Player if a == 3 then PK_combo (atk,dead) end end function PK_combo (character,target) local name = GetChaDefaultName(character) -- Lets check if he already have a combo if PlayerCombo[name] ~= nil then -- Lets check if the last combo was less than 5 sec ago local time_bonus = PlayerCombo[name].count if time_bonus > 10 then time_bonus = math.ceil(time_bonus / 3) end if time_bonus > 20 then time_bonus = math.ceil(time_bonus / 7) end if time_bonus > 30 then time_bonus = math.ceil(time_bonus / 10) end local combo_time = 3 + time_bonus if PlayerCombo[name].last < combo_time then -- Increase the Combo count PlayerCombo[name].count = PlayerCombo[name].count + 1 PlayerCombo[name].last = 0 if PlayerCombo[name].count == 10 then AddGold(character,1000) Notice("["..name.."] breaks 10x Combo!") end if PlayerCombo[name].count == 30 then Notice("["..name.."] the combonator!") end if PlayerCombo[name].count == 40 then AddGold(character,10000) Notice("["..name.."] is a comboholic!") end if PlayerCombo[name].count == 100 then AddGold(character,50000) Notice("["..name.."] wow combos don't end!") end if PlayerCombo[name].count == 200 then AddGold(character,500000) Notice("["..name.."] 200X COMBO!!! IMPOSSIBLE! you cheat!") end BickerNotice(character,PlayerCombo[name].count.."x Combo!") else -- Reset the Bonus RemoveComboBonus(character) local highest_combo = GetPlayerCustomData(character,"combo") if highest_combo < PlayerCombo[name].count then SetPlayerCustomData(character,"combo",PlayerCombo[name].count) end -- Reset the Combo PlayerCombo[name] = nil end else -- He has no combos yet we will add one! PlayerCombo[name] = { last = 1, count = 1} end end function PK_combo_timer (character) local name = GetChaDefaultName(character) -- Player has an active Combo if PlayerCombo[name] ~= nil then local time_bonus = PlayerCombo[name].count if time_bonus > 10 then time_bonus = math.ceil(time_bonus / 3) end if time_bonus > 20 then time_bonus = math.ceil(time_bonus / 7) end if time_bonus > 30 then time_bonus = math.ceil(time_bonus / 10) end local combo_time = 3 + time_bonus if PlayerCombo[name].last > combo_time then PlayerCombo[name] = nil else -- increase the timer PlayerCombo[name].last = PlayerCombo[name].last + 1 -- add the Bonus AddComboBonus(character,PlayerCombo[name].count) end else RemoveComboBonus(character) end end function AddComboBonus(character,amount) -- Lets get the old States SetCharaAttr(amount ,character , ATTR_STATEV_MSPD) SetCharaAttr(amount ,character , ATTR_STATEV_ASPD) ALLExAttrSet(character) end function RemoveComboBonus(character) -- Lets get the old States SetCharaAttr(0 ,character , ATTR_STATEV_MSPD) SetCharaAttr(0 ,character , ATTR_STATEV_ASPD) ALLExAttrSet(character) end Данный код как награду выдает бафф. Вы можете по своему усмотрению менять награды за разные пороги убийствах.
  10. Добавляем в iteminfo.txt (не забываем про табуляцию) 7803 Auto Great Snow Dragon Fruit n1484 10130005 0 0 0 0 0 0 58 0 0 0 0 0 1 1 1 1 99 0 50000 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 ItemUse_CJ_longguo 0 0 0 0,0 0,0 0,0 Obtainable from Item Mall. Place it on the 4th slot of the inventory. Raise pet fairy's Strength by 2 upon usage. 7804 Auto Great Icespire Plum n1485 10130005 0 0 0 0 0 0 58 0 0 0 0 0 1 1 1 1 99 0 50000 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 ItemUse_CJ_koumei 0 0 0 0,0 0,0 0,0 Obtainable from Item Mall. Place it on the 4th slot of the inventory. Raise pet fairy's Agility by 2 upon usage. 7805 Auto Great Zephyr Fish Floss n1486 10130005 0 0 0 0 0 0 58 0 0 0 0 0 1 1 1 1 99 0 50000 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 ItemUse_CJ_yusi 0 0 0 0,0 0,0 0,0 Obtainable from Item Mall. Place it on the 4th slot of the inventory. Raise pet fairy's Accuracy by 2 upon usage. 7806 Auto Great Argent Mango n1487 10130005 0 0 0 0 0 0 58 0 0 0 0 0 1 1 1 1 99 0 50000 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 ItemUse_CJ_guopu 0 0 0 0,0 0,0 0,0 Obtainable from Item Mall. Place it on the 4th slot of the inventory. Raise pet fairy's Constitution by 2 upon usage. 7807 Auto Great Shaitan Biscuit n1488 10130005 0 0 0 0 0 0 58 0 0 0 0 0 1 1 1 1 99 0 50000 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 ItemUse_CJ_mibing 0 0 0 0,0 0,0 0,0 Obtainable from Item Mall. Place it on the 4th slot of the inventory. Raise pet fairy's Spirit by 2 upon usage. Добавляем в function.lua в функцию cha_timer local Item_bg1 = GetChaItem(role, 2, 1) local Get_Item_Type1 = GetItemType(Item_bg1) local ItemUse_siliao1 = GetChaItem(role, 2, 3) local ItemUse_siliao_ID1 = GetItemID(ItemUse_siliao1) if Get_Item_Type1 == 59 then local Elf_MEXP = GetItemAttr(Item_bg1, ITEMATTR_MAXENERGY) local Elf_EXP = GetItemAttr(Item_bg1, ITEMATTR_ENERGY) local Num_JLone = GetItemForgeParam(Item_bg1, 1) local Part1_JLone = GetNum_Part1(Num_JLone) if Elf_EXP >= Elf_MEXP and ItemUse_siliao_ID1 == 7803 then --ID Fruit STR local j = TakeItem(role, 0, 7803, 1) if j == 0 then SystemNotice(role, "Deleting of Fruit failed!") else SystemNotice(role, "Automatic Pet Lv Up successful.") Lvup_Str_1(role, Item_Num, Item_bg1) --Great STR end elseif Elf_EXP >= Elf_MEXP and ItemUse_siliao_ID1 == 7804 then --ID Fruit AGI local j = TakeItem(role, 0, 7804, 1) if j == 0 then SystemNotice(role, "Deleting of Fruit failed!") else SystemNotice(role, "Automatic Pet Lv Up successful.") Lvup_Agi_1(role, Item_Num, Item_bg1) --Great AGI end elseif Elf_EXP >= Elf_MEXP and ItemUse_siliao_ID1 == 7805 then --ID Fruit DEX local j = TakeItem(role, 0, 7805, 1) if j == 0 then SystemNotice(role, "Deleting of Fruit failed!") else SystemNotice(role, "Automatic Pet Lv Up successful.") Lvup_Dex_1(role, Item_Num, Item_bg1) --Great DEX(Auto Great Zephyr Fish Floss) end elseif Elf_EXP >= Elf_MEXP and ItemUse_siliao_ID1 == 7806 then --ID Fruit CON local j = TakeItem(role, 0, 7806, 1) if j == 0 then SystemNotice(role, "Deleting of Fruit failed!") else SystemNotice(role, "Automatic Pet Lv Up successful.") Lvup_Con_1(role, Item_Num, Item_bg1) --Great CON end elseif Elf_EXP >= Elf_MEXP and ItemUse_siliao_ID1 == 7807 then --ID Fruit STA local j = TakeItem(role, 0, 7807, 1) if j == 0 then SystemNotice(role, "Deleting of Fruit failed!") else SystemNotice(role, "Automatic Pet Lv Up successful.") Lvup_Sta_1(role, Item_Num, Item_bg1) --Great STA end end end
  11. Добавляем в iteminfo.txt (не забываем про таблуяцию) 7658 Bank Note n1480 10130001 0 0 0 0 0 0 31 0 0 0 0 0 1 1 1 1 99 0 50 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 ItemUse_bank 0 0 0 0,0 0,0 0,0 Opens your Bank 0 7266 Repair Note n0761 10130001 0 0 0 0 0 0 31 0 0 0 0 0 1 1 1 1 99 0 50 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 ItemUse_Repair 0 0 0 0,0 0,0 0,0 Item Used to repair items 0 7267 Forge Stone n0869 10130001 0 0 0 0 0 0 31 0 0 0 0 0 1 1 1 1 99 0 50 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 ItemUse_Forge 0 0 0 0,0 0,0 0,0 Opens Item Forge Screen 0 7268 Fusion Stone n0893 10130001 0 0 0 0 0 0 31 0 0 0 0 0 1 1 1 1 99 0 50 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 ItemUse_Fusion 0 0 0 0,0 0,0 0,0 Opens Item Fusing Screen 0 7269 Apparel Fusion Note n0912 10130001 0 0 0 0 0 0 31 0 0 0 0 0 1 1 1 1 99 0 50 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 ItemUse_Appfuse 0 0 0 0,0 0,0 0,0 Opens Aparel Forging Screen 0 7269 Apparel Upgrade Note n1061 10130001 0 0 0 0 0 0 31 0 0 0 0 0 1 1 1 1 99 0 50 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 ItemUse_Appupg 0 0 0 0,0 0,0 0,0 Opens Apparel Upgrading Screen 0 7270 Gem Extract Note n0931 10130001 0 0 0 0 0 0 31 0 0 0 0 0 1 1 1 1 99 0 50 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 ItemUse_Extract 0 0 0 0,0 0,0 0,0 Opens Gem extracting screen 0 Добавляем в ItemEffect.lua function ItemUse_bank ( role ) OpenBank( role, role ) end function ItemUse_Repair ( role ) OpenRepair( role, role) end function ItemUse_Forge ( role ) OpenForge( role, role ) end function ItemUse_Fusion ( role ) OpenMilling( role, role ) end function ItemUse_AppFuse ( role ) OpenFusion( role, role ) end function ItemUse_Appupg ( role ) OpenUpgrade( role, role ) end function ItemUse_Extract ( role ) OpenGetStone( role, role ) end function ItemUse_bank ( role , Item) OpenBank( role, role ) end Так же можно обвязать различными проверками, запрещая или разрешая использовать данные предметы на определенных локация и под определенными эффектами.
  12. Предмет поменяет форж в между предметами находящимися во 1 и 2 слоте в инвентаре. В iteminfo.txt добавляем (не забываем про табуляцию) 7500 Reforge Card n0386 n0386 10130005 0 0 0 0 0 0 41 0 0 0 0 0 1 1 1 1 99 0 50000000 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 ItemUse_Gem_Transfer 0 0 0 0,0 0 0 Place the forged Equip in 3rd slot and the equip to be reforged on 4th Slot. 0 В Itemeffect.lua добавляем 7500 Reforge Card n0386 n0386 10130005 0 0 0 0 0 0 41 0 0 0 0 0 1 1 1 1 99 0 50000000 -1,-2,-2,-2 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 ItemUse_Gem_Transfer 0 0 0 0,0 0 0 Place the forged Equip in 3rd slot and the equip to be reforged on 4th Slot. 0 function ItemUse_Gem_Transfer ( role , Item ) local Item_One = GetChaItem ( role , 2 , 2 ) local NumOne = GetItemForgeParam ( Item_One , 1 ) local Item_Two = GetChaItem ( role , 2 , 3 ) local NumTwo = GetItemForgeParam ( Item_Two , 1 ) local ItemType_One = GetItemType ( Item_One ) local ItemType_Two = GetItemType ( Item_Two ) local star=0 if ItemType_One ~= 22 and ItemType_Two ~=27 then star = 1 end if ItemType_Two~=27 then if ItemType_One ~= ItemType_Two then SystemNotice( role ,"Type of Equipments dont match!" ) return 0 end elseif ItemType_Two==27 and star == 1 then SystemNotice( role ,"Type of Equipments dont match!" ) return 0 end local i = 0 NumOne = TansferNum ( NumOne ) NumTwo = TansferNum ( NumTwo ) NumOne = SetNum_Part1 ( NumOne , 3 ) i = SetItemForgeParam ( Item_One , 1 , NumOne ) NumTwo = SetNum_Part1 ( NumTwo , 3 ) i = SetItemForgeParam ( Item_Two , 1 , NumTwo ) local ItemOne_Stone = {} local ItemOne_StoneLv = {} local ItemOne_StoneID = {} ItemOne_Stone[0] = GetNum_Part2 ( NumOne ) ItemOne_Stone[1] = GetNum_Part4 ( NumOne ) ItemOne_Stone[2] = GetNum_Part6 ( NumOne ) ItemOne_StoneLv[0] = GetNum_Part3 ( NumOne ) ItemOne_StoneLv[1] = GetNum_Part5 ( NumOne ) ItemOne_StoneLv[2] = GetNum_Part7 ( NumOne ) ItemOne_StoneID[0] = StoneTpye_ID[ItemOne_Stone[0]] ItemOne_StoneID[1] = StoneTpye_ID[ItemOne_Stone[1]] ItemOne_StoneID[2] = StoneTpye_ID[ItemOne_Stone[2]] NumTwo = SetNum_Part2 ( NumTwo , ItemOne_Stone[0] ) NumTwo = SetNum_Part3 ( NumTwo , ItemOne_StoneLv[0] ) NumTwo = SetNum_Part4 ( NumTwo , ItemOne_Stone[1] ) NumTwo = SetNum_Part5 ( NumTwo , ItemOne_StoneLv[1] ) NumTwo = SetNum_Part6 ( NumTwo , ItemOne_Stone[2] ) NumTwo = SetNum_Part7 ( NumTwo , ItemOne_StoneLv[2] ) SetItemForgeParam ( Item_Two , 1 , NumTwo ) NumOne = SetNum_Part2 ( NumOne , 0 ) NumOne = SetNum_Part3 ( NumOne , 0 ) NumOne = SetNum_Part4 ( NumOne , 0 ) NumOne = SetNum_Part5 ( NumOne , 0 ) NumOne = SetNum_Part6 ( NumOne , 0 ) NumOne = SetNum_Part7 ( NumOne , 0 ) SetItemForgeParam ( Item_One , 1 , NumOne ) SystemNotice( role ,"Reforge Successful!" ) end
  13. В iteminfo.txt добавляем (не забываем ставить табуляцию) 7000 Buff Ticket n1481 10130001 0 0 0 0 0 00 31 0 0 0 0 0 1 1 1 1 99 0 200 -1 0 -1 0 0 -1 -1 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0 0,0 0,0 0 0 0 0 0 0 0 0 0 ItemUse_buffticket 0 0 0 0 0 0 Double click to get all buffs in 5 minutes. В ItemEffect.lua добавляем функцию предмета: function ItemUse_buffticket( role , Item ) local Cha_Boat = GetCtrlBoat(role) if Cha_Boat ~= nil then SystemNotice(role , "Not usable on the sea." ) UseItemFailed (role) return end local buff1 = GetChaStateLv(role,STATE_SHPF) -- STATE_SHPF идентификатор из skilleff.txt local buff2 = GetChaStateLv(role,STATE_XLZH) -- STATE_XLZH идентификатор из skilleff.txt local buff3 = GetChaStateLv(role,STATE_TSHD) -- STATE_TSHD идентификатор из skilleff.txt local buff4 = GetChaStateLv(role,STATE_FZLZ) -- STATE_FZLZ идентификатор из skilleff.txt local buff5 = GetChaStateLv(role,STATE_MLCH) -- STATE_MLCH идентификатор из skilleff.txt if buff1 >= 1 or buff2 >= 1 or buff3 >= 1 or buff4 >= 1 or buff5 >= 1 then SystemNotice(role,"Only you can use this ticket after duration of buffs end.") UseItemFailed(role) return end local del_item = DelBagItem( role , 7000 , 1 ) if del_item == 1 then AddState ( role , role , STATE_SHPF , 10 , 600 ) -- STATE_SHPF идентификатор из skilleff.txt, 10 - уровень бафа, 600 время в секундах AddState ( role , role , STATE_XLZH , 10 , 600 ) AddState ( role , role , STATE_TSHD , 10 , 600 ) AddState ( role , role , STATE_FZLZ , 10 , 600 ) AddState ( role , role , STATE_MLCH , 10 , 600 ) BickerNotice( role , "You recived Harden, Spiritual Fire, Tempest Bolt, Angelic Shield, Intense Magic for 5 minutes!" ) end end
  14. --[[ *###########################################################################* # -Auction NPC by 7n6.- # # If used please give credit or I will break your server Kappa. # # (But seriously don't remove credits...) # *###########################################################################* NpcSdk.lua: MsgProc : elseif item.func == Bidding.Bid then return Bidding.Bid(character, item.p1) elseif item.func == Bidding.ClaimOwed then return Bidding.ClaimOwed(character) MissionSdk.lua: ActionsProc : elseif actions[i].func == Bidding.Reload then local ret = Bidding.Reload() Example NPC line: 195 Bidding 1 262 0 220300,270100 220300,270100 180 Argent City 3 0 BiddingNPC 0 ******************************************************************************************************************************* ############################################################################################################################### ******************************************************************************************************************************* Installation and use: Installation: 1) Add the above lines to your MissionSdk.lua and NpcSdk.lua 2) Add a NPC on any map. 3) If you change the name of this NPC, change the Bidding.Name table to that NPCs name. 4) If you are adding multiple auction NPCs, add each name to the Bidding.Name table. 5) Edit the Bidding.SavePath and Bidding.OwedSavePath variable to your desired save paths. 6) Edit Bidding.TimeZone to be your timezone, relative to UTC. 7) If you do not have a GS with GetGmLv, edit the IsGM table to contain the ID and gm level of your GM chars. 8) This extension requires serialize. 9) Load this file using DoFile() Adding a new auction: The Bidding.Add(role,message) allows a GM to add a new auction. It is designed to be used with a chat handler. An example command is as follows: (/addnewitem is just an example) /AddNewItem new 1 2 100 1000 14652551231 new_Item_Innit This would create an auction called "new" where you would bid on 2 short swords( id = 1). The starting price would be 100, and each bid costs 1000 on top of that. The bid would end at 14652551231, which is 04/27/2434 @ 5:07pm See http://www.unixtimestamp.com/index.php for conversion into Unix time. The description of this item would be new Item Innit. You can also add multiple items in one auction: /AddNewItem new 1,2,3 2,3,3 100 1000 14652551231 newItemInnit This would give you 2x 1, 3x 2 and 3x 3. Please ensure you fill out a quantity for each item, to prevent bugs. User guide: Placing a bid: Talk to the NPC. Click "View current auctions" Click on the auction you wish to partake in. Click "Place bid" This will take an amount of gold away from you. Claiming auction prize or gold back: Talk to the NPC Click "claim back gold or items". The gold or items will be added to your bag. Notes: General Info: Persists over updateall. Persists over server restart. To do: Allow use of attributes on item Display attributes of item on auction ******************************************************************************************************************************* ############################################################################################################################### ******************************************************************************************************************************* ]] --Create bidding object Bidding = {} --Declare savepath for table of active bids. Bidding.SavePath = GetResPath("script/New Extension/Data/Bid.txt") --Declare savepath for table of owed items/gold Bidding.OwedSavePath = GetResPath("script/New Extension/Data/BidItems.txt") --Declare NPC names, required for reload function Bidding.Name = {"Bidding"} --Declare timezone relative to UTC. Bidding.TimeZone = -1 --Start page for the NPC Bidding.Start = 1 --Start of the list for NPC Bidding.ListPageStart = 2 --Toggle claim functionality. --true = if you dont win, you can claim back gold used to bid --false = no claims on the gold. Bidding.AllowGoldClaim = true --Table of messages from NPC. Bidding.Messages = { "Here you can place a bid on these items!", "Auction for: ", "Current Bid: ", "Bidding Increment: ", "Place Bid", "Bidding ends at: ", "You do not have enough gold to bid.", "Bid placed sucessfully.", "Current top bidder: ", "You are already the top bidder.", "Description: ", "View current auctions", "Claim back gold or items", "Next Page", "Bidding has already ended.", "You are not owed any gold.", "Gold is saturated. Unable to claim gold.", "--------", "Bag is full, but you have more items to claim", "You are not owed any items.", "Bid $X gold.", "Recieved $X gold.", "Contains: ", } --This function is only needed if you do not have the GetGmLv function on your GS. if GetGmLv == nil then print("Simple GetGmLv() loaded.") IsGM = { [1095] = 99, } function GetGmLv(role) local PID = GetRoleID(role) if IsGM[PID] ~= nil then return IsGM[PID] else return 0 end end end --Initial function to create empty tables. function Bidding.Initial() Table = io.open(Bidding.SavePath,"r") Table2 = io.open(Bidding.OwedSavePath,"r") if Table~=nil then io.close(Table) else table.save({},Bidding.SavePath,"w") end if Table2~=nil then io.close(Table2) else table.save({},Bidding.OwedSavePath,"w") end end Bidding.Initial() --NPC function. function BiddingNPC() Bidding.ReloadTrigger() Talk(Bidding.Start,Bidding.Messages[1]) Text(Bidding.Start,Bidding.Messages[12],JumpPage,Bidding.ListPageStart) Text(Bidding.Start,Bidding.Messages[13],Bidding.ClaimOwed) Bidding.GenerateList() end --Trigger for refreshing the NPC --Updates prices, bidders, etc function Bidding.ReloadTrigger() InitTrigger() TriggerAction( 1, JumpPage,Bidding.Start) TriggerAction( 1, Bidding.Reload) Start( GetMultiTrigger(), 1) end --Generates the list of active auctions function Bidding.GenerateList() local Bids = table.load(Bidding.SavePath,"r") local ListPages = math.ceil(table.getn(Bids)/7) local ItemPage = Bidding.ListPageStart + ListPages local page = Bidding.ListPageStart for i,v in pairs(Bids) do if math.mod(i,8) == 0 then Text(page,Bidding.Messages[14],JumpPage,page + 1) page = page + 1 end Text(page,v.Name.." "..Bidding.Messages[3]..v.Cost,JumpPage,ItemPage) Talk(ItemPage,Bidding.GenerateText(v)) Text(ItemPage,Bidding.Messages[5], Bidding.Bid,i) ItemPage = ItemPage + 1 end end --Generates the text for the page of an auction. --Uses messages from the messages table. function Bidding.GenerateText(v) local msg = Bidding.PadString(Bidding.Messages[2]..v.Name)..Bidding.PadString(Bidding.Messages[3]..v.Cost)..Bidding.PadString(Bidding.Messages[4]..v.Increment) msg = msg..Bidding.PadString(Bidding.Messages[6]..os.date("%c",v.Time))..Bidding.PadString(Bidding.Messages[9]..v.Bidder) msg = msg..Bidding.MultiLinePadString(Bidding.Messages[11]..v.Description)..Bidding.PadString("") msg = msg..Bidding.PadString(Bidding.Messages[23]) for j,k in pairs(v.Items) do msg = msg..Bidding.PadString(v.Quantitys[j].."x "..GetItemName(k)) end return msg end --function for a user to place a bid on an item function Bidding.Bid(role,ID) if ChaIsBoat ( role ) == 1 then return end local Bids = table.load(Bidding.SavePath,"r") local cost = Bids[ID].Cost + Bids[ID].Increment local gold = GetChaAttr(role,8) if Bidding.SystemTimeNow() >= Bids[ID].Time then SystemNotice(role,Bidding.Messages[15]) elseif gold < cost then SystemNotice(role,Bidding.Messages[7]) elseif GetChaDefaultName(role) == Bids[ID].Bidder then SystemNotice(role,Bidding.Messages[10]) else gold = gold - cost SetCharaAttr(gold ,role , 8) Bidding.AddOwedGold(Bids[ID].Bidder,Bids[ID].Cost) Bids[ID].Cost = cost Bids[ID].Bidder = GetChaDefaultName(role) table.save(Bids,Bidding.SavePath,"w") SystemNotice(role,Bidding.Messages[8]) local msg = string.gsub(Bidding.Messages[21],"$X",cost) SystemNotice(role,msg) RefreshCha(role) Bidding.Reload() end end --Function called for the user to claim back gold --Also claims won items function Bidding.ClaimOwed(role) if ChaIsBoat ( role ) == 1 then return end if Bidding.AllowGoldClaim == true then Bidding.ClaimOwedGold(role) end Bidding.ClaimItems(role) end --Claims gold used to bid on an item the user didnt win. function Bidding.ClaimOwedGold(role) local name = GetChaDefaultName(role) local Owed = table.load(Bidding.OwedSavePath,"r") local gold = GetChaAttr(role,8) if Owed[name] == nil or Owed[name].Gold == 0 then SystemNotice(role,Bidding.Messages[16]) elseif gold == 2000000000 then SystemNotice(role,Bidding.Messages[17]) else local givenGold = math.min(2000000000 - gold,Owed[name].Gold) Owed[name].Gold = Owed[name].Gold - givenGold table.save(Owed,Bidding.OwedSavePath,"w") SetCharaAttr(givenGold ,role , 8) RefreshCha(role) local msg = string.gsub(Bidding.Messages[22],"$X",givenGold) SystemNotice(role,msg) end end --Claims items won on the auction function Bidding.ClaimItems(role) local name = GetChaDefaultName(role) local Owed = table.load(Bidding.OwedSavePath,"r") if table.getn(Owed[name].Items) == 0 then SystemNotice(role,Bidding.Messages[20]) end for i,v in pairs(Owed[name].Items) do if GetChaFreeBagGridNum(role) > 0 then for j,k in pairs(v.Items) do GiveItem(role,0,k,Owed[name].Items[i].Quantitys[j],4) end table.remove(Owed[name].Items,i) else SystemNotice(role,Bidding.Messages[19]) break end end table.save(Owed,Bidding.OwedSavePath,"w") end --Assign an expired auction to a user, and remove it from the list. --Function is called on reload. function Bidding.AssignExpiredItems() local Bids = table.load(Bidding.SavePath,"r") for i,v in pairs(Bids) do if v.Time <= Bidding.SystemTimeNow() then if v.Bidder ~= Bidding.Messages[18] then Bidding.AddOwedItem(v) end table.remove(Bids,i) end end table.save(Bids,Bidding.SavePath,"w") end --Add the expired item to the user. function Bidding.AddOwedItem(v) local Owed = table.load(Bidding.OwedSavePath,"r") if Owed[v.Bidder] == nil then Owed[v.Bidder] = { Gold = 0, Items = {}, } end table.insert(Owed[v.Bidder].Items,v) table.save(Owed,Bidding.OwedSavePath,"w") end --Add an amount of gold to a users owed gold table function Bidding.AddOwedGold(name,amount) if name == Bidding.Messages[18] then return end local Owed = table.load(Bidding.OwedSavePath,"r") if Owed[name] == nil then Owed[name] = { Gold = amount, Items = {}, } else Owed[name].Gold = amount + Owed[name].Gold end table.save(Owed,Bidding.OwedSavePath,"w") end --Admin function to create a new auction. --If you do not have a gameserver with GetGmLv, create a function to check if the players name is the name of the admin. function Bidding.Add(role,message) if GetGmLv(role) ~= 99 then SystemNotice(role,"ERROR") return end local Bids = table.load(Bidding.SavePath,"r") local words = split(message," ") local NewBid = { Name = string.gsub(words[2],"_"," "), Items = split(words[3],","), Quantitys = split(words[4],","), Cost = math.floor(tonumber(words[5])), Increment = math.floor(tonumber(words[6])), Time = math.floor(tonumber(words[7])), Description = string.gsub(words[8],"_"," "), Bidder = Bidding.Messages[18], } table.insert(Bids,NewBid) table.save(Bids,Bidding.SavePath,"w") Bidding.Reload() end --Reload the NPC, to refresh prices etc function Bidding.Reload() Bidding.AssignExpiredItems() for i,v in pairs(Bidding.Name) do NpcInfoReload(v,BiddingNPC) end end --Pads string to 42 chars. function Bidding.PadString(str) local Len = string.len(str) local Lines = math.ceil(Len/42) if Len == 42 then return str end if Len < 42 then for i = 1,42-Len do str = str.." " end end return str end --pad a multiline string function Bidding.MultiLinePadString (str) local words = split(str, " ") local count = table.getn(words) local finalStrings = {} local Lines = 0 finalStrings[Lines] = "" for i,v in words do if string.len(finalStrings[Lines]) + string.len(v) > 42 then finalStrings[Lines] = Bidding.PadString(finalStrings[Lines]) Lines = Lines + 1 finalStrings[Lines] = "" end finalStrings[Lines] = finalStrings[Lines]..v.." " if i == count then finalStrings[Lines] = Bidding.PadString(finalStrings[Lines]) end end local finalString = "" for i = 0, Lines do finalString = finalString..finalStrings[i] end return finalString end --Returns the standard unix time, adjusted to timezone function Bidding.SystemTimeNow() local TimeNow = os.date("*t") local Value = os.time{day = TimeNow.day ,month = TimeNow.month,year = TimeNow.year,hour = TimeNow.hour, min = TimeNow.min,sec = TimeNow.sec} return Value + (3600 * Bidding.TimeZone) end
  15. Пример сундука с аппарелями function zodiac_aries ( role , Item ) local Item_CanGet = GetChaFreeBagGridNum ( role ) if Item_CanGet < 4 then SystemNotice(role ,"To open a Aries Apparel Chest requires at least 4 empty inventory slots") UseItemFailed ( role ) return end local cha_type = GetChaTypeID ( role ) -- GetRace if cha_type == 1 then --Lance GiveItem ( role , 0 , 5341 , 1 , 4 ) GiveItem ( role , 0 , 5342 , 1 , 4 ) GiveItem ( role , 0 , 5343 , 1 , 4 ) elseif cha_type == 2 then -- Carsise GiveItem ( role , 0 , 5345 , 1 , 4 ) GiveItem ( role , 0 , 5346 , 1 , 4 ) GiveItem ( role , 0 , 5347 , 1 , 4 ) elseif cha_type == 3 then --Phyllis GiveItem ( role , 0 , 5349 , 1 , 4 ) GiveItem ( role , 0 , 5350 , 1 , 4 ) GiveItem ( role , 0 , 5351 , 1 , 4 ) elseif cha_type == 4 then --Ami GiveItem ( role , 0 , 5352 , 1 , 4 ) GiveItem ( role , 0 , 5353 , 1 , 4 ) GiveItem ( role , 0 , 5354 , 1 , 4 ) GiveItem ( role , 0 , 5355 , 1 , 4 ) end end Пример сундука с случайной наградой function Random_Item ( role , Item ) local Item_CanGet = GetChaFreeBagGridNum ( role ) if Item_CanGet < 1 then SystemNotice(role ,"To open a Random Chest requires at least 1 empty inventory slots") UseItemFailed ( role ) return end local rand = math.random(1,3) if rand == 1 then GiveItem ( role , 0 , 7555 , 1 , 4) end if rand == 2 then GiveItem ( role , 0 , 7556 , 1 , 4) end if rand == 3 then GiveItem ( role , 0 , 7557 , 1 , 4) end end Более интересный пример создания сундука с случайной наградой function ItemUse_RandomItemChest ( role , Item ) ---------- Random item chest local Cha_Boat = GetCtrlBoat ( role ) if Cha_Boat ~= nil then SystemNotice( role , "Cannot use while sailing" ) UseItemFailed ( role ) return end local Item_CanGet = GetChaFreeBagGridNum ( role ) if Item_CanGet < 2 then SystemNotice(role ,"You don't have enough slots") UseItemFailed ( role ) return end -- Giving random item's when opening Chest, list them below local Item = {} Item[1] = 2792 -- Flash Bomb Lv5 Item[2] = 2794 -- Soul Detector Lv5 Item[3] = 1860 -- Blessed Potion -- The range is (1,3) at the moment, if you add more like 10 item, make it (1,10) so counts random for that and so on local i = math.random(1,Item.n) -- <-- range for the above item GiveItem(role,0,Item[i],1,4) end
  16. Создаем функцию в function.lua function AddReputation(role,amount) local playerReputation = GetChaAttr(role, ATTR_FAME) playerReputation = playerReputation + amount SetCharaAttr(playerReputation, role, ATTR_FAME) SystemNotice(role,"You've recieved "..amount.." reputation! ["..playerReputation.."]") end В MissionSdk.lua находим блок похожий c elseif actions.func == и добавляем свое условие. elseif actions[i].func == AddReputation then PRINT( "ActionProc:AddReputation, p1 = ", actions[i].p1 ) AddReputation( character, actions[i].p1 ) В самом задании используем следующим образом MisResultAction(AddReputation,1000) -- Give 1k rep
  17. Первое видео мобильной пиратии от российской команды Magicsea. https://t.me/magicsea_online/86
  18. Выставить навык или сменить его на колесе навыков стало еще легче, небольшая переработка окна навыков

Chat

Chat

Please enter your display name

×
×
  • Create New...