Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MapSets = {
- Maps = { --Maps is the table of maps
- ['map1'] = {
- Fusable = true,
- KickToMap = 'garner',
- Equips = {
- Head = nil,
- Armour = {2549,192,2920},
- Gloves = {2550,1234,678},
- Boots = {2551},
- LeftHand = nil,
- RightHand = nil,
- LeftRing = {82},
- RightRing = nil,
- Necklace =nil,
- }
- },
- ['map2'] = {
- Fusable = false,
- KickToMap = 'garner',
- Equips = {
- Head = nil,
- Armour = {2549},
- Gloves = {2550,999},
- Boots = {2551},
- LeftHand = nil,
- RightHand = nil,
- LeftRing = nil,
- RightRing = nil,
- Necklace =nil,
- }
- },
- }
- }
- function MapSets.CheckSet(role,mapname)
- local Equips,Fused = MapSets.GetEquips(role)
- for i,v in pairs(MapSets.Maps[mapname].Equips) do
- if MapSets.InArray(v,Equips[i]) == false and (MapSets.Maps[mapname].Fusable == false or MapSets.InArray(v,Fused[i]) == false )
- return false
- end
- end
- return true
- end
- function MapSets.KickCheater (role)
- local mapname = GetChaMapName(role)
- if MapSets.Maps[mapname] ~= nil then
- if MapSets.CheckSet(role,mapname) == false then
- MoveCity(role,MapSets.Maps[mapname].KickToMap)
- BickerNotice(role,'Do not try to cheat.')
- end
- end
- end
- function MapSets.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)),
- },{
- 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
- function MapSets.VerifyApparel(role, slot)
- if GetItemID(GetEquipItemP(role,slot)) == 0 then
- return 0
- else
- return GetItemAttr(GetEquipItemP(role,slot), ITEMATTR_VAL_FUSIONID)
- end
- end
- function MapSets.InArray(array,str)
- for i,v in pairs(array) do
- if v == str then
- return true
- end
- end
- return false
- end
- function MapSets.CreateHooks()
- for i,v in pairs(MapSets.Maps) do
- local oldcheck = _G[string.format("check_can_enter_%s",i)]
- Hook:AddPreHook(string.format("check_can_enter_%s",i),
- function (role, copy_mgr)
- if oldcheck(role,copy_mgr) ~= 1 or MapSets.CheckSet(role,i) ~= true then
- SystemNotice(role,'Can not enter the map in those equips.')
- return 0
- end
- return 1
- end
- )
- end
- Hook:AddPreHook("AttrRecheck",MapSets.KickCheater )
- end
- MapSets.CreateHooks()
- --MapSet.Maps table contains the info about what equips can be used in what map. Example given is for map1 and map2. Requies Hook. Is untested
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement