Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- *###########################################################################*
- # -Glow Effects NPC by 7n6.- #
- # If used please give credit or I will break your server Kappa. #
- # (But seriously don't remove credits...) #
- *###########################################################################*
- *******************************************************************************************************************************
- ###############################################################################################################################
- *******************************************************************************************************************************
- Installation:
- 1) Ensure you have hook.lua loaded
- 2) Load this file with DoFile
- Please note: ALL STATES that are to be added must NOT have the ALLExAttrSet(role) or AttrRecheck(role) lines, as this would cause an overflow error.
- Configuration:
- All sets of equips that add states are stored in the GlowEffects.Effects table.
- To add a new set, add a new entry in the table, for example:
- {
- State = STATE_BBRING1,
- Fusable = false,
- AllowApparelGlow = false,
- SpecialCheck = nil,
- Effects = {
- Kylin = false,
- BlackDragon = false,
- Death = true,
- Chaos = false,
- },
- ItemID = nil,
- Slot = nil,
- Equips = {
- Head = nil ,
- Armour = {2817},
- Boots = nil,
- Gloves = nil,
- LeftHand = nil,
- RightHand = nil,
- LeftRing = nil,
- RightRing = {2577},
- Necklace = nil,
- },
- Apparels = {
- Head = nil,
- Armour = nil,
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- },
- },
- This means that when you have 2817 (SS death torso) or 825 (Kylin armour) equipped as your armour, and 2577 (Hell feather) as your right ring,
- you are given the STATE_BBRING1 state (green glow + stats).
- Fusable = false, means that you do NOT get the effect is the equipment is fused.
- AllowApparelGlow = false, means that you do NOT get the effect if the equipment is being used as an apparel.
- SpecialCheck = nil, means no special checks are being done. If you specify a function here, that function must return true to allow the state to be added, eg:
- if we set SpecialCheck = AllowGlow then made this function:
- function AllowGlow(role)
- if GetChaDefaultName(role) == "admin" then
- return true
- else
- return false
- end
- end
- Only admin would get that glow.
- Kylin = false, BlackDragon = false,Death = true, Chaos = false, These means that this set doesnt grant BD/Kylin/chaos effects, but does grant death (exp loss reduction)
- The Equips table is used to declare which equips are needed in which slots. If multiple equips are specified in one slot, the player must have one of them equipped.
- You can also specify an effect with no state by using "State = nil", this can be useful to add kylin effect, but no state, to a set.
- ItemID = nil,
- Slot = nil,
- Specifys an item that has to be in a slot for effect to work.
- The Apparels table specifys that the effect is only given if certain apparels are used.
- eg:
- Apparels = {
- Head = nil,
- Armour = {6373,6374,6375,6376,6377,6378,6381,6384,6393,6396,6397,6398,6401,6414,6418,6422,6425,6426,6428,6430,6434,6437,6441,6445,6449,6453,6457,6461,6465,6479,6483,6487,6490,6493,6497,6501,6511,6514,6518,6522,6526,6530,6534,6537,6541,6545,6548,6551,6555,6559,6563,6567,6576,6582,6586,6589,6592,6593,6595,6598,6601,6605,6609,6613,7247,7251,7255,7258,7262,7266,7269,7272,7276,7280,7283,7287,7294,7298,7300,7304,7308,7312,7316,7320,7324,7327,7330,7334,7338,7341},
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- },
- The effect will only be added if one of the apparels in the armour table is used.
- *******************************************************************************************************************************
- ###############################################################################################################################
- *******************************************************************************************************************************
- ]]
- --Glow Effects Object
- GlowEffects = {}
- --table containing players current effects
- GlowEffects.PlayerEffects = {}
- --Table containing set glows
- GlowEffects.Effects = {
- {
- State = nil,
- Fusable = true,
- AllowApparelGlow = false,
- SpecialCheck = nil,
- Effects = {
- Kylin = false,
- BlackDragon = false,
- Death = true,
- Chaos = true,
- },
- ItemID = nil,
- Slot = nil,
- Equips = {
- Head = nil ,
- Armour = {1124},
- Gloves = {1125},
- Boots = {1126},
- LeftHand = nil,
- RightHand = nil,
- LeftRing = nil,
- RightRing = nil,
- Necklace = nil,
- },
- Apparels = {
- Head = nil,
- Armour = nil,
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- },
- },
- {
- State = STATE_BBRING1,
- Fusable = true,
- AllowApparelGlow = false,
- SpecialCheck = nil,
- Effects = {
- Kylin = false,
- BlackDragon = false,
- Death = true,
- Chaos = false,
- },
- ItemID = nil,
- Slot = nil,
- Equips = {
- Head = nil ,
- Armour = {2817},
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- LeftRing = nil,
- RightRing = {2577},
- Necklace = nil,
- },
- Apparels = {
- Head = nil,
- Armour = nil,
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- },
- },
- {
- State = STATE_BBRING2,
- Fusable = true,
- AllowApparelGlow = false,
- SpecialCheck = nil,
- Effects = {
- Kylin = false,
- BlackDragon = false,
- Death = true,
- Chaos = false,
- },
- ItemID = nil,
- Slot = nil,
- Equips = {
- Head = nil ,
- Armour = {2820},
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- LeftRing = nil,
- RightRing = {2578},
- Necklace = nil,
- },
- Apparels = {
- Head = nil,
- Armour = nil,
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- },
- },
- {
- State = STATE_BBRING3,
- Fusable = true,
- AllowApparelGlow = false,
- SpecialCheck = nil,
- Effects = {
- Kylin = false,
- BlackDragon = false,
- Death = true,
- Chaos = false,
- },
- ItemID = nil,
- Slot = nil,
- Equips = {
- Head = nil ,
- Armour = {2823},
- Gloves = nil,
- Boots = nil,
- Necklace = nil,
- LeftHand = nil,
- LeftRing = nil,
- RightRing = {2579},
- RightHand = nil,
- },
- Apparels = {
- Head = nil,
- Armour = nil,
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- },
- },
- {
- State = STATE_BBRING4,
- Fusable = true,
- AllowApparelGlow = false,
- SpecialCheck = nil,
- Effects = {
- Kylin = false,
- BlackDragon = false,
- Death = true,
- Chaos = false,
- },
- ItemID = nil,
- Slot = nil,
- Equips = {
- Head = nil ,
- Armour = {2826},
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- LeftRing = nil,
- RightRing = {2580},
- Necklace = nil,
- },
- Apparels = {
- Head = nil,
- Armour = nil,
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- },
- },
- {
- State = STATE_BBRING5,
- Fusable = true,
- AllowApparelGlow = false,
- SpecialCheck = nil,
- Effects = {
- Kylin = false,
- BlackDragon = false,
- Death = true,
- Chaos = false,
- },
- ItemID = nil,
- Slot = nil,
- Equips = {
- Head = nil ,
- Armour = {2829},
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- LeftRing = nil,
- RightRing = {2581},
- Necklace = nil,
- },
- Apparels = {
- Head = nil,
- Armour = nil,
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- },
- },
- {
- State = STATE_BBRING6,
- Fusable = true,
- AllowApparelGlow = false,
- SpecialCheck = nil,
- Effects = {
- Kylin = false,
- BlackDragon = false,
- Death = true,
- Chaos = false,
- },
- ItemID = nil,
- Slot = nil,
- Equips = {
- Head = nil ,
- Armour = {2832},
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- LeftRing = nil,
- RightRing = {2582},
- Necklace = nil,
- },
- Apparels = {
- Head = nil,
- Armour = nil,
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- },
- },
- {
- State = STATE_zhongshen,
- Fusable = true,
- AllowApparelGlow = false,
- SpecialCheck = nil,
- Effects = {
- Kylin = true,
- BlackDragon = false,
- Death = false,
- Chaos = false,
- },
- ItemID = nil,
- Slot = nil,
- Equips = {
- Head = {1514,1518,1522,1526,1530,1534},
- Armour = {1515,1519,1523,1527,1531,1535},
- Gloves = {1516,1510,1524,1528,1532,1536},
- Boots = {1517,1511,1525,1529,1533,1537},
- LeftHand = nil,
- RightHand = nil,
- LeftRing = nil,
- RightRing = {2577,2578,2579,2580,2581,2582,7573,7574,7575,7576,7577,7578},
- Necklace =nil,
- },
- Apparels = {
- Head = nil,
- Armour = nil,
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- },
- },
- {
- State = nil,
- Fusable = true,
- AllowApparelGlow = false,
- SpecialCheck = nil,
- Effects = {
- Kylin = true,
- BlackDragon = false,
- Death = false,
- Chaos = false,
- },
- ItemID = nil,
- Slot = nil,
- Equips = {
- Head = nil,
- Armour = {825,2549},
- Gloves = {826,2550},
- Boots = {827,2551},
- LeftHand = nil,
- RightHand = nil,
- LeftRing = nil,
- RightRing = nil,
- Necklace =nil,
- },
- Apparels = {
- Head = nil,
- Armour = nil,
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- },
- },
- {
- State = nil,
- Fusable = true,
- AllowApparelGlow = false,
- SpecialCheck = nil,
- Effects = {
- Kylin = false,
- BlackDragon = true,
- Death = false,
- Chaos = false,
- },
- ItemID = nil,
- Slot = nil,
- Equips = {
- Head = nil,
- Armour = {845,2367},
- Gloves = {846,2368},
- Boots = {847,2369},
- LeftHand = nil,
- RightHand = nil,
- LeftRing = nil,
- RightRing = nil,
- Necklace =nil,
- },
- Apparels = {
- Head = nil,
- Armour = nil,
- Gloves = nil,
- Boots = nil,
- LeftHand = nil,
- RightHand = nil,
- },
- },
- }
- --*******************************************************************************************************************************--
- --###############################################################################################################################--
- --*******************************************************************************************************************************--
- --function to iterate through the table and check each glow
- function GlowEffects.CheckGlows(role)
- local States = {}
- local PID = GetRoleID(role)
- GlowEffects.PlayerEffects[PID] = {}
- for i,v in pairs(GlowEffects.Effects) do
- if GlowEffects.CheckGlow(role,i) == true then
- if v.State ~= nil then
- AddState(role,role,v.State,1,0)
- States[v.State] = true
- end
- for j,k in pairs(v.Effects) do
- GlowEffects.SetPlayerEffects(role,v,j)
- end
- end
- end
- GlowEffects.RemoveGlows(role,States)
- end
- function GlowEffects.SetPlayerEffects(role,v,State)
- local PID = GetRoleID(role)
- if v.Effects[State] == true then
- GlowEffects.PlayerEffects[PID][State] = true
- end
- end
- --function to check if the player meets the requirements for a glow.
- function GlowEffects.CheckGlow(role,ID)
- local Equips = GlowEffects.GetEquips(role)
- local FusedEquips = GlowEffects.GetFusedEquips(role)
- if GlowEffects.Effects[ID].SpecialCheck ~= nil then
- if GlowEffects.Effects[ID].SpecialCheck(role) == false then
- return false
- end
- end
- if (GlowEffects.Effects[ID].Slot ~= nil and GetItemID(GetChaItem ( role , 2 , GlowEffects.Effects[ID].Slot)) ~= GlowEffects.Effects[ID].ItemID ) then
- return false
- end
- for i,v in pairs(GlowEffects.Effects[ID].Equips) do
- if (GlowEffects.InArray (v , Equips[i]) == false or (FusedEquips[i] ~= 0 and GlowEffects.Effects[ID].AllowApparelGlow == false))
- and (GlowEffects.Effects[ID].Fusable == false or GlowEffects.InArray (v , FusedEquips[i]) == false or (GlowEffects.Effects[ID].Apparels[i] ~=nil and GlowEffects.InArray (GlowEffects.Effects[ID].Apparels[i] , Equips[i]) == false )) then
- return false
- end
- end
- return true
- end
- --function to remove all glows that the user does not meet the requirements for.
- function GlowEffects.RemoveGlows(role,States)
- for i,v in pairs(GlowEffects.Effects) do
- if GetChaStateLv ( role , v.State) > 0 and States[v.State] ~= true then
- RemoveState ( role , v.State )
- end
- end
- end
- --function to check if a data item is within an array
- function GlowEffects.InArray(array,str)
- for i,v in pairs(array) do
- if v == str then
- return true
- end
- end
- return false
- end
- --returns a table of user equips
- function GlowEffects.GetEquips(role)
- return {
- Head = GetItemID(GetEquipItemP(role,0)),
- Armour = GetItemID(GetEquipItemP(role, 2)),
- Gloves = GetItemID(GetEquipItemP(role,3)),
- Boots = GetItemID(GetEquipItemP(role,4)),
- Necklace = GetItemID(GetEquipItemP(role,5)),
- LeftHand = GetItemID(GetEquipItemP(role,6)),
- LeftRing = GetItemID(GetEquipItemP(role,7)),
- RightRing = GetItemID(GetEquipItemP(role,8)),
- RightHand = GetItemID(GetEquipItemP(role,9)),
- }
- end
- --returns a table of user equips fusion IDs
- function GlowEffects.GetFusedEquips(role)
- return {
- Head = GlowEffects.VerifyApparel(role, 0),
- Armour = GlowEffects.VerifyApparel(role, 2),
- Gloves = GlowEffects.VerifyApparel(role, 3),
- Boots = GlowEffects.VerifyApparel(role, 4),
- Necklace = GlowEffects.VerifyApparel(role, 5),
- LeftHand = GlowEffects.VerifyApparel(role, 6),
- LeftRing = GlowEffects.VerifyApparel(role, 7),
- RightRing = GlowEffects.VerifyApparel(role, 8),
- RightHand = GlowEffects.VerifyApparel(role, 9),
- }
- end
- --verifys if a slot is empty
- function GlowEffects.VerifyApparel(role, slot)
- if GetItemID(GetEquipItemP(role,slot)) == 0 then
- return 0
- else
- return GetItemAttr(GetEquipItemP(role,slot), ITEMATTR_VAL_FUSIONID)
- end
- end
- --function called to check for kylin effect
- function GlowEffects.CheckKylin ( role )
- return GlowEffects.CheckEffect(role,"Kylin")
- end
- --function called to check for BD effect
- function GlowEffects.CheckBlackDragon ( role )
- return GlowEffects.CheckEffect(role,"BlackDragon")
- end
- --function called to check for Death effect
- function GlowEffects.CheckDeath ( role )
- return GlowEffects.CheckEffect(role,"Death")
- end
- --function called to check for Chaos effect
- function GlowEffects.CheckChaos ( role )
- return GlowEffects.CheckEffect(role,"Chaos")
- end
- --iterates through table to check effects
- function GlowEffects.CheckEffect(role,effect)
- if Is_NormalMonster ( role ) == 1 then
- return 0
- end
- local PID = GetRoleID(role)
- if GlowEffects.PlayerEffects[PID] == nil then
- GlowEffects.CheckGlows(role)
- end
- if GlowEffects.PlayerEffects[PID][effect] ~= true then
- return 0
- else
- return 1
- end
- end
- --Hooked on taking damage
- function GlowEffects.CheckGlows2(role,num)
- if Is_NormalMonster ( role ) ~= 1 then
- GlowEffects.CheckGlows(role)
- end
- end
- --Hooks
- --Hook:AddPreHook("Hp_Endure_Dmg",GlowEffects.CheckGlows2) --Hook on taking damage to check states, not needed if you do not have effects that need a stone.
- Hook:AddPreHook("AttrRecheck",GlowEffects.CheckGlows) --Hook on updating stats to check states
- Hook:AddReplacementHook("CheckItem_Nianshou",GlowEffects.CheckKylin) --Hook to check kylin set
- Hook:AddReplacementHook("CheckItem_Heilong",GlowEffects.CheckBlackDragon) --Hook to check BD set
- Hook:AddReplacementHook("CheckItem_Death",GlowEffects.CheckDeath) --Hook to check Death set
- Hook:AddReplacementHook("CheckItem_fighting",GlowEffects.CheckChaos) --Hook to check Chaos set
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement