Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function PlayerRebirth(Player, Level, Class)
- local PlayerName = GetChaDefaultName(Player)
- LG("Player Rebirth", "")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Starting Rebirth.")
- local RB_Var = {}
- RB_Var.Class = {}
- RB_Var.Class[8] = 455
- RB_Var.Class[9] = 453
- RB_Var.Class[12] = 456
- RB_Var.Class[13] = 458
- RB_Var.Class[14] = 457
- RB_Var.Class[16] = 454
- local CharType = GetChaTypeID(Player)
- -- Checking in they have their equipment off.
- if IsEquip(Player) == LUA_TRUE then
- SystemNotice(Player, "You must remove your equipment.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Equipment OFF = FALSE.")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Equipment OFF = TRUE")
- -- Checking if their inventory is not locked.
- if KitbagLock(Player, 0) ~= LUA_TRUE then
- SystemNotice(Player, "Your inventory must be unlocked.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Inventory Locked = TRUE")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Inventory Locked = FALSE")
- -- Checking if they have at least 5 free inventory slots.
- if GetChaFreeBagGridNum(Player) < 5 then
- SystemNotice(Player, "You must have 5 slots free for Rebirth.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Free Inventory Slots = FALSE")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Free Inventory Slots = TRUE")
- -- Lets see if they meet the character type for their desired class.
- if Class == 8 then
- if CharType ~= 2 then
- SystemNotice(Player, "Only Carsise can become Champion.")
- return 0
- end
- elseif Class == 9 then
- if CharType ~= 1 then
- SystemNotice(Player, "Only Lance can become Crusader.")
- return 0
- end
- elseif Class == 12 then
- if CharType == 2 or CharType == 4 then
- SystemnNotice(Player, "Only Lance and Phyllis can become Sharpshooter.")
- return 0
- end
- elseif Class == 13 then
- if CharType == 1 or CharType == 2 then
- SystemnNotice(Player, "Only Ami and Phyllis can become Cleric.")
- return 0
- end
- elseif Class == 14 then
- if CharType == 1 or CharType == 2 then
- SystemnNotice(Player, "Only Ami and Phyllis can become Seal Master.")
- return 0
- end
- elseif Class == 16 then
- if CharType == 2 then
- SystemNotice(Player, "Only Lance, Phyllis and Ami can become Voyager.")
- return 0
- end
- end
- -- Lets see more specific requirements.
- if Level == 1 then
- if GetChaAttr(Player, ATTR_CSAILEXP) ~= 0 then
- SystemNotice(Player, "You are already have done Rebirth.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Before = TRUE")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Before = FALSE")
- if CheckBagItem(Player, 2235) < 1 then
- SystemNotice(Player, "You do not have Rebirth Stone.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Stone = FALSE")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Stone = TRUE")
- if TakeItem(Player, 0, 2235, 1) == 0 then
- SystemNotice(Player, "Failed to remove Rebirth Stone, please check again.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Stone Taken = FALSE")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Stone Taken = TRUE")
- elseif Level == 2 then
- if GetChaAttr(Player, ATTR_CSAILEXP) < 9500 then
- SystemNotice(Player, "You need at least 9500 SEXP to do Second Rebirth.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Low SEXP = TRUE")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Low SEXP = FALSE")
- if GetChaAttr(Player, ATTR_CSAILEXP) >= 10000 then
- SystemNotice(Player, "You already have done Second Rebirth.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: High SEXP = TRUE")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: High SEXP = FALSE")
- if CheckBagItem(Player, 5765) < 1 then
- SystemNotice(Player, "You do not have Rebirth Stone.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Stone = FALSE")
- return 0
- end
- if CharType == 1 then
- if CheckBagItem(Player, 134) == 0 then
- SystemNotice(Player, "You do not have Rebirth Wings in your inventory.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings = FALSE")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings = TRUE")
- if TakeItem(Player, 0, 134, 1) == 0 then
- SystemNotice(Player, "Failed to remove Rebirth Wings, please check again.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings Taken = FALSE")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings Taken = TRUE")
- elseif CharType == 2 then
- if CheckBagItem(Player, 138) == 0 then
- SystemNotice(Player, "You do not have Rebirth Wings in your inventory.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings = FALSE")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings = TRUE")
- if TakeItem(Player, 0, 138, 1) == 0 then
- SystemNotice(Player, "Failed to remove Rebirth Wings, please check again.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings Taken = FALSE")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings Taken = TRUE")
- elseif CharType == 3 then
- if CheckBagItem(Player, 128) == 0 then
- SystemNotice(Player, "You do not have Rebirth Wings in your inventory.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings = FALSE")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings = TRUE")
- if TakeItem(Player, 0, 128, 1) == 0 then
- SystemNotice(Player, "Failed to remove Rebirth Wings, please check again.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings Taken = FALSE")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings Taken = TRUE")
- elseif CharType == 4 then
- if CheckBagItem(Player, 131) == 0 then
- SystemNotice(Player, "You do not have Rebirth Wings in your inventory.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings = FALSE")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings = TRUE")
- if TakeItem(Player, 0, 131, 1) == 0 then
- SystemNotice(Player, "Failed to remove Rebirth Wings, please check again.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings Taken = FALSE")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings Taken = TRUE")
- end
- if TakeItem(Player, 0, 5765, 1) == 0 then
- SystemNotice(Player, "Failed to remove Rebirth Stone, please check again.")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Stone Taken = FALSE")
- return 0
- end
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Stone Taken = FALSE")
- end
- local SK_POINTS = {}
- SK_POINTS[0] = GetChaAttr(Player, ATTR_TP)
- for i = 540, 542, 1 do
- SK_POINTS[i] = 0
- if GetSkillLv(Player, i) == 1 then
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Custom Skill Taken = "..i)
- SK_POINTS[0] = SK_POINTS[0] - 1
- SK_POINTS[i] = 1
- end
- end
- SK_POINTS[0] = SK_POINTS[0] + ClearFightSkill(Player)
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Skill Point Reset = TRUE")
- for k = 540, 542, 1 do
- if SK_POINTS[k] == 1 then
- AddChaSkill(Player, k, 1, 1, 0)
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Custom Skill Added = "..k)
- end
- end
- SetChaAttr(Player, ATTR_TP, SK_POINTS[0])
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Skill Points Assigned = TRUE")
- local STATS = (GetChaAttr(Player, ATTR_AP) + GetChaAttr(Player, ATTR_BSTR) + GetChaAttr(Player, ATTR_BDEX) + GetChaAttr(Player, ATTR_BAGI) + GetChaAttr(Player, ATTR_BCON) + GetChaAttr(Player, ATTR_BSTA)) - 25
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Attribute Points = "..(STATS+25))
- SetChaAttr(Player, ATTR_BSTR, 5)
- SyncChar(Player, 4)
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Strength Attribute Reset = TRUE ")
- SetChaAttr(Player, ATTR_BDEX, 5)
- SyncChar(Player, 4)
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Accuracy Attribute Reset = TRUE")
- SetChaAttr(Player, ATTR_BAGI, 5)
- SyncChar(Player, 4)
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Agility Attribute Reset = TRUE")
- SetChaAttr(Player, ATTR_BCON, 5)
- SyncChar(Player, 4)
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Constitution Attribute Reset = TRUE")
- SetChaAttr(Player, ATTR_BSTA, 5)
- SyncChar(Player, 4)
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Spirit Attribute Reset = TRUE")
- SetChaAttr(Player, ATTR_AP, STATS)
- SyncChar(Player, 4)
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Attribute Points Left = "..STATS)
- SetChaAttr(Player, ATTR_JOB, Class)
- RefreshCha(Player)
- if Level == 1 then
- AddChaSkill(Player, 459, 1, 1, 0)
- AddChaSkill(Player, RB_Var.Class[Class], 1, 1, 0)
- if CharType == 1 then
- GiveItem(Player, 0, 134, 1, 4)
- elseif CharType == 2 then
- GiveItem(Player, 0, 138, 1, 4)
- elseif CharType == 3 then
- GiveItem(Player, 0, 128, 1, 4)
- elseif CharType == 4 then
- GiveItem(Player, 0, 131, 1, 4)
- end
- SetChaAttr(Player, ATTR_CSAILEXP, 1)
- ScrollNotice("Extreme celebration, "..PlayerName.." has done Phoenix Rebirth successful. Blessing from the whole server! "..PlayerName.." hope you have a safe journey and everything goes your way!", 1)
- elseif Level == 2 then
- AddChaSkill(Player, 459, 2, 2, 0)
- AddChaSkill(Player, RB_Var.Class[Class], 2, 2, 0)
- if CharType == 1 then
- GiveItem(Player, 0, 135, 1, 4)
- elseif CharType == 2 then
- GiveItem(Player, 0, 139, 1, 4)
- elseif CharType == 3 then
- GiveItem(Player, 0, 129, 1, 4)
- elseif CharType == 4 then
- GiveItem(Player, 0, 132, 1, 4)
- end
- SetChaAttr(Player, ATTR_CSAILEXP, 10000)
- ScrollNotice("Extreme celebration, "..PlayerName.." has done Second Rebirth successful. Blessing from the whole server! "..PlayerName.." hope you have a safe journey and everything goes your way!", 1)
- end
- RefreshCha(Player)
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Passive Rebirth Skill Added = TRUE")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Active Rebirth Skill Added = TRUE")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Wings Added = TRUE")
- LG("Player Rebirth", "["..PlayerName.."]["..Level.."]["..Class.."]: Rebirth Successful.")
- LG("Player Rebirth", "")
- return 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement