9
3

ExpelNonCitizen.lua 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. --[[
  2. Script Name : SpawnScripts/Generic/ExpelNonCitizen.lua
  3. Script Author : Dorbin
  4. Script Date : 2022.11.03 01:11:17
  5. Script Purpose :
  6. :
  7. --]]
  8. dofile("SpawnScripts/Generic/AdvancementGaze.lua")
  9. function NonCitizen(NPC,Spawn)
  10. if GetFactionAmount(Spawn,11)>=5000 then
  11. if GetLevel(Spawn) ==8 or GetLevel(Spawn)==9 then--CLASS ADVANCEMENT QUEST CHECK
  12. ClassCheck(NPC,Spawn)
  13. end
  14. end
  15. Qfaction = GetFactionAmount(Spawn,11)
  16. FPfaction = GetFactionAmount(Spawn,12)
  17. local invul = IsInvulnerable(Spawn)
  18. local zone = GetZone(NPC)
  19. if GetZoneID(zone) >= 220 and GetZoneID(zone) <= 238 then -- clarifies which zone is designated EVIL or GOOD
  20. GOOD = true
  21. elseif GetZoneID(zone) == 207 then
  22. GOOD = true
  23. elseif GetZoneID(zone) >= 195 and GetZoneID(zone) <= 198 then
  24. GOOD = true
  25. elseif GetZoneID(zone) == 589 or GetZoneID(zone) == 660 then
  26. GOOD = true
  27. elseif GetZoneID(zone) == 470 then
  28. GOOD = true
  29. elseif GetZoneID(zone) == 45 then
  30. NEUTRAL = true
  31. elseif GetZoneID(zone) >= 124 and GetZoneID(zone) <= 128 then
  32. EVIL = true
  33. elseif GetZoneID(zone) >= 134 and GetZoneID(zone)<= 168 then
  34. EVIL = true
  35. end
  36. if GOOD and GetFactionAmount(Spawn,11) >0 and invul == false then
  37. if not HasCompletedQuest(Spawn,5718) and
  38. not HasCompletedQuest(Spawn,5719) and --CITIZENSHIP TRIALS
  39. not HasCompletedQuest(Spawn,5720) and
  40. not HasCompletedQuest(Spawn,5721) and
  41. not HasCompletedQuest(Spawn,5722) and
  42. not HasCompletedQuest(Spawn,5723) then
  43. if GetClass(Spawn) ==1 or GetClass(Spawn)==11 or GetClass(Spawn)==21 or GetClass(Spawn)==31 then --CLASS(Archetype) CHECK. THESE ARE POSSIBLE REFUGEES.
  44. SetInfoStructUInt(NPC, "override_primary_weapon", 1) -- Enables override of server autoattack damage. Set to 0 to allow server to set damage.
  45. SetInfoStructUInt(NPC, "primary_weapon_damage_low", 0)
  46. SetInfoStructUInt(NPC, "primary_weapon_damage_high", 0)
  47. Attack(NPC,Spawn)
  48. AddTimer(NPC,500,"Expel",1,Spawn)
  49. SendMessage(Spawn,"A guard has spotted you!","red")
  50. PlaySound(Spawn,"sounds/ui/ui_warning.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  51. end
  52. end
  53. elseif GOOD and GetFactionAmount(Spawn,11)<1000 and invul == false then --NON CITIZENS
  54. SetInfoStructUInt(NPC, "override_primary_weapon", 0) -- Enables override of server autoattack damage. Set to 0 to allow server to set damage.
  55. Attack(NPC,Spawn)
  56. AddTimer(NPC,500,"ExpelOtherFaction",1,Spawn)
  57. SendPopUpMessage(Spawn,"A guard has spotted you!",250,0,0)
  58. SendMessage(Spawn,"A guard has spotted you!","red")
  59. PlaySound(Spawn,"sounds/ui/ui_warning.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  60. end
  61. end
  62. function Expel(NPC,Spawn)
  63. local invul = IsInvulnerable(Spawn)
  64. if IsInCombat(NPC) then
  65. AddTimer(NPC,500,"Expel",1,Spawn)
  66. if invul == false and GetDistance(Spawn,NPC) <=4 then
  67. CastSpell(NPC,1225)
  68. PlayAnimation(Spawn,11764)
  69. ExpeltoHood(NPC,Spawn)
  70. SetInvulnerable(Spawn)
  71. SendPopUpMessage(Spawn,"Refugee! You are not allowed inside the walls of Qeynos!",250,0,0)
  72. SendMessage(Spawn,"Refugee! You are not allowed inside the walls of Qeynos!","red")
  73. PlaySound(Spawn,"sounds/ui/ui_duel_defeat.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  74. End (NPC,Spawn)
  75. -- SetHP(Spawn,SetMaxHP(Spawn))
  76. end
  77. end
  78. end
  79. function End (NPC,Spawn)
  80. ClearHate(NPC, Spawn)
  81. SetInCombat(Spawn, false)
  82. SetInCombat(NPC, false)
  83. ClearEncounter(NPC)
  84. SetTarget(Spawn,nil)
  85. SetInfoStructUInt(NPC, "override_primary_weapon", 0) -- Enables override of server autoattack damage. Set to 0 to allow server to set damage.
  86. end
  87. function ExpelOtherFaction(NPC,Spawn)
  88. local invul = IsInvulnerable(Spawn)
  89. if IsInCombat(NPC) then
  90. if invul == false and GetDistance(Spawn,NPC) <=5 then
  91. CastSpell(NPC,1225)
  92. PlayAnimation(Spawn,11764)
  93. ExpeltoOutofCity(NPC,Spawn)
  94. SetInvulnerable(Spawn)
  95. SendPopUpMessage(Spawn,"You are not allowed inside the walls of Qeynos!",250,0,0)
  96. SendMessage(Spawn,"You are not allowed inside the walls of Qeynos!","red")
  97. PlaySound(Spawn,"sounds/ui/ui_duel_defeat.wav", GetX(NPC), GetY(NPC), GetZ(NPC))
  98. SetHP(Spawn,SetMaxHP(Spawn))
  99. End (NPC,Spawn)
  100. end
  101. end
  102. end
  103. function ExpeltoOutofCity(NPC,Spawn)
  104. ZoneRef = GetZone("Antonica")
  105. Zone(ZoneRef,Spawn,-130.85, -15.10, -77.62, 137.28)
  106. end
  107. function ExpeltoHood(NPC,Spawn)
  108. local Race = GetRace(Spawn)
  109. -- Kerra
  110. if Race == 11 or Race == 9 then
  111. ZoneRef = GetZone("Nettleville")
  112. Zone(ZoneRef,Spawn)
  113. -- Erudite
  114. elseif Race == 3 or Race == 20 then
  115. ZoneRef = GetZone("Starcrest")
  116. Zone(ZoneRef,Spawn)
  117. -- Barbarian / Dwarf
  118. elseif Race == 0 or Race == 2 then
  119. ZoneRef = GetZone("Graystone")
  120. Zone(ZoneRef,Spawn)
  121. -- Froglok / High Elf
  122. elseif Race == 4 or Race == 8 then
  123. ZoneRef = GetZone("Castleview")
  124. Zone(ZoneRef,Spawn)
  125. -- Half Elf / Wood Elf
  126. elseif Race == 6 or Race == 15 then
  127. ZoneRef = GetZone("Willowwood")
  128. Zone(ZoneRef,Spawn)
  129. -- Gnome / Halfling
  130. elseif Race == 5 or Race == 7 then
  131. ZoneRef = GetZone("Baubbleshire")
  132. Zone(ZoneRef,Spawn)
  133. else
  134. ZoneRef = GetZone("Nettleville")
  135. Zone(ZoneRef,Spawn)
  136. end
  137. end