diff --git a/scripts/commands/addalltrusts.lua b/scripts/commands/addalltrusts.lua index 62dc81ec364..f5dcc5d8b49 100644 --- a/scripts/commands/addalltrusts.lua +++ b/scripts/commands/addalltrusts.lua @@ -20,8 +20,8 @@ function onTrigger(player, target) 896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920, 921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945, 946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970, - 971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,1004,1005,1006,1007,1008,1009, - 1010,1011,1012,1013,1014,1015,1016 + 971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995, + 996,997,998,999,1004,1005,1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019 } -- validate target @@ -45,5 +45,5 @@ function onTrigger(player, target) end targ:addSpell(ValidSpells[i], silent, save) end - player:PrintToPlayer(string.format("%s now has all spells.", targ:getName())) + player:PrintToPlayer(string.format("%s now has all trusts.", targ:getName())) end diff --git a/scripts/commands/hp.lua b/scripts/commands/hp.lua index 9b37f4de665..e09791145c3 100644 --- a/scripts/commands/hp.lua +++ b/scripts/commands/hp.lua @@ -26,7 +26,10 @@ function onTrigger(player, hp, target) -- validate target local targ - if (target == nil) then + local cursor_target = player:getCursorTarget() + if cursor_target ~= nil then + targ = cursor_target + elseif target == nil then targ = player else targ = GetPlayerByName(target) diff --git a/scripts/globals/magic.lua b/scripts/globals/magic.lua index 10161b8b7f6..a10eefd4ead 100644 --- a/scripts/globals/magic.lua +++ b/scripts/globals/magic.lua @@ -309,6 +309,14 @@ function getCureAsNukeFinal(caster,spell,power,divisor,constant,basepower) return getCureFinal(caster,spell,power,divisor,constant,basepower) end +function isValidHealTarget(caster, target) + return target:getAllegiance() == caster:getAllegiance() and + (target:getObjType() == tpz.objType.PC or + target:getObjType() == tpz.objType.MOB or + target:getObjType() == tpz.objType.TRUST or + target:getObjType() == tpz.objType.FELLOW) +end + ----------------------------------- -- Returns the staff bonus for the caster and spell. ----------------------------------- diff --git a/scripts/globals/mobskills/provoke.lua b/scripts/globals/mobskills/provoke.lua new file mode 100644 index 00000000000..c11067b3226 --- /dev/null +++ b/scripts/globals/mobskills/provoke.lua @@ -0,0 +1,15 @@ +--------------------------------------------- +-- Provoke +--------------------------------------------- +require("scripts/globals/msg") +require("scripts/globals/status") +--------------------------------------------- + +function onMobSkillCheck(target,mob,skill) + return 0 +end + +function onMobWeaponSkill(target, mob, skill) + target:addEnmity(mob, 1, 1800) + skill:setMsg(tpz.msg.basic.NONE) +end diff --git a/scripts/globals/mobskills/sentinel.lua b/scripts/globals/mobskills/sentinel.lua new file mode 100644 index 00000000000..0ddb19d8034 --- /dev/null +++ b/scripts/globals/mobskills/sentinel.lua @@ -0,0 +1,15 @@ +--------------------------------------------------- +-- Sentinel +--------------------------------------------------- +require("scripts/globals/msg") +require("scripts/globals/status") +--------------------------------------------------- + +function onMobSkillCheck(target,mob,skill) + return 0 +end + +function onMobWeaponSkill(target, mob, skill) + target:addEnmity(mob, 1, 1800) + skill:setMsg(tpz.msg.basic.NONE) +end diff --git a/scripts/globals/msg.lua b/scripts/globals/msg.lua index 61d072fbea4..86d38b32ca1 100644 --- a/scripts/globals/msg.lua +++ b/scripts/globals/msg.lua @@ -306,4 +306,8 @@ tpz.msg.basic = DESPOIL_EVA_DOWN = 597, -- ${actor} uses ${ability}.${lb}${actor} steals a ${item} from ${target}.${lb}Additional effect: ${target} is afflicted with Evasion Down. DESPOIL_ACC_DOWN = 598, -- ${actor} uses ${ability}.${lb}${actor} steals a ${item} from ${target}.${lb}Additional effect: ${target} is afflicted with Accuracy Down. DESPOIL_SLOW = 599, -- ${actor} uses ${ability}.${lb}${actor} steals a ${item} from ${target}.${lb}Additional effect: ${target} is afflicted with Slow. + + -- TRUST & ALTER EGO + TRUST_NO_CAST_TRUST = 700, -- You are unable to use Trust magic at this time. + TRUST_NO_CALL_AE = 717, -- You cannot call forth alter egos here. } \ No newline at end of file diff --git a/scripts/globals/spells/cure.lua b/scripts/globals/spells/cure.lua index 53d3b05ac3f..f220abb69ce 100644 --- a/scripts/globals/spells/cure.lua +++ b/scripts/globals/spells/cure.lua @@ -62,7 +62,7 @@ function onSpellCast(caster,target,spell) end end - if (target:getAllegiance() == caster:getAllegiance() and (target:getObjType() == tpz.objType.PC or target:getObjType() == tpz.objType.MOB)) then + if isValidHealTarget(caster, target) then if (USE_OLD_CURE_FORMULA == true) then basecure = getBaseCureOld(power,divisor,constant) else diff --git a/scripts/globals/spells/cure_ii.lua b/scripts/globals/spells/cure_ii.lua index 0d7f19c4be1..49511816eb5 100644 --- a/scripts/globals/spells/cure_ii.lua +++ b/scripts/globals/spells/cure_ii.lua @@ -62,7 +62,7 @@ function onSpellCast(caster,target,spell) end end - if (target:getAllegiance() == caster:getAllegiance() and (target:getObjType() == tpz.objType.PC or target:getObjType() == tpz.objType.MOB)) then + if isValidHealTarget(caster, target) then if (USE_OLD_CURE_FORMULA == true) then basecure = getBaseCureOld(power,divisor,constant) else diff --git a/scripts/globals/spells/cure_iii.lua b/scripts/globals/spells/cure_iii.lua index 865c8d5aa98..d36ab92b104 100644 --- a/scripts/globals/spells/cure_iii.lua +++ b/scripts/globals/spells/cure_iii.lua @@ -58,7 +58,7 @@ function onSpellCast(caster,target,spell) end end - if (target:getAllegiance() == caster:getAllegiance() and (target:getObjType() == tpz.objType.PC or target:getObjType() == tpz.objType.MOB)) then + if isValidHealTarget(caster, target) then if (USE_OLD_CURE_FORMULA == true) then basecure = getBaseCureOld(power,divisor,constant) else diff --git a/scripts/globals/spells/cure_iv.lua b/scripts/globals/spells/cure_iv.lua index a88af166bdb..1b2a690b456 100644 --- a/scripts/globals/spells/cure_iv.lua +++ b/scripts/globals/spells/cure_iv.lua @@ -56,7 +56,7 @@ function onSpellCast(caster,target,spell) basepower = 0 end end - if (target:getAllegiance() == caster:getAllegiance() and (target:getObjType() == tpz.objType.PC or target:getObjType() == tpz.objType.MOB)) then + if isValidHealTarget(caster, target) then if (USE_OLD_CURE_FORMULA == true) then basecure = getBaseCureOld(power,divisor,constant) else diff --git a/scripts/globals/spells/cure_v.lua b/scripts/globals/spells/cure_v.lua index 131e29afb7e..67adac66cc1 100644 --- a/scripts/globals/spells/cure_v.lua +++ b/scripts/globals/spells/cure_v.lua @@ -66,7 +66,7 @@ function onSpellCast(caster,target,spell) end end - if (target:getAllegiance() == caster:getAllegiance() and (target:getObjType() == tpz.objType.PC or target:getObjType() == tpz.objType.MOB)) then -- e.g. is a PC and not a monster (?) + if isValidHealTarget(caster, target) then -- e.g. is a PC and not a monster (?) if (USE_OLD_CURE_FORMULA == true) then basecure = getBaseCureOld(power,divisor,constant) else diff --git a/scripts/globals/spells/cure_vi.lua b/scripts/globals/spells/cure_vi.lua index 7b0af012801..4bd414f45fb 100644 --- a/scripts/globals/spells/cure_vi.lua +++ b/scripts/globals/spells/cure_vi.lua @@ -49,7 +49,7 @@ function onSpellCast(caster,target,spell) basepower = 0 end - if (target:getAllegiance() == caster:getAllegiance() and (target:getObjType() == tpz.objType.PC or target:getObjType() == tpz.objType.MOB)) then + if isValidHealTarget(caster, target) then basecure = getBaseCure(power,divisor,constant,basepower) final = getCureFinal(caster,spell,basecure,minCure,false) if (caster:hasStatusEffect(tpz.effect.AFFLATUS_SOLACE) and target:hasStatusEffect(tpz.effect.STONESKIN) == false) then diff --git a/scripts/globals/spells/trust/Shantotto_II.lua b/scripts/globals/spells/trust/Shantotto_II.lua deleted file mode 100644 index 232201ae021..00000000000 --- a/scripts/globals/spells/trust/Shantotto_II.lua +++ /dev/null @@ -1,14 +0,0 @@ ------------------------------------------ --- Trust: Shantotto II ------------------------------------------ --- require("scripts/globals/trust") ------------------------------------------ - -function onMagicCastingCheck(caster,target,spell) - return 0 -end - -function onSpellCast(caster,target,spell) - -- caster:spawnTrust(1019) - return 0 -end diff --git a/scripts/globals/spells/trust/aaev.lua b/scripts/globals/spells/trust/aaev.lua new file mode 100644 index 00000000000..2b9ebe7286d --- /dev/null +++ b/scripts/globals/spells/trust/aaev.lua @@ -0,0 +1,14 @@ +----------------------------------------- +-- Trust: AAEV +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end + diff --git a/scripts/globals/spells/trust/aagk.lua b/scripts/globals/spells/trust/aagk.lua new file mode 100644 index 00000000000..cd8929bccaf --- /dev/null +++ b/scripts/globals/spells/trust/aagk.lua @@ -0,0 +1,14 @@ +----------------------------------------- +-- Trust: AAGK +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end + diff --git a/scripts/globals/spells/trust/aahm.lua b/scripts/globals/spells/trust/aahm.lua new file mode 100644 index 00000000000..18ec053a318 --- /dev/null +++ b/scripts/globals/spells/trust/aahm.lua @@ -0,0 +1,14 @@ +----------------------------------------- +-- Trust: AAHM +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end + diff --git a/scripts/globals/spells/trust/aamr.lua b/scripts/globals/spells/trust/aamr.lua new file mode 100644 index 00000000000..b0577c0459d --- /dev/null +++ b/scripts/globals/spells/trust/aamr.lua @@ -0,0 +1,14 @@ +----------------------------------------- +-- Trust: AAMR +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end + diff --git a/scripts/globals/spells/trust/aatt.lua b/scripts/globals/spells/trust/aatt.lua new file mode 100644 index 00000000000..aa04008a76d --- /dev/null +++ b/scripts/globals/spells/trust/aatt.lua @@ -0,0 +1,14 @@ +----------------------------------------- +-- Trust: AATT +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end + diff --git a/scripts/globals/spells/trust/abenzio.lua b/scripts/globals/spells/trust/abenzio.lua new file mode 100644 index 00000000000..eea37bd391a --- /dev/null +++ b/scripts/globals/spells/trust/abenzio.lua @@ -0,0 +1,14 @@ +----------------------------------------- +-- Trust: Abenzio +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end + diff --git a/scripts/globals/spells/trust/abquhbah.lua b/scripts/globals/spells/trust/abquhbah.lua new file mode 100644 index 00000000000..fefb2dc3d5c --- /dev/null +++ b/scripts/globals/spells/trust/abquhbah.lua @@ -0,0 +1,14 @@ +----------------------------------------- +-- Trust: Abquhbah +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end + diff --git a/scripts/globals/spells/trust/adelheid.lua b/scripts/globals/spells/trust/adelheid.lua new file mode 100644 index 00000000000..c7e695084c3 --- /dev/null +++ b/scripts/globals/spells/trust/adelheid.lua @@ -0,0 +1,14 @@ +----------------------------------------- +-- Trust: Adelheid +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end + diff --git a/scripts/globals/spells/trust/ajido-marujido.lua b/scripts/globals/spells/trust/ajido-marujido.lua new file mode 100644 index 00000000000..3dd40d73f53 --- /dev/null +++ b/scripts/globals/spells/trust/ajido-marujido.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Ajido-Marujido +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/aldo.lua b/scripts/globals/spells/trust/aldo.lua new file mode 100644 index 00000000000..41c7093a5bf --- /dev/null +++ b/scripts/globals/spells/trust/aldo.lua @@ -0,0 +1,14 @@ +----------------------------------------- +-- Trust: Aldo +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 1007) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end + diff --git a/scripts/globals/spells/trust/aldo_uc.lua b/scripts/globals/spells/trust/aldo_uc.lua new file mode 100644 index 00000000000..82ff442dfce --- /dev/null +++ b/scripts/globals/spells/trust/aldo_uc.lua @@ -0,0 +1,14 @@ +----------------------------------------- +-- Trust: Aldo UC +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 930) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end + diff --git a/scripts/globals/spells/trust/amchuchu.lua b/scripts/globals/spells/trust/amchuchu.lua new file mode 100644 index 00000000000..2e999032eb5 --- /dev/null +++ b/scripts/globals/spells/trust/amchuchu.lua @@ -0,0 +1,14 @@ +----------------------------------------- +-- Trust: Amchuchu +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end + diff --git a/scripts/globals/spells/trust/apururu_uc.lua b/scripts/globals/spells/trust/apururu_uc.lua new file mode 100644 index 00000000000..d7df2a90048 --- /dev/null +++ b/scripts/globals/spells/trust/apururu_uc.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Apururu UC +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/arciela.lua b/scripts/globals/spells/trust/arciela.lua new file mode 100644 index 00000000000..9e37c20b87e --- /dev/null +++ b/scripts/globals/spells/trust/arciela.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Arciela +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 1017) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/arciela_ii.lua b/scripts/globals/spells/trust/arciela_ii.lua new file mode 100644 index 00000000000..1826c6e33b2 --- /dev/null +++ b/scripts/globals/spells/trust/arciela_ii.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Arciela II +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 965) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/areuhat.lua b/scripts/globals/spells/trust/areuhat.lua new file mode 100644 index 00000000000..fe51ad1fa5a --- /dev/null +++ b/scripts/globals/spells/trust/areuhat.lua @@ -0,0 +1,14 @@ +----------------------------------------- +-- Trust: Areuhat +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end + diff --git a/scripts/globals/spells/trust/august.lua b/scripts/globals/spells/trust/august.lua new file mode 100644 index 00000000000..6cfd75267f7 --- /dev/null +++ b/scripts/globals/spells/trust/august.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: August +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/ayame.lua b/scripts/globals/spells/trust/ayame.lua new file mode 100644 index 00000000000..e4762aac5ea --- /dev/null +++ b/scripts/globals/spells/trust/ayame.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Ayame +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 1005) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/ayame_uc.lua b/scripts/globals/spells/trust/ayame_uc.lua new file mode 100644 index 00000000000..883fcfb6e12 --- /dev/null +++ b/scripts/globals/spells/trust/ayame_uc.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Ayame UC +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 900) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/babban.lua b/scripts/globals/spells/trust/babban.lua new file mode 100644 index 00000000000..905b6d526ff --- /dev/null +++ b/scripts/globals/spells/trust/babban.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Babban +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/balamor.lua b/scripts/globals/spells/trust/balamor.lua new file mode 100644 index 00000000000..a18b62a8e74 --- /dev/null +++ b/scripts/globals/spells/trust/balamor.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Balamor +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/brygid.lua b/scripts/globals/spells/trust/brygid.lua new file mode 100644 index 00000000000..b2b7c73dc89 --- /dev/null +++ b/scripts/globals/spells/trust/brygid.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Brygid +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/chacharoon.lua b/scripts/globals/spells/trust/chacharoon.lua new file mode 100644 index 00000000000..79527e825df --- /dev/null +++ b/scripts/globals/spells/trust/chacharoon.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Chacharoon +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/cherukiki.lua b/scripts/globals/spells/trust/cherukiki.lua new file mode 100644 index 00000000000..a3ad7478dc1 --- /dev/null +++ b/scripts/globals/spells/trust/cherukiki.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Cherukiki +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/cid.lua b/scripts/globals/spells/trust/cid.lua new file mode 100644 index 00000000000..38b437c3cca --- /dev/null +++ b/scripts/globals/spells/trust/cid.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Cid +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/curilla.lua b/scripts/globals/spells/trust/curilla.lua new file mode 100644 index 00000000000..fad68c8e61b --- /dev/null +++ b/scripts/globals/spells/trust/curilla.lua @@ -0,0 +1,44 @@ +----------------------------------------- +-- Trust: Curilla +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end + +function onMobSpawn(mob) + mob:addListener("ENMITY_CHANGED", "CURILLA_ENMITY_CHANGED", function(trust, master, target) + if trust:getID() ~= target:getID() then + trust:setLocalVar("trySentinel", 1) + end + end) + + mob:addListener("COMBAT_TICK", "CURILLA_COMBAT_TICK", function(trust, master, target) + local trySentinel = trust:getLocalVar("trySentinel") + local sentinelReadyTime = trust:getLocalVar("sentinelReadyTime") + + if trySentinel == 1 and os.time() >= sentinelReadyTime then + trust:useMobAbility(707, target) + trust:setLocalVar("trySentinel", 0) + trust:setLocalVar("sentinelReadyTime", os.time() + 600) + end + + if trust:getTP() >= 1000 then + local weaponSkills = {34, 37, 41} + local ws = weaponSkills[math.random(1, #weaponSkills)] + trust:useMobAbility(ws, target) + end + end) +end + +function onMobDespawn(mob) +end + +function onMobDeath(mob) +end diff --git a/scripts/globals/spells/trust/d_shantotto.lua b/scripts/globals/spells/trust/d_shantotto.lua new file mode 100644 index 00000000000..d424ce2bc59 --- /dev/null +++ b/scripts/globals/spells/trust/d_shantotto.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: D Shantotto +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/darrcuiln.lua b/scripts/globals/spells/trust/darrcuiln.lua new file mode 100644 index 00000000000..9b4e6ae37b2 --- /dev/null +++ b/scripts/globals/spells/trust/darrcuiln.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Darrcuiln +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/elivira.lua b/scripts/globals/spells/trust/elivira.lua new file mode 100644 index 00000000000..278e8ea7f45 --- /dev/null +++ b/scripts/globals/spells/trust/elivira.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Elivira +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/excenmille.lua b/scripts/globals/spells/trust/excenmille.lua new file mode 100644 index 00000000000..042418d1e59 --- /dev/null +++ b/scripts/globals/spells/trust/excenmille.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Excenmille +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 1004) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/excenmille_s.lua b/scripts/globals/spells/trust/excenmille_s.lua new file mode 100644 index 00000000000..d1904910bc1 --- /dev/null +++ b/scripts/globals/spells/trust/excenmille_s.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Excenmille S +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 899) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/fablinix.lua b/scripts/globals/spells/trust/fablinix.lua new file mode 100644 index 00000000000..bc19dc7f772 --- /dev/null +++ b/scripts/globals/spells/trust/fablinix.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Fablinix +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/ferreous_coffin.lua b/scripts/globals/spells/trust/ferreous_coffin.lua new file mode 100644 index 00000000000..38f0de6c788 --- /dev/null +++ b/scripts/globals/spells/trust/ferreous_coffin.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Ferreous Coffin +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/flaviria_uc.lua b/scripts/globals/spells/trust/flaviria_uc.lua new file mode 100644 index 00000000000..12f7538b5c5 --- /dev/null +++ b/scripts/globals/spells/trust/flaviria_uc.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Flaviria UC +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/gadalar.lua b/scripts/globals/spells/trust/gadalar.lua new file mode 100644 index 00000000000..4e2a3e6e8f2 --- /dev/null +++ b/scripts/globals/spells/trust/gadalar.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Gadalar +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/gessho.lua b/scripts/globals/spells/trust/gessho.lua new file mode 100644 index 00000000000..401292a5043 --- /dev/null +++ b/scripts/globals/spells/trust/gessho.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Gessho +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/gilgamesh.lua b/scripts/globals/spells/trust/gilgamesh.lua new file mode 100644 index 00000000000..d2bce4ce8d5 --- /dev/null +++ b/scripts/globals/spells/trust/gilgamesh.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Gilgamesh +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/halver.lua b/scripts/globals/spells/trust/halver.lua new file mode 100644 index 00000000000..f2eaf9cd928 --- /dev/null +++ b/scripts/globals/spells/trust/halver.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Halver +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/i_shield_uc.lua b/scripts/globals/spells/trust/i_shield_uc.lua new file mode 100644 index 00000000000..57b2589ba1a --- /dev/null +++ b/scripts/globals/spells/trust/i_shield_uc.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Invincible Shield UC +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/ingrid.lua b/scripts/globals/spells/trust/ingrid.lua new file mode 100644 index 00000000000..0f286e3ce7d --- /dev/null +++ b/scripts/globals/spells/trust/ingrid.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Ingrid +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 1016) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/ingrid_ii.lua b/scripts/globals/spells/trust/ingrid_ii.lua new file mode 100644 index 00000000000..48210eb9cb3 --- /dev/null +++ b/scripts/globals/spells/trust/ingrid_ii.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Ingrid II +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 921) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/iroha.lua b/scripts/globals/spells/trust/iroha.lua new file mode 100644 index 00000000000..ccc23bea78e --- /dev/null +++ b/scripts/globals/spells/trust/iroha.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Iroha +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 1018) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/iroha_ii.lua b/scripts/globals/spells/trust/iroha_ii.lua new file mode 100644 index 00000000000..73cacbed4aa --- /dev/null +++ b/scripts/globals/spells/trust/iroha_ii.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Iroha II +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 997) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/iron_eater.lua b/scripts/globals/spells/trust/iron_eater.lua new file mode 100644 index 00000000000..9593bfafacb --- /dev/null +++ b/scripts/globals/spells/trust/iron_eater.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Iron Eater +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/jakoh_uc.lua b/scripts/globals/spells/trust/jakoh_uc.lua new file mode 100644 index 00000000000..6ea62417c47 --- /dev/null +++ b/scripts/globals/spells/trust/jakoh_uc.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Jakoh Wahcondalo UC +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/joachim.lua b/scripts/globals/spells/trust/joachim.lua new file mode 100644 index 00000000000..956352cf7a1 --- /dev/null +++ b/scripts/globals/spells/trust/joachim.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Joachim +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/karaha-baruha.lua b/scripts/globals/spells/trust/karaha-baruha.lua new file mode 100644 index 00000000000..446615ab6ef --- /dev/null +++ b/scripts/globals/spells/trust/karaha-baruha.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Karaha-Baruha +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/kayeel-payeel.lua b/scripts/globals/spells/trust/kayeel-payeel.lua new file mode 100644 index 00000000000..5f80adbd70c --- /dev/null +++ b/scripts/globals/spells/trust/kayeel-payeel.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Kayeel-Payeel +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/king_of_hearts.lua b/scripts/globals/spells/trust/king_of_hearts.lua new file mode 100644 index 00000000000..5fa496304a5 --- /dev/null +++ b/scripts/globals/spells/trust/king_of_hearts.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: King of Hearts +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/klara.lua b/scripts/globals/spells/trust/klara.lua new file mode 100644 index 00000000000..8c7d13207e0 --- /dev/null +++ b/scripts/globals/spells/trust/klara.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Klara +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/koru-moru.lua b/scripts/globals/spells/trust/koru-moru.lua new file mode 100644 index 00000000000..38d4584fa8f --- /dev/null +++ b/scripts/globals/spells/trust/koru-moru.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Koru-Moru +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/kukki-chebukki.lua b/scripts/globals/spells/trust/kukki-chebukki.lua new file mode 100644 index 00000000000..d662ca69344 --- /dev/null +++ b/scripts/globals/spells/trust/kukki-chebukki.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Kukki-Chebukki +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/kupipi.lua b/scripts/globals/spells/trust/kupipi.lua new file mode 100644 index 00000000000..5c8f3d5a7cf --- /dev/null +++ b/scripts/globals/spells/trust/kupipi.lua @@ -0,0 +1,32 @@ +----------------------------------------- +-- Trust: Kupipi +----------------------------------------- +require("scripts/globals/trust") +require("scripts/globals/utils") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end + +function onMobSpawn(mob) + mob:addListener("COMBAT_TICK", "KUPIPI_COMBAT_TICK", function(trust, master, target) + function round(x) + return x >= 0 and math.floor(x + 0.5) or math.ceil(x - 0.5) + end + + local party = master:getPartyWithTrusts() + local lvl = trust:getMainLvl() + local maxCure = utils.clamp(round(lvl/8), 1, 6) + + for _, member in ipairs(party) do + if member:getHPP() <= 75 then + trust:castSpell(maxCure, member) + end + end + end) +end diff --git a/scripts/globals/spells/trust/kupofried.lua b/scripts/globals/spells/trust/kupofried.lua new file mode 100644 index 00000000000..dec80bb7ceb --- /dev/null +++ b/scripts/globals/spells/trust/kupofried.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Kupofried +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/kuyin_hathdenna.lua b/scripts/globals/spells/trust/kuyin_hathdenna.lua new file mode 100644 index 00000000000..5eab2c07b77 --- /dev/null +++ b/scripts/globals/spells/trust/kuyin_hathdenna.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Kuyin Hathdenna +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/lehko_habhoka.lua b/scripts/globals/spells/trust/lehko_habhoka.lua new file mode 100644 index 00000000000..12d4b0a6c5e --- /dev/null +++ b/scripts/globals/spells/trust/lehko_habhoka.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Lehko Habhoka +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/leonoyne.lua b/scripts/globals/spells/trust/leonoyne.lua new file mode 100644 index 00000000000..0af4d148752 --- /dev/null +++ b/scripts/globals/spells/trust/leonoyne.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Leonoyne +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/lhe_lhangavo.lua b/scripts/globals/spells/trust/lhe_lhangavo.lua new file mode 100644 index 00000000000..25418bc7e93 --- /dev/null +++ b/scripts/globals/spells/trust/lhe_lhangavo.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Lhe Lhangavo +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/lhu_mhakaracca.lua b/scripts/globals/spells/trust/lhu_mhakaracca.lua new file mode 100644 index 00000000000..5e655724330 --- /dev/null +++ b/scripts/globals/spells/trust/lhu_mhakaracca.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Lhu Mhakaracca +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/lilisette.lua b/scripts/globals/spells/trust/lilisette.lua new file mode 100644 index 00000000000..a5a4b2bf1a8 --- /dev/null +++ b/scripts/globals/spells/trust/lilisette.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Lilisette +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 1013) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/lilisette_ii.lua b/scripts/globals/spells/trust/lilisette_ii.lua new file mode 100644 index 00000000000..c25883c430e --- /dev/null +++ b/scripts/globals/spells/trust/lilisette_ii.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Lilisette II +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 945) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/lion.lua b/scripts/globals/spells/trust/lion.lua new file mode 100644 index 00000000000..1cd4a0b04eb --- /dev/null +++ b/scripts/globals/spells/trust/lion.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Lion +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 1009) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/lion_ii.lua b/scripts/globals/spells/trust/lion_ii.lua new file mode 100644 index 00000000000..9366c056930 --- /dev/null +++ b/scripts/globals/spells/trust/lion_ii.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Lion II +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 907) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/luzaf.lua b/scripts/globals/spells/trust/luzaf.lua new file mode 100644 index 00000000000..3b58210ced0 --- /dev/null +++ b/scripts/globals/spells/trust/luzaf.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Luzaf +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/maat.lua b/scripts/globals/spells/trust/maat.lua new file mode 100644 index 00000000000..6234b8b1cf6 --- /dev/null +++ b/scripts/globals/spells/trust/maat.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Maat +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 1006) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/maat_uc.lua b/scripts/globals/spells/trust/maat_uc.lua new file mode 100644 index 00000000000..3524ed20829 --- /dev/null +++ b/scripts/globals/spells/trust/maat_uc.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Maat UC +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 933) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/makki-chebukki.lua b/scripts/globals/spells/trust/makki-chebukki.lua new file mode 100644 index 00000000000..ab1e0b86892 --- /dev/null +++ b/scripts/globals/spells/trust/makki-chebukki.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Makki-Chebukki +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/margret.lua b/scripts/globals/spells/trust/margret.lua new file mode 100644 index 00000000000..29bfcace6ca --- /dev/null +++ b/scripts/globals/spells/trust/margret.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Margret +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/maximilian.lua b/scripts/globals/spells/trust/maximilian.lua new file mode 100644 index 00000000000..a990f31a0c0 --- /dev/null +++ b/scripts/globals/spells/trust/maximilian.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Maximilian +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/mayakov.lua b/scripts/globals/spells/trust/mayakov.lua new file mode 100644 index 00000000000..aa9070d9b9d --- /dev/null +++ b/scripts/globals/spells/trust/mayakov.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Mayakov +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/mihli_aliapoh.lua b/scripts/globals/spells/trust/mihli_aliapoh.lua new file mode 100644 index 00000000000..caecc6a6550 --- /dev/null +++ b/scripts/globals/spells/trust/mihli_aliapoh.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Mihli Aliapoh +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/mildaurion.lua b/scripts/globals/spells/trust/mildaurion.lua new file mode 100644 index 00000000000..555d937ed82 --- /dev/null +++ b/scripts/globals/spells/trust/mildaurion.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Mildaurion +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/mnejing.lua b/scripts/globals/spells/trust/mnejing.lua new file mode 100644 index 00000000000..0515932eb2d --- /dev/null +++ b/scripts/globals/spells/trust/mnejing.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Mnejing +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/monberaux.lua b/scripts/globals/spells/trust/monberaux.lua new file mode 100644 index 00000000000..7dc96b8aba4 --- /dev/null +++ b/scripts/globals/spells/trust/monberaux.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Monberaux +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/moogle.lua b/scripts/globals/spells/trust/moogle.lua new file mode 100644 index 00000000000..2e9dbdfd847 --- /dev/null +++ b/scripts/globals/spells/trust/moogle.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Moogle +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/morimar.lua b/scripts/globals/spells/trust/morimar.lua new file mode 100644 index 00000000000..653f9558e5c --- /dev/null +++ b/scripts/globals/spells/trust/morimar.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Morimar +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/mumor.lua b/scripts/globals/spells/trust/mumor.lua new file mode 100644 index 00000000000..cb018df46ce --- /dev/null +++ b/scripts/globals/spells/trust/mumor.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Mumor +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 1015) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/mumor_ii.lua b/scripts/globals/spells/trust/mumor_ii.lua new file mode 100644 index 00000000000..2f457e3cd27 --- /dev/null +++ b/scripts/globals/spells/trust/mumor_ii.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Mumor II +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 946) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/naja_salaheem.lua b/scripts/globals/spells/trust/naja_salaheem.lua new file mode 100644 index 00000000000..a9737261487 --- /dev/null +++ b/scripts/globals/spells/trust/naja_salaheem.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Naja Salaheem +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 1008) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/naja_uc.lua b/scripts/globals/spells/trust/naja_uc.lua new file mode 100644 index 00000000000..065f7cfd87c --- /dev/null +++ b/scripts/globals/spells/trust/naja_uc.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Naja Salaheem UC +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 912) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/najelith.lua b/scripts/globals/spells/trust/najelith.lua new file mode 100644 index 00000000000..8383d81ba57 --- /dev/null +++ b/scripts/globals/spells/trust/najelith.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Najelith +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/naji.lua b/scripts/globals/spells/trust/naji.lua new file mode 100644 index 00000000000..d4a4774e10c --- /dev/null +++ b/scripts/globals/spells/trust/naji.lua @@ -0,0 +1,44 @@ +----------------------------------------- +-- Trust: Naji +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end + +function onMobSpawn(mob) + mob:addListener("ENMITY_CHANGED", "NAJI_ENMITY_CHANGED", function(trust, master, target) + if trust:getID() ~= target:getID() then + trust:setLocalVar("tryProvoke", 1) + end + end) + + mob:addListener("COMBAT_TICK", "NAJI_COMBAT_TICK", function(trust, master, target) + local tryProvoke = trust:getLocalVar("tryProvoke") + local provokeReadyTime = trust:getLocalVar("provokeReadyTime") + + if tryProvoke == 1 and os.time() >= provokeReadyTime then + trust:useMobAbility(1945, target) + trust:setLocalVar("tryProvoke", 0) + trust:setLocalVar("provokeReadyTime", os.time() + 30) + end + + if trust:getTP() >= 1000 then + local weaponSkills = {33, 34, 40} + local ws = weaponSkills[math.random(1, #weaponSkills)] + trust:useMobAbility(ws, target) + end + end) +end + +function onMobDespawn(mob) +end + +function onMobDeath(mob) +end diff --git a/scripts/globals/spells/trust/nanaa_mihgo.lua b/scripts/globals/spells/trust/nanaa_mihgo.lua new file mode 100644 index 00000000000..8075680ee17 --- /dev/null +++ b/scripts/globals/spells/trust/nanaa_mihgo.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Nanaa Mihgo +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/nashmeira.lua b/scripts/globals/spells/trust/nashmeira.lua new file mode 100644 index 00000000000..122db74a50d --- /dev/null +++ b/scripts/globals/spells/trust/nashmeira.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Nashmeira +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 1012) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/nashmeira_ii.lua b/scripts/globals/spells/trust/nashmeira_ii.lua new file mode 100644 index 00000000000..4f0291cc11b --- /dev/null +++ b/scripts/globals/spells/trust/nashmeira_ii.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Nashmeira II +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 923) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/noillurie.lua b/scripts/globals/spells/trust/noillurie.lua new file mode 100644 index 00000000000..f8b5341171f --- /dev/null +++ b/scripts/globals/spells/trust/noillurie.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Noillurie +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/ovjang.lua b/scripts/globals/spells/trust/ovjang.lua new file mode 100644 index 00000000000..9f5e12105d6 --- /dev/null +++ b/scripts/globals/spells/trust/ovjang.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Ovjang +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/pieuje_uc.lua b/scripts/globals/spells/trust/pieuje_uc.lua new file mode 100644 index 00000000000..f7c70e2e9dc --- /dev/null +++ b/scripts/globals/spells/trust/pieuje_uc.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Pieuje UC +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/prishe.lua b/scripts/globals/spells/trust/prishe.lua new file mode 100644 index 00000000000..5b46f9d8a90 --- /dev/null +++ b/scripts/globals/spells/trust/prishe.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Prishe +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 1011) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/prishe_ii.lua b/scripts/globals/spells/trust/prishe_ii.lua new file mode 100644 index 00000000000..6a8e4b78469 --- /dev/null +++ b/scripts/globals/spells/trust/prishe_ii.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Prishe II +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 913) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/qultada.lua b/scripts/globals/spells/trust/qultada.lua new file mode 100644 index 00000000000..e7a586c4492 --- /dev/null +++ b/scripts/globals/spells/trust/qultada.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Qultada +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/rahal.lua b/scripts/globals/spells/trust/rahal.lua new file mode 100644 index 00000000000..156b7bf189a --- /dev/null +++ b/scripts/globals/spells/trust/rahal.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Rahal +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/rainemard.lua b/scripts/globals/spells/trust/rainemard.lua new file mode 100644 index 00000000000..fa85871e900 --- /dev/null +++ b/scripts/globals/spells/trust/rainemard.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Rainemard +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/robel-akbel.lua b/scripts/globals/spells/trust/robel-akbel.lua new file mode 100644 index 00000000000..0a6ff40589b --- /dev/null +++ b/scripts/globals/spells/trust/robel-akbel.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Robel-Akbel +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/romaa_mihgo.lua b/scripts/globals/spells/trust/romaa_mihgo.lua new file mode 100644 index 00000000000..15f0b32efc2 --- /dev/null +++ b/scripts/globals/spells/trust/romaa_mihgo.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Romaa Mihgo +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/rongelouts.lua b/scripts/globals/spells/trust/rongelouts.lua new file mode 100644 index 00000000000..e3500e679b3 --- /dev/null +++ b/scripts/globals/spells/trust/rongelouts.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Rongelouts +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/rosulatia.lua b/scripts/globals/spells/trust/rosulatia.lua new file mode 100644 index 00000000000..97df95144f2 --- /dev/null +++ b/scripts/globals/spells/trust/rosulatia.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Rosulatia +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/rughadjeen.lua b/scripts/globals/spells/trust/rughadjeen.lua new file mode 100644 index 00000000000..8a7bed72e5c --- /dev/null +++ b/scripts/globals/spells/trust/rughadjeen.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Rughadjeen +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/sakura.lua b/scripts/globals/spells/trust/sakura.lua new file mode 100644 index 00000000000..bcdd27235ed --- /dev/null +++ b/scripts/globals/spells/trust/sakura.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Sakura +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/selh_teus.lua b/scripts/globals/spells/trust/selh_teus.lua new file mode 100644 index 00000000000..0ce5092546a --- /dev/null +++ b/scripts/globals/spells/trust/selh_teus.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Selh'teus +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/semih_lafihna.lua b/scripts/globals/spells/trust/semih_lafihna.lua new file mode 100644 index 00000000000..e5dba67918a --- /dev/null +++ b/scripts/globals/spells/trust/semih_lafihna.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Semih Lafihna +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/shantotto.lua b/scripts/globals/spells/trust/shantotto.lua index 848dac68b51..b706db11dd8 100644 --- a/scripts/globals/spells/trust/shantotto.lua +++ b/scripts/globals/spells/trust/shantotto.lua @@ -1,16 +1,25 @@ ----------------------------------------- --- Spell: Shantotto +-- Trust: Shantotto ----------------------------------------- --- require("scripts/globals/trust") +require("scripts/globals/trust") ----------------------------------------- -function onMagicCastingCheck(caster,target,spell) - return 0 +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 1019) end -function onSpellCast(caster,target,spell) - -- Todo: put Trusts's spawn in dialog here or in entity script? - -- Todo: automate entity spawn in core for trust spells? - caster:spawnTrust(75) -- see pet_list.sql, this should be 896 but the pet list won't let me do that - return 0 +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end + +function onMobSpawn(mob) + mob:addListener("COMBAT_TICK", "SHANTOTTO_COMBAT_TICK", function(trust, master, target) + trust:castSpell() + end) +end + +function onMobDespawn(mob) +end + +function onMobDeath(mob) end diff --git a/scripts/globals/spells/trust/shantotto_ii.lua b/scripts/globals/spells/trust/shantotto_ii.lua new file mode 100644 index 00000000000..d52c78536bf --- /dev/null +++ b/scripts/globals/spells/trust/shantotto_ii.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Shantotto II +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 896) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/shikaree_z.lua b/scripts/globals/spells/trust/shikaree_z.lua new file mode 100644 index 00000000000..a8c545c72cb --- /dev/null +++ b/scripts/globals/spells/trust/shikaree_z.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Shikaree Z +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/star_sibyl.lua b/scripts/globals/spells/trust/star_sibyl.lua new file mode 100644 index 00000000000..511b8cc58c9 --- /dev/null +++ b/scripts/globals/spells/trust/star_sibyl.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Star Sibyl +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/sylvie_uc.lua b/scripts/globals/spells/trust/sylvie_uc.lua new file mode 100644 index 00000000000..1a433d07a12 --- /dev/null +++ b/scripts/globals/spells/trust/sylvie_uc.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Sylvie UC +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/tenzen.lua b/scripts/globals/spells/trust/tenzen.lua new file mode 100644 index 00000000000..9f53734984a --- /dev/null +++ b/scripts/globals/spells/trust/tenzen.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Tenzen +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 1014) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/tenzen_ii.lua b/scripts/globals/spells/trust/tenzen_ii.lua new file mode 100644 index 00000000000..4f988da7f42 --- /dev/null +++ b/scripts/globals/spells/trust/tenzen_ii.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Tenzen II +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 908) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/teodor.lua b/scripts/globals/spells/trust/teodor.lua new file mode 100644 index 00000000000..e446c62bda1 --- /dev/null +++ b/scripts/globals/spells/trust/teodor.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Teodor +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/trion.lua b/scripts/globals/spells/trust/trion.lua new file mode 100644 index 00000000000..b324e6630b8 --- /dev/null +++ b/scripts/globals/spells/trust/trion.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Trion +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/uka_totlihn.lua b/scripts/globals/spells/trust/uka_totlihn.lua new file mode 100644 index 00000000000..0225c5edd33 --- /dev/null +++ b/scripts/globals/spells/trust/uka_totlihn.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Uka Totlihn +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/ullegore.lua b/scripts/globals/spells/trust/ullegore.lua new file mode 100644 index 00000000000..c604f76010d --- /dev/null +++ b/scripts/globals/spells/trust/ullegore.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Ullegore +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/ulmia.lua b/scripts/globals/spells/trust/ulmia.lua new file mode 100644 index 00000000000..4aad48a8bc6 --- /dev/null +++ b/scripts/globals/spells/trust/ulmia.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Ulmia +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/valaineral.lua b/scripts/globals/spells/trust/valaineral.lua new file mode 100644 index 00000000000..2627d0fdbf9 --- /dev/null +++ b/scripts/globals/spells/trust/valaineral.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Valaineral +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/volker.lua b/scripts/globals/spells/trust/volker.lua new file mode 100644 index 00000000000..368b1f6a5ce --- /dev/null +++ b/scripts/globals/spells/trust/volker.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Volker +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/ygnas.lua b/scripts/globals/spells/trust/ygnas.lua new file mode 100644 index 00000000000..2189e578be0 --- /dev/null +++ b/scripts/globals/spells/trust/ygnas.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Ygnas +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/yoran-oran_uc.lua b/scripts/globals/spells/trust/yoran-oran_uc.lua new file mode 100644 index 00000000000..bb3a2f2c143 --- /dev/null +++ b/scripts/globals/spells/trust/yoran-oran_uc.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Yoran-Oran UC +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/zazarg.lua b/scripts/globals/spells/trust/zazarg.lua new file mode 100644 index 00000000000..f5fa9d62138 --- /dev/null +++ b/scripts/globals/spells/trust/zazarg.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Zazarg +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/zeid.lua b/scripts/globals/spells/trust/zeid.lua new file mode 100644 index 00000000000..ad8aa43c559 --- /dev/null +++ b/scripts/globals/spells/trust/zeid.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Zeid +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 1010) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/spells/trust/zeid_ii.lua b/scripts/globals/spells/trust/zeid_ii.lua new file mode 100644 index 00000000000..4fd04701236 --- /dev/null +++ b/scripts/globals/spells/trust/zeid_ii.lua @@ -0,0 +1,13 @@ +----------------------------------------- +-- Trust: Zeid II +----------------------------------------- +require("scripts/globals/trust") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + return tpz.trust.canCast(caster, spell, 906) +end + +function onSpellCast(caster, target, spell) + return tpz.trust.spawn(caster, spell) +end diff --git a/scripts/globals/status.lua b/scripts/globals/status.lua index 783cd9334c9..e44e8df2bb2 100644 --- a/scripts/globals/status.lua +++ b/scripts/globals/status.lua @@ -24,6 +24,7 @@ tpz.zoneMisc = TREASURE = 0x0100, -- Presence in the global zone TreasurePool AH = 0x0200, -- Ability to use the auction house YELL = 0x0400, -- Send and receive /yell commands + TRUST = 0x0800, -- Ability to cast trust magic } ------------------------------------ @@ -2102,11 +2103,13 @@ tpz.MAX_SLOTID = 15 tpz.objType = { - PC = 0x01, - NPC = 0x02, - MOB = 0x04, - PET = 0x08, - SHIP = 0x10, + PC = 0x01, + NPC = 0x02, + MOB = 0x04, + PET = 0x08, + SHIP = 0x10, + TRUST = 0x20, + FELLOW = 0x40, } ---------------------------------- diff --git a/scripts/globals/trust.lua b/scripts/globals/trust.lua new file mode 100644 index 00000000000..43659dea1e0 --- /dev/null +++ b/scripts/globals/trust.lua @@ -0,0 +1,84 @@ +--------------------------------------------------------- +-- Trust +--------------------------------------------------------- +require("scripts/globals/keyitems") +require("scripts/globals/msg") +require("scripts/globals/settings") +require("scripts/globals/status") +--------------------------------------------------------- + +tpz = tpz or {} +tpz.trust = tpz.trust or {} + +tpz.trust.canCast = function(caster, spell, not_allowed_trust_ids) + + -- TODO: Each of these scenarios has its own message + + -- Trusts not allowed in an alliance + if caster:checkSoloPartyAlliance() == 2 then + return tpz.msg.basic.TRUST_NO_CAST_TRUST + end + + -- Trusts only allowed in certain zones + if not caster:canUseMisc(tpz.zoneMisc.TRUST) then + -- TODO: Update area flags + --return tpz.msg.basic.TRUST_NO_CALL_AE + end + + -- You can only summon trusts if you are the party leader or solo + local leader = caster:getPartyLeader() + if leader and caster:getID() ~= leader:getID() then + return tpz.msg.basic.TRUST_NO_CAST_TRUST + end + + -- TODO: Block summoning trusts if someone recently joined party + + -- Check party for trusts + local num_pt = 0 + local num_trusts = 0 + local party = caster:getPartyWithTrusts() + for _, member in ipairs(party) do + if member:getObjType() == tpz.objType.TRUST then + -- Check for same trust + if member:getTrustID() == spell:getID() then + return tpz.msg.basic.TRUST_NO_CAST_TRUST + -- Check not allowed trust combinations (Shantotto I vs Shantotto II) + elseif type(not_allowed_trust_ids) == "number" then + if member:getTrustID() == not_allowed_trust_ids then + return tpz.msg.basic.TRUST_NO_CAST_TRUST + end + elseif type(not_allowed_trust_ids) == "table" then + for _, v in pairs(not_allowed_trust_ids) do + if type(v) == "number" then + if member:getTrustID() == v then + return tpz.msg.basic.TRUST_NO_CAST_TRUST + end + end + end + else + num_trusts = num_trusts + 1 + end + end + num_pt = num_pt + 1 + end + + -- Max party size + if num_pt >= 6 then + return tpz.msg.basic.TRUST_NO_CAST_TRUST + end + + -- Limits set by ROV Key Items + if num_trusts >= 3 and not caster:hasKeyItem(tpz.ki.RHAPSODY_IN_WHITE) then + return tpz.msg.basic.TRUST_NO_CAST_TRUST + elseif num_trusts >= 4 and not caster:hasKeyItem(tpz.ki.RHAPSODY_IN_CRIMSON) then + return tpz.msg.basic.TRUST_NO_CAST_TRUST + end + + return 0 +end + +tpz.trust.spawn = function(caster, spell) + caster:spawnTrust(spell:getID()) + + return 0 +end diff --git a/sql/mob_pools.sql b/sql/mob_pools.sql index d53bc277147..3cd7481803f 100644 --- a/sql/mob_pools.sql +++ b/sql/mob_pools.sql @@ -5953,130 +5953,131 @@ INSERT INTO `mob_pools` VALUES (5892,'Euryale','Euryale',171,0x06007106000000000 INSERT INTO `mob_pools` VALUES (5893,'Gloombound_Lurker','Gloombound_Lurker',221,0x0000230200000000000000000000000000000000,6,6,5,360,100,0,1,0,1,2,7,0,0,155,0,0,0,1,0,0); INSERT INTO `mob_pools` VALUES (5894,'Lesath','Lesath',217,0x00001C0100000000000000000000000000000000,1,1,7,280,100,0,1,0,1,2,7,0,238,141,0,0,0,1,0,370); INSERT INTO `mob_pools` VALUES (5895,'Donggu','Donggu',116,0x0000780100000000000000000000000000000000,1,1,11,240,100,0,0,0,1,2,7,0,0,3,0,0,0,1,0,116); -INSERT INTO `mob_pools` VALUES (5896,'Shantotto','Shantotto',153,0x0000B80B00000000000000000000000000000000,4,5,2,240,100,0,2,0,0,0,0,32,0,3,0,0,276,1,0,750); --- INSERT INTO `mob_pools` VALUES (5897,'naji', --- INSERT INTO `mob_pools` VALUES (5898,'kupipi', --- INSERT INTO `mob_pools` VALUES (5899,'excenmille', --- INSERT INTO `mob_pools` VALUES (5900,'ayame', --- INSERT INTO `mob_pools` VALUES (5901,'nanaa_mihgo', --- INSERT INTO `mob_pools` VALUES (5902,'curilla', --- INSERT INTO `mob_pools` VALUES (5903,'volker', --- INSERT INTO `mob_pools` VALUES (5904,'ajido-marujido', --- INSERT INTO `mob_pools` VALUES (5905,'trion', --- INSERT INTO `mob_pools` VALUES (5906,'zeid', --- INSERT INTO `mob_pools` VALUES (5907,'lion', --- INSERT INTO `mob_pools` VALUES (5908,'tenzen', --- INSERT INTO `mob_pools` VALUES (5909,'mihli_aliapoh', --- INSERT INTO `mob_pools` VALUES (5910,'valaineral', --- INSERT INTO `mob_pools` VALUES (5911,'joachim', --- INSERT INTO `mob_pools` VALUES (5912,'naja_salaheem', --- INSERT INTO `mob_pools` VALUES (5913,'prishe', --- INSERT INTO `mob_pools` VALUES (5914,'ulmia', --- INSERT INTO `mob_pools` VALUES (5915,'shikaree_z', --- INSERT INTO `mob_pools` VALUES (5916,'cherukiki', --- INSERT INTO `mob_pools` VALUES (5917,'iron_eater', --- INSERT INTO `mob_pools` VALUES (5918,'gessho', --- INSERT INTO `mob_pools` VALUES (5919,'gadalar', --- INSERT INTO `mob_pools` VALUES (5920,'rainemard', --- INSERT INTO `mob_pools` VALUES (5921,'ingrid', --- INSERT INTO `mob_pools` VALUES (5922,'lehko_habhoka', --- INSERT INTO `mob_pools` VALUES (5923,'nashmeira', --- INSERT INTO `mob_pools` VALUES (5924,'zazarg', --- INSERT INTO `mob_pools` VALUES (5925,'ovjang', --- INSERT INTO `mob_pools` VALUES (5926,'mnejing', --- INSERT INTO `mob_pools` VALUES (5927,'sakura', --- INSERT INTO `mob_pools` VALUES (5928,'luzaf', --- INSERT INTO `mob_pools` VALUES (5929,'najelith', --- INSERT INTO `mob_pools` VALUES (5930,'aldo', --- INSERT INTO `mob_pools` VALUES (5931,'moogle', --- INSERT INTO `mob_pools` VALUES (5932,'fablinix', --- INSERT INTO `mob_pools` VALUES (5933,'maat', --- INSERT INTO `mob_pools` VALUES (5934,'d_shantotto', --- INSERT INTO `mob_pools` VALUES (5935,'star_sibyl', --- INSERT INTO `mob_pools` VALUES (5936,'karaha-baruha', --- INSERT INTO `mob_pools` VALUES (5937,'cid', --- INSERT INTO `mob_pools` VALUES (5938,'gilgamesh', --- INSERT INTO `mob_pools` VALUES (5939,'areuhat', --- INSERT INTO `mob_pools` VALUES (5940,'semih_lafihna', --- INSERT INTO `mob_pools` VALUES (5941,'elivira', --- INSERT INTO `mob_pools` VALUES (5942,'noillurie', --- INSERT INTO `mob_pools` VALUES (5943,'lhu_mhakaracca', --- INSERT INTO `mob_pools` VALUES (5944,'ferreous_coffin', --- INSERT INTO `mob_pools` VALUES (5945,'lilisette', --- INSERT INTO `mob_pools` VALUES (5946,'mumor', --- INSERT INTO `mob_pools` VALUES (5947,'uka_totlihn', --- INSERT INTO `mob_pools` VALUES (5948,'klara', --- INSERT INTO `mob_pools` VALUES (5949,'romaa_mihgo', --- INSERT INTO `mob_pools` VALUES (5950,'kuyin_hathdenna', --- INSERT INTO `mob_pools` VALUES (5951,'rahal', --- INSERT INTO `mob_pools` VALUES (5952,'koru-moru', --- INSERT INTO `mob_pools` VALUES (5953,'pieuje_uc', --- INSERT INTO `mob_pools` VALUES (5954,'i_shield_uc', --- INSERT INTO `mob_pools` VALUES (5955,'apururu_uc', --- INSERT INTO `mob_pools` VALUES (5956,'jakoh_uc', --- INSERT INTO `mob_pools` VALUES (5957,'flaviria_uc', --- INSERT INTO `mob_pools` VALUES (5958,'babban', --- INSERT INTO `mob_pools` VALUES (5959,'abenzio', --- INSERT INTO `mob_pools` VALUES (5960,'rughadjeen', --- INSERT INTO `mob_pools` VALUES (5961,'kukki-chebukki', --- INSERT INTO `mob_pools` VALUES (5962,'margret', --- INSERT INTO `mob_pools` VALUES (5963,'chacharoon', --- INSERT INTO `mob_pools` VALUES (5964,'lhe_lhangavo', --- INSERT INTO `mob_pools` VALUES (5965,'arciela', --- INSERT INTO `mob_pools` VALUES (5966,'mayakov', --- INSERT INTO `mob_pools` VALUES (5967,'qultada', --- INSERT INTO `mob_pools` VALUES (5968,'adelheid', --- INSERT INTO `mob_pools` VALUES (5969,'amchuchu', --- INSERT INTO `mob_pools` VALUES (5970,'brygid', --- INSERT INTO `mob_pools` VALUES (5971,'mildaurion', --- INSERT INTO `mob_pools` VALUES (5972,'halver', --- INSERT INTO `mob_pools` VALUES (5973,'rongelouts', --- INSERT INTO `mob_pools` VALUES (5974,'leonoyne', --- INSERT INTO `mob_pools` VALUES (5975,'maximilian', --- INSERT INTO `mob_pools` VALUES (5976,'kayeel-payeel', --- INSERT INTO `mob_pools` VALUES (5977,'robel-akbel', --- INSERT INTO `mob_pools` VALUES (5978,'kupofried', --- INSERT INTO `mob_pools` VALUES (5979,'selh_teus', --- INSERT INTO `mob_pools` VALUES (5980,'yoran-oran_uc', --- INSERT INTO `mob_pools` VALUES (5981,'sylvie_uc', --- INSERT INTO `mob_pools` VALUES (5982,'abquhbah', --- INSERT INTO `mob_pools` VALUES (5983,'balamor', --- INSERT INTO `mob_pools` VALUES (5984,'august', --- INSERT INTO `mob_pools` VALUES (5985,'rosulatia', --- INSERT INTO `mob_pools` VALUES (5986,'teodor', --- INSERT INTO `mob_pools` VALUES (5987,'ullegore', --- INSERT INTO `mob_pools` VALUES (5988,'makki-chebukki', --- INSERT INTO `mob_pools` VALUES (5989,'king_of_hearts', --- INSERT INTO `mob_pools` VALUES (5990,'morimar', --- INSERT INTO `mob_pools` VALUES (5991,'darrcuiln', --- INSERT INTO `mob_pools` VALUES (5992,'aahm', --- INSERT INTO `mob_pools` VALUES (5993,'aaev', --- INSERT INTO `mob_pools` VALUES (5994,'aamr', --- INSERT INTO `mob_pools` VALUES (5995,'aatt', --- INSERT INTO `mob_pools` VALUES (5996,'aagk', --- INSERT INTO `mob_pools` VALUES (5997,'iroha', --- INSERT INTO `mob_pools` VALUES (5998,'ygnas', --- Reserved for future Trust 5999 +-- Trusts +INSERT INTO `mob_pools` VALUES (5896,'shantotto','Shantotto',153,0x0000B80B00000000000000000000000000000000,4,0,2,240,100,0,2,0,0,0,0,32,0,3,0,0,313,1,0,0); +INSERT INTO `mob_pools` VALUES (5897,'naji','Naji',149,0x0000B90B00000000000000000000000000000000,1,0,2,240,100,0,2,0,0,0,0,32,0,3,0,0,0,1,0,1011); +INSERT INTO `mob_pools` VALUES (5898,'kupipi','Kupipi',153,0x0000BA0B00000000000000000000000000000000,3,0,11,230,100,2,0,0,0,0,0,32,0,3,0,0,312,1,0,0); +INSERT INTO `mob_pools` VALUES (5899,'excenmille','Excenmille',145,0x0000BB0B00000000000000000000000000000000,7,0,8,390,100,0,0,0,0,0,0,32,0,3,0,0,309,1,0,0); +INSERT INTO `mob_pools` VALUES (5900,'ayame','Ayame',149,0x0000BC0B00000000000000000000000000000000,12,0,10,440,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5901,'nanaa_mihgo','NanaaMihgo',151,0x0000BD0B00000000000000000000000000000000,6,0,2,190,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5902,'curilla','Curilla',145,0x0000BE0B00000000000000000000000000000000,7,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,308,1,0,0); +INSERT INTO `mob_pools` VALUES (5903,'volker','Volker',149,0x0000BF0B00000000000000000000000000000000,1,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,8,1,0,1011); +INSERT INTO `mob_pools` VALUES (5904,'ajido-marujido','Ajido-Marujido',153,0x0000C00B00000000000000000000000000000000,4,5,1,400,100,0,0,0,0,0,0,32,0,3,0,0,311,1,0,0); +INSERT INTO `mob_pools` VALUES (5905,'trion','Trion',145,0x0000C10B00000000000000000000000000000000,7,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,310,1,0,1011); +INSERT INTO `mob_pools` VALUES (5906,'zeid','Zeid',146,0x0000C20B00000000000000000000000000000000,8,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5907,'lion','Lion',149,0x0000C30B00000000000000000000000000000000,6,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5908,'tenzen','Tenzen',149,0x0000C40B00000000000000000000000000000000,12,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5909,'mihli_aliapoh','MihliAliapoh',151,0x0000C50B00000000000000000000000000000000,3,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5910,'valaineral','Valaineral',145,0x0000C60B00000000000000000000000000000000,7,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5911,'joachim','Joachim',149,0x0000C70B00000000000000000000000000000000,10,3,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5912,'naja_salaheem','NajaSalaheem',151,0x0000C80B00000000000000000000000000000000,2,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5913,'prishe','Prishe',145,0x0000C90B00000000000000000000000000000000,2,3,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5914,'ulmia','Ulmia',145,0x0000CA0B00000000000000000000000000000000,10,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5915,'shikaree_z','ShikareeZ',151,0x0000CB0B00000000000000000000000000000000,14,3,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5916,'cherukiki','Cherukiki',153,0x0000CC0B00000000000000000000000000000000,3,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5917,'iron_eater','IronEater',146,0x0000CD0B00000000000000000000000000000000,1,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,1011); +INSERT INTO `mob_pools` VALUES (5918,'gessho','Gessho',270,0x0000CE0B00000000000000000000000000000000,13,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5919,'gadalar','Gadalar',149,0x0000CF0B00000000000000000000000000000000,4,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5920,'rainemard','Rainemard',145,0x0000D00B00000000000000000000000000000000,5,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5921,'ingrid','Ingrid',149,0x0000D10B00000000000000000000000000000000,3,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5922,'lehko_habhoka','LehkoHabhoka',151,0x0000D20B00000000000000000000000000000000,6,4,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5923,'nashmeira','Nashmeira',149,0x0000D30B00000000000000000000000000000000,18,3,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5924,'zazarg','Zazarg',146,0x0000D40B00000000000000000000000000000000,2,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5925,'ovjang','Ovjang',366,0x0000D50B00000000000000000000000000000000,5,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5926,'mnejing','Mnejing',364,0x0000D60B00000000000000000000000000000000,7,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5927,'sakura','Sakura',55,0x0000D70B00000000000000000000000000000000,21,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5928,'luzaf','Luzaf',145,0x0000D80B00000000000000000000000000000000,17,13,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5929,'najelith','Najelith',149,0x0000D90B00000000000000000000000000000000,11,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5930,'aldo','Aldo',149,0x0000DA0B00000000000000000000000000000000,6,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5931,'moogle','Moogle',185,0x0000DB0B00000000000000000000000000000000,21,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5932,'fablinix','Fablinix',327,0x0000DC0B00000000000000000000000000000000,6,4,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5933,'maat','Maat',149,0x0000DD0B00000000000000000000000000000000,2,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5934,'d_shantotto','D.Shantotto',153,0x0000DE0B00000000000000000000000000000000,4,8,3,240,100,0,0,0,0,0,0,32,0,3,0,0,313,1,0,0); +INSERT INTO `mob_pools` VALUES (5935,'star_sibyl','StarSibyl',153,0x0000DF0B00000000000000000000000000000000,21,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5936,'karaha-baruha','Karaha-Baruha',153,0x0000E00B00000000000000000000000000000000,3,15,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5937,'cid','Cid',149,0x0000E10B00000000000000000000000000000000,1,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5938,'gilgamesh','Gilgamesh',149,0x0000E20B00000000000000000000000000000000,12,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5939,'areuhat','Areuhat',145,0x0000E30B00000000000000000000000000000000,1,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5940,'semih_lafihna','SemihLafihna',151,0x0000E40B00000000000000000000000000000000,11,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5941,'elivira','Elivira',149,0x0000E50B00000000000000000000000000000000,11,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5942,'noillurie','Noillurie',145,0x0000E60B00000000000000000000000000000000,12,7,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5943,'lhu_mhakaracca','LhuMhakaracca',151,0x0000E70B00000000000000000000000000000000,9,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5944,'ferreous_coffin','FerreousCoffin',146,0x0000E80B00000000000000000000000000000000,3,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5945,'lilisette','Lilisette',484,0x0000E90B00000000000000000000000000000000,19,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5946,'mumor','Mumor',149,0x0000EA0B00000000000000000000000000000000,19,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5947,'uka_totlihn','UkaTotlihn',151,0x0000EB0B00000000000000000000000000000000,19,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5948,'klara','Klara',149,0x0000ED0B00000000000000000000000000000000,1,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5949,'romaa_mihgo','RomaaMihgo',151,0x0000EE0B00000000000000000000000000000000,6,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5950,'kuyin_hathdenna','KuyinHathdenna',151,0x0000EF0B00000000000000000000000000000000,21,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5951,'rahal','Rahal',145,0x0000F00B00000000000000000000000000000000,7,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5952,'koru-moru','Koru-Moru',153,0x0000F10B00000000000000000000000000000000,5,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5953,'pieuje_uc','Pieuje',145,0x0000F20B00000000000000000000000000000000,3,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5954,'i_shield_uc','InvincibleShld',146,0x0000F40B00000000000000000000000000000000,1,2,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5955,'apururu_uc','Apururu',153,0x0000F50B00000000000000000000000000000000,3,5,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5956,'jakoh_uc','JakohWahcondalo',151,0x0000F60B00000000000000000000000000000000,6,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5957,'flaviria_uc','Flaviria',145,0x0000F30B00000000000000000000000000000000,14,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5958,'babban','Babban',178,0x0000FB0B00000000000000000000000000000000,2,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5959,'abenzio','Abenzio',136,0x0000FC0B00000000000000000000000000000000,2,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5960,'rughadjeen','Rughadjeen',145,0x0000FD0B00000000000000000000000000000000,7,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5961,'kukki-chebukki','Kukki-Chebukki',153,0x0000FE0B00000000000000000000000000000000,4,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5962,'margret','Margret',149,0x0000FF0B00000000000000000000000000000000,11,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5963,'chacharoon','Chacharoon',199,0x0000000C00000000000000000000000000000000,6,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5964,'lhe_lhangavo','LheLhangavo',145,0x0000010C00000000000000000000000000000000,2,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5965,'arciela','Arciela',149,0x0000020C00000000000000000000000000000000,5,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5966,'mayakov','Mayakov',149,0x0000030C00000000000000000000000000000000,19,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5967,'qultada','Qultada',145,0x0000040C00000000000000000000000000000000,17,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5968,'adelheid','Adelheid',149,0x0000050C00000000000000000000000000000000,20,4,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5969,'amchuchu','Amchuchu',153,0x0000060C00000000000000000000000000000000,22,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5970,'brygid','Brygid',149,0x0000070C00000000000000000000000000000000,21,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5971,'mildaurion','Mildaurion',149,0x0000080C00000000000000000000000000000000,1,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5972,'halver','Halver',145,0x00000F0C00000000000000000000000000000000,7,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5973,'rongelouts','Rongelouts',145,0x0000100C00000000000000000000000000000000,1,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5974,'leonoyne','Leonoyne',145,0x0000110C00000000000000000000000000000000,4,8,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5975,'maximilian','Maximilian',149,0x0000120C00000000000000000000000000000000,6,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5976,'kayeel-payeel','Kayeel-Payeel',153,0x0000130C00000000000000000000000000000000,4,15,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5977,'robel-akbel','Robel-Akbel',153,0x0000140C00000000000000000000000000000000,4,15,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5978,'kupofried','Kupofried',185,0x0000150C00000000000000000000000000000000,21,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5979,'selh_teus','Selh\'teus',477,0x0000160C00000000000000000000000000000000,7,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5980,'yoran-oran_uc','Yoran-Oran',153,0x0000170C00000000000000000000000000000000,3,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5981,'sylvie_uc','Sylvie',149,0x0000180C00000000000000000000000000000000,21,3,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5982,'abquhbah','Abquhbah',149,0x00001A0C00000000000000000000000000000000,1,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5983,'balamor','Balamor',492,0x00001B0C00000000000000000000000000000000,8,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5984,'august','August',149,0x00001C0C00000000000000000000000000000000,7,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5985,'rosulatia','Rosulatia',455,0x00001D0C00000000000000000000000000000000,4,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5986,'teodor','Teodor',149,0x00001F0C00000000000000000000000000000000,4,6,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5987,'ullegore','Ullegore',74,0x0000210C00000000000000000000000000000000,4,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5988,'makki-chebukki','Makki-Chebukki',153,0x0000220C00000000000000000000000000000000,11,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5989,'king_of_hearts','KingOfHearts',61,0x0000230C00000000000000000000000000000000,5,3,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5990,'morimar','Morimar',149,0x0000240C00000000000000000000000000000000,9,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5991,'darrcuiln','Darrcuiln',489,0x0000250C00000000000000000000000000000000,1,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5992,'aahm','ArkHM',149,0x0000290C00000000000000000000000000000000,1,13,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5993,'aaev','ArkEV',145,0x00002A0C00000000000000000000000000000000,7,3,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5994,'aamr','ArkMR',151,0x00002B0C00000000000000000000000000000000,9,6,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5995,'aatt','ArkTT',153,0x00002C0C00000000000000000000000000000000,4,8,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5996,'aagk','ArkGK',146,0x00002D0C00000000000000000000000000000000,12,14,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5997,'iroha','Iroha',149,0x0000270C00000000000000000000000000000000,12,4,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5998,'ygnas','Ygnas',455,0x00002E0C00000000000000000000000000000000,3,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (5999,'monberaux','Monberaux',145,0x0000260300000000000000000000000000000000,21,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); -- Reserved for future Trust 6000 -- Reserved for future Trust 6001 -- Reserved for future Trust 6002 --- INSERT INTO `mob_pools` VALUES (6003,'cornelia', --- INSERT INTO `mob_pools` VALUES (6004,'excenmille_s', --- INSERT INTO `mob_pools` VALUES (6005,'ayame_uc', --- INSERT INTO `mob_pools` VALUES (6006,'maat_uc', --- INSERT INTO `mob_pools` VALUES (6007,'aldo_uc', --- INSERT INTO `mob_pools` VALUES (6008,'naja_uc', --- INSERT INTO `mob_pools` VALUES (6009,'lion_ii', --- INSERT INTO `mob_pools` VALUES (6010,'zeid_ii', --- INSERT INTO `mob_pools` VALUES (6011,'prishe_ii', --- INSERT INTO `mob_pools` VALUES (6012,'nashmeira_ii', --- INSERT INTO `mob_pools` VALUES (6013,'lilisette_ii', --- INSERT INTO `mob_pools` VALUES (6014,'tenzen_ii', --- INSERT INTO `mob_pools` VALUES (6015,'mumor_ii', --- INSERT INTO `mob_pools` VALUES (6016,'ingrid_ii', --- INSERT INTO `mob_pools` VALUES (6017,'arciela_ii', --- INSERT INTO `mob_pools` VALUES (6018,'iroha_ii', -INSERT INTO `mob_pools` VALUES (6019,'shantotto_ii','shantotto_ii',153,0x0000260C00000000000000000000000000000000,4,5,2,240,100,0,2,0,0,0,0,32,0,3,0,0,276,1,0,750); +-- INSERT INTO `mob_pools` VALUES (6003,'cornelia','Cornelia',145,0x00002F0C00000000000000000000000000000000,21,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (6004,'excenmille_s','Excenmille',145,0x0000EC0B00000000000000000000000000000000,1,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (6005,'ayame_uc','Ayame',149,0x0000F70B00000000000000000000000000000000,12,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (6006,'maat_uc','Maat',149,0x0000F80B00000000000000000000000000000000,2,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (6007,'aldo_uc','Aldo',149,0x0000F90B00000000000000000000000000000000,6,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (6008,'naja_uc','NajaSalaheem',151,0x0000FA0B00000000000000000000000000000000,6,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (6009,'lion_ii','Lion',149,0x0000090C00000000000000000000000000000000,6,13,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (6010,'zeid_ii','Zeid',146,0x00000E0C00000000000000000000000000000000,8,1,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (6011,'prishe_ii','Prishe',145,0x00000A0C00000000000000000000000000000000,2,3,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (6012,'nashmeira_ii','Nashmeira',149,0x00000B0C00000000000000000000000000000000,18,3,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (6013,'lilisette_ii','Lilisette',484,0x00000C0C00000000000000000000000000000000,19,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (6014,'tenzen_ii','Tenzen',149,0x0000190C00000000000000000000000000000000,12,11,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (6015,'mumor_ii','Mumor',149,0x0000200C00000000000000000000000000000000,4,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (6016,'ingrid_ii','Ingrid',149,0x00001E0C00000000000000000000000000000000,3,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (6017,'arciela_ii','Arciela',149,0x00000D0C00000000000000000000000000000000,5,0,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (6018,'iroha_ii','Iroha',149,0x0000280C00000000000000000000000000000000,12,3,3,240,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,0); +INSERT INTO `mob_pools` VALUES (6019,'shantotto_ii','Shantotto',153,0x0000260C00000000000000000000000000000000,4,0,2,240,100,0,2,0,0,0,0,32,0,3,0,0,313,1,0,0); -- Reserved for future Trust 6020 -- Reserved for future Trust 6021 -- Reserved for future Trust 6022 diff --git a/sql/mob_skill_lists.sql b/sql/mob_skill_lists.sql index 0bf1552a835..43d6b397f61 100644 --- a/sql/mob_skill_lists.sql +++ b/sql/mob_skill_lists.sql @@ -3461,3 +3461,4 @@ INSERT INTO `mob_skill_lists` VALUES ('Siren',1010,3512); -- Sonic Buffet INSERT INTO `mob_skill_lists` VALUES ('Siren',1010,3513); -- Entice INSERT INTO `mob_skill_lists` VALUES ('Siren',1010,3514); -- Hysteric Assault INSERT INTO `mob_skill_lists` VALUES ('Siren',1010,3515); -- Clarsach Call +INSERT INTO `mob_skill_lists` VALUES ('TRUST_Trion',1011,1945); -- Provoke diff --git a/sql/mob_skills.sql b/sql/mob_skills.sql index 5730f633c16..f625e9182ec 100644 --- a/sql/mob_skills.sql +++ b/sql/mob_skills.sql @@ -527,7 +527,7 @@ INSERT INTO `mob_skills` VALUES (696,432,'soul_voice',0,7.0,2000,0,1,2,0,0,0,0,0 -- INSERT INTO `mob_skills` VALUES (704,448,'counterstance',0,7.0,2000,1500,4,0,0,0,0,0,0); -- INSERT INTO `mob_skills` VALUES (705,449,'hide',0,7.0,2000,1500,4,0,0,0,0,0,0); -- INSERT INTO `mob_skills` VALUES (706,450,'bash',0,7.0,2000,1500,4,0,0,0,0,0,0); --- INSERT INTO `mob_skills` VALUES (707,451,'sentinel',0,7.0,2000,1500,4,0,0,0,0,0,0); +INSERT INTO `mob_skills` VALUES (707,451,'sentinel',0,7.0,2000,1500,4,0,0,0,0,0,0); -- INSERT INTO `mob_skills` VALUES (708,452,'last_resort',0,7.0,2000,1500,4,0,0,0,0,0,0); -- INSERT INTO `mob_skills` VALUES (709,453,'souleater',0,7.0,2000,1500,4,0,0,0,0,0,0); INSERT INTO `mob_skills` VALUES (710,438,'charm',0,18.0,2000,0,4,0,0,0,0,0,0); @@ -1765,7 +1765,7 @@ INSERT INTO `mob_skills` VALUES (1941,1305,'string_clipper',0,7.0,2000,1,4,0,0,0 INSERT INTO `mob_skills` VALUES (1942,1303,'arcuballista',0,15.0,2000,1,4,0,0,0,3,1,0); INSERT INTO `mob_skills` VALUES (1943,1306,'slapstick',0,7.0,2000,1,4,0,0,0,8,0,0); INSERT INTO `mob_skills` VALUES (1944,1307,'shield_bash',0,7.0,2000,0,4,4,0,0,0,0,0); -INSERT INTO `mob_skills` VALUES (1945,1219,'provoke',0,7.0,2000,0,4,4,0,0,0,0,0); +INSERT INTO `mob_skills` VALUES (1945,1218,'provoke',0,7.0,2000,0,4,4,0,0,0,0,0); INSERT INTO `mob_skills` VALUES (1946,435,'shock_absorber',0,7.0,2000,0,16,4,0,0,0,0,0); INSERT INTO `mob_skills` VALUES (1947,438,'flashbulb',0,7.0,2000,0,4,4,0,0,0,0,0); INSERT INTO `mob_skills` VALUES (1948,439,'mana_converter',0,7.0,2000,0,16,4,0,0,0,0,0); diff --git a/sql/mob_spell_lists.sql b/sql/mob_spell_lists.sql index cdde37c532e..e934071070a 100644 --- a/sql/mob_spell_lists.sql +++ b/sql/mob_spell_lists.sql @@ -2515,6 +2515,107 @@ INSERT INTO `mob_spell_lists` VALUES ('Ghul-I-Beaban_BLM',305,174,1,255); -- fir INSERT INTO `mob_spell_lists` VALUES ('Ghul-I-Beaban_BLM',305,179,1,255); -- blizzaga INSERT INTO `mob_spell_lists` VALUES ('Saa_Doyi_the_Fervid',306,320,1,255); -- katon_ichi INSERT INTO `mob_spell_lists` VALUES ('Frost_Flambeau',307,180,1,255); -- blizzaga_ii +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Curilla',308,1,5,255); -- Cure +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Curilla',308,2,17,255); -- Cure II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Curilla',308,3,30,255); -- Cure III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Curilla',308,4,55,255); -- Cure IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Curilla',308,112,37,255); -- Flash +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Excenmille',309,1,5,255); -- Cure +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Excenmille',309,2,17,255); -- Cure II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Excenmille',309,3,30,255); -- Cure III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Excenmille',309,4,55,255); -- Cure IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Excenmille',309,112,37,255); -- Flash +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Trion',310,1,5,255); -- Cure +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Trion',310,2,17,255); -- Cure II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Trion',310,3,30,255); -- Cure III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Trion',310,4,55,255); -- Cure IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Trion',310,112,37,255); -- Flash +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,1,3,255); -- Cure +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,2,14,255); -- Cure II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,3,26,255); -- Cure III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,4,48,255); -- Cure IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,56,13,255); -- Slow +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,144,13,255); -- Fire +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,145,38,255); -- Fire II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,146,62,255); -- Fire III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,147,73,255); -- Fire IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,148,86,255); -- Fire V +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,149,17,255); -- Blizzard +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,150,42,255); -- Blizzard II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,151,64,255); -- Blizzard III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,152,74,255); -- Blizzard IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,153,89,255); -- Blizzard V +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,154,9,255); -- Aero +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,155,34,255); -- Aero II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,156,59,255); -- Aero III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,157,72,255); -- Aero IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,158,83,255); -- Aero V +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,159,1,255); -- Stone +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,160,26,255); -- Stone II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,161,51,255); -- Stone III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,162,68,255); -- Stone IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,163,77,255); -- Stone V +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,164,21,255); -- Thunder +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,165,46,255); -- Thunder II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,166,66,255); -- Thunder III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,167,75,255); -- Thunder IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,168,92,255); -- Thunder V +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,169,5,255); -- Water +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,170,30,255); -- Water II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,171,55,255); -- Water III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,172,70,255); -- Water IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,173,80,255); -- Water V +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Ajido-Marujido',311,260,32,255); -- Dispel +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,1,1,255); -- Cure +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,2,11,255); -- Cure II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,3,21,255); -- Cure III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,4,41,255); -- Cure IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,5,61,255); -- Cure V +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,6,80,255); -- Cure VI +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,125,7,255); -- Protectra +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,126,27,255); -- Protectra II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,127,47,255); -- Protectra III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,128,63,255); -- Protectra IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,129,75,255); -- Protectra V +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,130,17,255); -- Shellra +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,131,37,255); -- Shellra II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,132,57,255); -- Shellra III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,133,68,255); -- Shellra IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,134,75,255); -- Shellra V +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,143,32,255); -- Erase +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,58,4,255); -- Paralyze +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,56,13,255); -- Slow +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Kupipi',312,112,45,255); -- Flash +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,144,13,255); -- Fire +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,145,38,255); -- Fire II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,146,62,255); -- Fire III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,147,73,255); -- Fire IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,148,86,255); -- Fire V +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,149,17,255); -- Blizzard +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,150,42,255); -- Blizzard II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,151,64,255); -- Blizzard III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,152,74,255); -- Blizzard IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,153,89,255); -- Blizzard V +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,154,9,255); -- Aero +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,155,34,255); -- Aero II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,156,59,255); -- Aero III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,157,72,255); -- Aero IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,158,83,255); -- Aero V +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,159,1,255); -- Stone +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,160,26,255); -- Stone II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,161,51,255); -- Stone III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,162,68,255); -- Stone IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,163,77,255); -- Stone V +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,164,21,255); -- Thunder +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,165,46,255); -- Thunder II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,166,66,255); -- Thunder III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,167,75,255); -- Thunder IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,168,92,255); -- Thunder V +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,169,5,255); -- Water +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,170,30,255); -- Water II +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,171,55,255); -- Water III +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,172,70,255); -- Water IV +INSERT INTO `mob_spell_lists` VALUES ('TRUST_Shantotto',313,173,80,255); -- Water V /*!40000 ALTER TABLE `mob_spell_lists` ENABLE KEYS */; UNLOCK TABLES; diff --git a/sql/pet_list.sql b/sql/pet_list.sql index b6346d15d16..6efff963e5b 100644 --- a/sql/pet_list.sql +++ b/sql/pet_list.sql @@ -117,6 +117,4 @@ INSERT INTO `pet_list` VALUES (72, 'StormwakerFrame', 5127, 1, 99, 0, 0); -- INSERT INTO `pet_list` VALUES (73, 'AdventuringFellow', 0, 1, 99, 0, 0); -- 74 is Chocobo in the enum.. - --- trusts.. TODO: Make trusts not use petlist at all. -INSERT INTO `pet_list` VALUES (75, 'Shantotto', 5896, 1, 99, 0, 0); +-- INSERT INTO `pet_list` VALUES (75, 'Trust', 0, 1, 99, 0, 0); diff --git a/sql/spell_list.sql b/sql/spell_list.sql index 04a6eb8dee2..2558bcbfbf7 100644 --- a/sql/spell_list.sql +++ b/sql/spell_list.sql @@ -964,11 +964,11 @@ INSERT INTO `spell_list` VALUES (995,'aatt',0x0101010101010101010101010101010101 INSERT INTO `spell_list` VALUES (996,'aagk',0x01010101010101010101010101010101010101010101,8,7,0,1,0,0,3000,24000,0,0,939,1500,0,0,1.00,0,0,0,0,NULL); INSERT INTO `spell_list` VALUES (997,'iroha',0x01010101010101010101010101010101010101010101,8,7,0,1,0,0,3000,24000,0,0,939,1500,0,0,1.00,0,0,0,0,NULL); INSERT INTO `spell_list` VALUES (998,'ygnas',0x01010101010101010101010101010101010101010101,8,7,0,1,0,0,3000,24000,0,0,939,1500,0,0,1.00,0,0,0,0,NULL); --- 999 +INSERT INTO `spell_list` VALUES (999,'monberaux',0x01010101010101010101010101010101010101010101,8,7,0,1,0,0,3000,24000,0,0,939,1500,0,0,1.00,0,0,0,0,NULL); -- 1000 -- 1001 -- 1002 -INSERT INTO `spell_list` VALUES (1003,'cornelia',0x01010101010101010101010101010101010101010101,8,7,0,1,0,0,3000,24000,0,0,939,1500,0,0,1.00,0,0,0,0,NULL); +-- 1003 (Trust: Cornelia, has been removed May 2018) INSERT INTO `spell_list` VALUES (1004,'excenmille_s',0x01010101010101010101010101010101010101010101,8,7,0,1,0,0,3000,24000,0,0,939,1500,0,0,1.00,0,0,0,0,NULL); INSERT INTO `spell_list` VALUES (1005,'ayame_uc',0x01010101010101010101010101010101010101010101,8,7,0,1,0,0,3000,24000,0,0,939,1500,0,0,1.00,0,0,0,0,NULL); INSERT INTO `spell_list` VALUES (1006,'maat_uc',0x01010101010101010101010101010101010101010101,8,7,0,1,0,0,3000,24000,0,0,939,1500,0,0,1.00,0,0,0,0,NULL); diff --git a/src/map/ai/controllers/mob_controller.cpp b/src/map/ai/controllers/mob_controller.cpp index 163879d1443..8c0d38571ef 100644 --- a/src/map/ai/controllers/mob_controller.cpp +++ b/src/map/ai/controllers/mob_controller.cpp @@ -478,7 +478,11 @@ void CMobController::CastSpell(SpellID spellid) { PCastTarget = PTarget; } - Cast(PCastTarget->targid, spellid); + + if (PCastTarget) + { + Cast(PCastTarget->targid, spellid); + } } } @@ -675,7 +679,7 @@ void CMobController::DoRoamTick(time_point tick) else if (PMob->m_OwnerID.id != 0 && !(PMob->m_roamFlags & ROAMFLAG_IGNORE)) { // i'm claimed by someone and need hate towards this person - PTarget = (CBattleEntity*)PMob->GetEntity(PMob->m_OwnerID.targid, TYPE_PC | TYPE_MOB | TYPE_PET); + PTarget = (CBattleEntity*)PMob->GetEntity(PMob->m_OwnerID.targid, TYPE_PC | TYPE_MOB | TYPE_PET | TYPE_TRUST); PMob->PEnmityContainer->AddBaseEnmity(PTarget); diff --git a/src/map/ai/controllers/trust_controller.cpp b/src/map/ai/controllers/trust_controller.cpp index 6e0f77656ff..461c2a648d5 100644 --- a/src/map/ai/controllers/trust_controller.cpp +++ b/src/map/ai/controllers/trust_controller.cpp @@ -23,15 +23,14 @@ along with this program. If not, see http://www.gnu.org/licenses/ #include "../ai_container.h" #include "../../status_effect_container.h" +#include "../../enmity_container.h" #include "../../ai/states/despawn_state.h" #include "../../entities/charentity.h" #include "../../entities/trustentity.h" #include "../../packets/char.h" -#include "../../../common/utils.h" -CTrustController::CTrustController(CCharEntity* PChar, CTrustEntity* PTrust) : CController(PTrust) +CTrustController::CTrustController(CCharEntity* PChar, CTrustEntity* PTrust) : CMobController(PTrust) { - POwner->PAI->PathFind = std::make_unique(PTrust); } CTrustController::~CTrustController() @@ -42,21 +41,26 @@ CTrustController::~CTrustController() } POwner->PAI->PathFind.reset(); POwner->allegiance = ALLEGIANCE_PLAYER; + POwner->PMaster = nullptr; + + m_LastTopEntity = nullptr; } void CTrustController::Despawn() { - if (POwner->PMaster) - { - POwner->PMaster = nullptr; - } - CController::Despawn(); + POwner->animation = ANIMATION_DESPAWN; + CMobController::Despawn(); } void CTrustController::Tick(time_point tick) { m_Tick = tick; + if (POwner->PMaster == nullptr) + { + return; + } + if (POwner->PAI->IsEngaged()) { DoCombatTick(tick); @@ -72,12 +76,18 @@ void CTrustController::DoCombatTick(time_point tick) if (!POwner->PMaster->PAI->IsEngaged()) { POwner->PAI->Internal_Disengage(); + m_LastTopEntity = nullptr; } + if (POwner->PMaster->GetBattleTargetID() != POwner->GetBattleTargetID()) { POwner->PAI->Internal_ChangeTarget(POwner->PMaster->GetBattleTargetID()); + m_LastTopEntity = nullptr; } - auto PTarget{ POwner->GetBattleTarget() }; + + float currentDistance = distance(POwner->loc.p, POwner->PMaster->loc.p); + PTarget = POwner->GetBattleTarget(); + if (PTarget) { if (POwner->PAI->CanFollowPath()) @@ -88,17 +98,27 @@ void CTrustController::DoCombatTick(time_point tick) { if (POwner->speed > 0) { - POwner->PAI->PathFind->PathAround(PTarget->loc.p, 2.0f, PATHFLAG_WALLHACK | PATHFLAG_RUN); + auto new_position = GetDeclumpedPosition(PTarget->loc.p); + POwner->PAI->PathFind->PathAround(new_position, 3.0f, PATHFLAG_RUN | PATHFLAG_WALLHACK | PATHFLAG_SLIDE); POwner->PAI->PathFind->FollowPath(); } } } + + auto currentTopEnmity = GetTopEnmity(); + if (m_LastTopEntity != currentTopEnmity) + { + POwner->PAI->EventHandler.triggerListener("ENMITY_CHANGED", POwner, POwner->PMaster, PTarget); + m_LastTopEntity = currentTopEnmity; + } + + POwner->PAI->EventHandler.triggerListener("COMBAT_TICK", POwner, POwner->PMaster, PTarget); } } void CTrustController::DoRoamTick(time_point tick) { - if (POwner->PMaster->PAI->IsEngaged()) + if (POwner->PMaster->PAI->IsEngaged() && GetTopEnmity() == POwner->PMaster) { POwner->PAI->Internal_Engage(POwner->PMaster->GetBattleTargetID()); } @@ -107,7 +127,8 @@ void CTrustController::DoRoamTick(time_point tick) if (currentDistance > RoamDistance) { - if (currentDistance < 35.0f && POwner->PAI->PathFind->PathAround(POwner->PMaster->loc.p, 2.0f, PATHFLAG_RUN | PATHFLAG_WALLHACK)) + auto new_position = GetDeclumpedPosition(POwner->PMaster->loc.p); + if (currentDistance < 30.0f && POwner->PAI->PathFind->PathAround(new_position, 2.0f, PATHFLAG_RUN | PATHFLAG_WALLHACK | PATHFLAG_SLIDE)) { POwner->PAI->PathFind->FollowPath(); } @@ -117,3 +138,56 @@ void CTrustController::DoRoamTick(time_point tick) } } } + +bool CTrustController::Ability(uint16 targid, uint16 abilityid) +{ + if (POwner->PAI->CanChangeState()) + { + return POwner->PAI->Internal_Ability(targid, abilityid); + } + return false; +} + +CBattleEntity* CTrustController::GetTopEnmity() +{ + CBattleEntity* PEntity = nullptr; + if (auto PMob = dynamic_cast(POwner->PMaster->GetBattleTarget())) + { + return PMob->PEnmityContainer->GetHighestEnmity(); + } + return PEntity; +} + +position_t CTrustController::GetDeclumpedPosition(position_t target_pos) +{ + auto lerp = [](float a, float b, float f) + { + return a + f * (b - a); + }; + + auto lerp_position = [&](position_t a, position_t b, float ratio) + { + float safe_ratio = std::clamp(ratio, 0.0f, 1.0f); + position_t final_pos{ + lerp(a.x, b.x, ratio), + lerp(a.y, b.y, ratio), + lerp(a.z, b.z, ratio), + 0, 0}; + return final_pos; + }; + + position_t final_pos = target_pos; + for (auto PTrust : static_cast(POwner->PMaster)->PTrusts) + { + if (POwner != PTrust && distance(POwner->loc.p, PTrust->loc.p) < 5.0f) + { + auto angle = getangle(POwner->loc.p, PTrust->loc.p); + position_t declumped_pos{ POwner->loc.p.x - (cosf(rotationToRadian(angle)) * 2.0f), + POwner->loc.p.y, POwner->loc.p.z + (sinf(rotationToRadian(angle)) * 2.0f), 0, 0 }; + + final_pos = lerp_position(final_pos, declumped_pos, 0.5f); + } + } + + return lerp_position(final_pos, target_pos, 0.1f); +} diff --git a/src/map/ai/controllers/trust_controller.h b/src/map/ai/controllers/trust_controller.h index c2e5376e70f..71f8e701cca 100644 --- a/src/map/ai/controllers/trust_controller.h +++ b/src/map/ai/controllers/trust_controller.h @@ -22,30 +22,33 @@ along with this program. If not, see http://www.gnu.org/licenses/ #ifndef _TRUSTCONTROLLER_H #define _TRUSTCONTROLLER_H -#include "controller.h" +#include "mob_controller.h" class CCharEntity; class CTrustEntity; -class CTrustController : public CController +class CTrustController : public CMobController { public: CTrustController(CCharEntity*, CTrustEntity*); - virtual ~CTrustController(); + ~CTrustController() override; + + void Tick(time_point) override; + void Despawn() override; - virtual void Tick(time_point) override; - virtual void Despawn() override; + bool Ability(uint16 targid, uint16 abilityid) override; - virtual bool Cast(uint16 targid, SpellID spellid) override { return false; } - virtual bool ChangeTarget(uint16 targid) override { return false; } - virtual bool WeaponSkill(uint16 targid, uint16 wsid) override { return false; } - - virtual bool Ability(uint16 targid, uint16 abilityid) override { return false; } + static constexpr float RoamDistance{ 5.5f }; + static constexpr float SpawnDistance{ 5.5f }; private: - static constexpr float RoamDistance{ 2.1f }; - void DoCombatTick(time_point tick); - void DoRoamTick(time_point tick); + void DoCombatTick(time_point tick) override; + void DoRoamTick(time_point tick) override; + + CBattleEntity* GetTopEnmity(); + position_t GetDeclumpedPosition(position_t target_pos); + + CBattleEntity* m_LastTopEntity; }; #endif // _TRUSTCONTROLLER \ No newline at end of file diff --git a/src/map/ai/helpers/targetfind.cpp b/src/map/ai/helpers/targetfind.cpp index 22ed559018e..43b448763e1 100644 --- a/src/map/ai/helpers/targetfind.cpp +++ b/src/map/ai/helpers/targetfind.cpp @@ -24,6 +24,7 @@ along with this program. If not, see http://www.gnu.org/licenses/ #include #include "../../entities/charentity.h" #include "../../entities/mobentity.h" +#include "../../entities/trustentity.h" #include "../../packets/action.h" #include "../../alliance.h" #include "../../../common/mmo.h" @@ -93,12 +94,11 @@ void CTargetFind::findWithinArea(CBattleEntity* PTarget, AOERADIUS radiusType, f m_PTarget = PTarget; isPlayer = checkIsPlayer(m_PBattleEntity); - if (isPlayer){ + if (isPlayer || m_PTarget->objtype == TYPE_TRUST) + { // handle this as a player - if (m_PMasterTarget->objtype == TYPE_PC) { - // players will never need to add whole alliance m_findType = FIND_PLAYER_PLAYER; @@ -114,23 +114,34 @@ void CTargetFind::findWithinArea(CBattleEntity* PTarget, AOERADIUS radiusType, f // add party members addAllInParty(m_PMasterTarget, withPet); } + + // add my trust too, if its allowed + for (auto* trust : ((CCharEntity*)m_PMasterTarget)->PTrusts) + { + if (validEntity((CBattleEntity*)trust)) + { + m_targets.push_back((CBattleEntity*)trust); + } + } } - else { + else + { // just add myself addEntity(m_PMasterTarget, withPet); } } - else { + else + { m_findType = FIND_PLAYER_MONSTER; // special case to add all mobs in range addAllInMobList(m_PMasterTarget, false); } } - else { + else + { // handle this as a mob - if (m_PMasterTarget->objtype == TYPE_PC || m_PBattleEntity->allegiance == ALLEGIANCE_PLAYER){ m_findType = FIND_MONSTER_PLAYER; } @@ -229,6 +240,11 @@ void CTargetFind::addAllInZone(CBattleEntity* PTarget, bool withPet) addEntity(PMob, withPet); } }); + zoneutils::GetZone(PTarget->getZone())->ForEachTrustInstance(PTarget, [&](CTrustEntity* PTrust){ + if (PTrust){ + addEntity(PTrust, withPet); + } + }); } void CTargetFind::addAllInAlliance(CBattleEntity* PTarget, bool withPet) @@ -241,12 +257,21 @@ void CTargetFind::addAllInAlliance(CBattleEntity* PTarget, bool withPet) void CTargetFind::addAllInParty(CBattleEntity* PTarget, bool withPet) { - PTarget->ForParty([this, withPet](CBattleEntity* PMember) { + // Add Trust + if (PMember->objtype == TYPE_PC) + { + auto* PChar = (CCharEntity*)PMember; + for (auto trust : PChar->PTrusts) + { + CBattleEntity* PTrust = static_cast(trust); + m_targets.push_back(PTrust); + } + } + addEntity(PMember, withPet); }); - } void CTargetFind::addAllInEnmityList() @@ -278,7 +303,6 @@ void CTargetFind::addEntity(CBattleEntity* PTarget, bool withPet) { m_targets.push_back(PTarget->PPet); } - } CBattleEntity* CTargetFind::findMaster(CBattleEntity* PTarget) @@ -368,6 +392,10 @@ bool CTargetFind::validEntity(CBattleEntity* PTarget) } else if (m_findType == FIND_MONSTER_MONSTER || m_findType == FIND_PLAYER_PLAYER){ + if (PTarget->objtype == TYPE_TRUST) + { + return true; + } return false; } } @@ -463,7 +491,7 @@ bool CTargetFind::canSee(position_t* point) CBattleEntity* CTargetFind::getValidTarget(uint16 actionTargetID, uint16 validTargetFlags) { - CBattleEntity* PTarget = (CBattleEntity*)m_PBattleEntity->GetEntity(actionTargetID, TYPE_MOB | TYPE_PC | TYPE_PET); + CBattleEntity* PTarget = (CBattleEntity*)m_PBattleEntity->GetEntity(actionTargetID, TYPE_MOB | TYPE_PC | TYPE_PET | TYPE_TRUST); if (PTarget == nullptr) { @@ -475,6 +503,11 @@ CBattleEntity* CTargetFind::getValidTarget(uint16 actionTargetID, uint16 validTa return m_PBattleEntity->PPet; } + if (PTarget->objtype == TYPE_TRUST) + { + return PTarget; + } + if (PTarget->ValidTarget(m_PBattleEntity, validTargetFlags)) { return PTarget; diff --git a/src/map/ai/states/magic_state.cpp b/src/map/ai/states/magic_state.cpp index ee1c539d984..fb8f6cfae7e 100644 --- a/src/map/ai/states/magic_state.cpp +++ b/src/map/ai/states/magic_state.cpp @@ -122,7 +122,16 @@ bool CMagicState::Update(time_point tick) m_PEntity->PAI->EventHandler.triggerListener("MAGIC_USE", m_PEntity, PTarget, m_PSpell.get(), &action); PTarget->PAI->EventHandler.triggerListener("MAGIC_TAKE", PTarget, m_PEntity, m_PSpell.get(), &action); } - m_PEntity->loc.zone->PushPacket(m_PEntity, CHAR_INRANGE_SELF, new CActionPacket(action)); + + if (PTarget && PTarget->objtype == TYPE_TRUST) + { + PTarget->loc.zone->PushPacket(PTarget, CHAR_INRANGE_SELF, new CActionPacket(action)); + } + else + { + m_PEntity->loc.zone->PushPacket(m_PEntity, CHAR_INRANGE_SELF, new CActionPacket(action)); + } + Complete(); } else if (IsCompleted() && tick > GetEntryTime() + m_castTime + std::chrono::milliseconds(m_PSpell->getAnimationTime())) diff --git a/src/map/battlefield.cpp b/src/map/battlefield.cpp index 2f870d9be1e..bd6e0700702 100644 --- a/src/map/battlefield.cpp +++ b/src/map/battlefield.cpp @@ -454,7 +454,7 @@ bool CBattlefield::RemoveEntity(CBaseEntity* PEntity, uint8 leavecode) PEntity->loc.zone->PushPacket(PEntity, CHAR_INRANGE, new CEntityUpdatePacket(PEntity, ENTITY_DESPAWN, UPDATE_ALL_MOB)); m_NpcList.erase(std::remove_if(m_NpcList.begin(), m_NpcList.end(), check), m_NpcList.end()); } - else if (PEntity->objtype == TYPE_MOB || PEntity->objtype == TYPE_PET) + else if (PEntity->objtype == TYPE_MOB || PEntity->objtype == TYPE_PET || PEntity->objtype == TYPE_TRUST) { // todo: probably need to check allegiance too cause besieged will prolly use > 0x700 too // allies targid >= 0x700 diff --git a/src/map/entities/baseentity.h b/src/map/entities/baseentity.h index cef73ba6b0d..8803fa6f620 100644 --- a/src/map/entities/baseentity.h +++ b/src/map/entities/baseentity.h @@ -30,13 +30,14 @@ enum ENTITYTYPE { - TYPE_NONE = 0x00, - TYPE_PC = 0x01, - TYPE_NPC = 0x02, - TYPE_MOB = 0x04, - TYPE_PET = 0x08, - TYPE_SHIP = 0x10, - TYPE_TRUST = 0x20 + TYPE_NONE = 0x00, + TYPE_PC = 0x01, + TYPE_NPC = 0x02, + TYPE_MOB = 0x04, + TYPE_PET = 0x08, + TYPE_SHIP = 0x10, + TYPE_TRUST = 0x20, + TYPE_FELLOW = 0x40 }; enum STATUSTYPE @@ -56,7 +57,7 @@ enum ANIMATIONTYPE { ANIMATION_NONE = 0, ANIMATION_ATTACK = 1, - // Death = 2, + ANIMATION_DESPAWN = 2, ANIMATION_DEATH = 3, ANIMATION_EVENT = 4, ANIMATION_CHOCOBO = 5, diff --git a/src/map/entities/battleentity.h b/src/map/entities/battleentity.h index a04f9607f3b..9ddb51cb1ff 100644 --- a/src/map/entities/battleentity.h +++ b/src/map/entities/battleentity.h @@ -580,6 +580,23 @@ class CBattleEntity : public CBaseEntity func(this, std::forward(args)...); } } + + template + void ForPartyWithTrusts(F func, Args&&... args) + { + if (PParty) { + for (auto PMember : PParty->members) { + func(PMember, std::forward(args)...); + for (auto PTrust : static_cast(PMember)->PTrusts) { + func(PTrust, std::forward(args)...); + } + } + } + else { + func(this, std::forward(args)...); + } + } + template void ForAlliance(F func, Args&&... args) { diff --git a/src/map/entities/charentity.cpp b/src/map/entities/charentity.cpp index 60d41c5b5ee..0711461f769 100644 --- a/src/map/entities/charentity.cpp +++ b/src/map/entities/charentity.cpp @@ -481,19 +481,22 @@ void CCharEntity::RemoveTrust(CTrustEntity* PTrust) PTrust->PAI->Despawn(); PTrusts.erase(trustIt); } + if (PParty != nullptr) { - PParty->ReloadParty(); + if (PTrusts.size() < 1 && PParty->members.size() == 1) + { + PParty->DisbandParty(); + } + else + { + PParty->ReloadParty(); + } } } void CCharEntity::ClearTrusts() { - if (PTrusts.size() == 0) - { - return; - } - for (auto trust : PTrusts) { trust->PAI->Despawn(); @@ -1677,6 +1680,7 @@ void CCharEntity::Die(duration _duration) m_deathSyncTime = server_clock::now() + death_update_frequency; PAI->ClearStateStack(); PAI->Internal_Die(_duration); + this->ClearTrusts(); // reraise modifiers if (this->getMod(Mod::RERAISE_I) > 0) diff --git a/src/map/entities/charentity.h b/src/map/entities/charentity.h index 407efc1c91f..7cb375ae634 100644 --- a/src/map/entities/charentity.h +++ b/src/map/entities/charentity.h @@ -215,15 +215,13 @@ class CCharEntity : public CBattleEntity std::vector PTrusts; // Active trusts - // Эти миссии не нуждаются в списке пройденных, т.к. клиент автоматически - // отображает более ранние миссии выплненными + // These missions do not need a list of completed, because client automatically + // displays earlier missions completed - uint16 m_copCurrent; // текущая миссия Chains of Promathia - uint16 m_acpCurrent; // текущая миссия A Crystalline Prophecy - uint16 m_mkeCurrent; // текущая миссия A Moogle Kupo d'Etat - uint16 m_asaCurrent; // текущая миссия A Shantotto Ascension - - // TODO: половина этого массива должна храниться в char_vars, а не здесь, т.к. эта информация не отображается в интерфейсе клиента и сервер не проводит с ними никаких операций + uint16 m_copCurrent; // current mission of Chains of Promathia + uint16 m_acpCurrent; // current mission of A Crystalline Prophecy + uint16 m_mkeCurrent; // current mission of A Moogle Kupo d'Etat + uint16 m_asaCurrent; // current mission of A Shantotto Ascension //currency_t m_currency; // conquest points, imperial standing points etc Teleport_t teleport; // Outposts, Runic Portals, Homepoints, Survival Guides, Maws, etc @@ -258,10 +256,11 @@ class CCharEntity : public CBattleEntity CBaseEntity* PWideScanTarget; // wide scane цель - SpawnIDList_t SpawnPCList; // список видимых персонажей - SpawnIDList_t SpawnMOBList; // список видимых монстров - SpawnIDList_t SpawnPETList; // список видимых питомцев - SpawnIDList_t SpawnNPCList; // список видимых npc + SpawnIDList_t SpawnPCList; // list of visible characters + SpawnIDList_t SpawnMOBList; // list of visible monsters + SpawnIDList_t SpawnPETList; // list of visible pets + SpawnIDList_t SpawnTRUSTList; // list of visible trust + SpawnIDList_t SpawnNPCList; // list of visible npc's void SetName(int8* name); // устанавливаем имя персонажа (имя ограничивается 15-ю символами) diff --git a/src/map/entities/mobentity.h b/src/map/entities/mobentity.h index 7d1d8a09cd7..c13756ef398 100644 --- a/src/map/entities/mobentity.h +++ b/src/map/entities/mobentity.h @@ -169,7 +169,7 @@ class CMobEntity : public CBattleEntity virtual void OnCastFinished(CMagicState&, action_t&) override; virtual void OnDisengage(CAttackState&) override; - virtual void OnDeathTimer() override;public: + virtual void OnDeathTimer() override; virtual void OnDespawn(CDespawnState&) override; @@ -256,8 +256,6 @@ class CMobEntity : public CBattleEntity void DistributeRewards(); void DropItems(CCharEntity* PChar); - - private: time_point m_DespawnTimer {time_point::min()}; // Despawn Timer to despawn mob after set duration diff --git a/src/map/entities/trustentity.cpp b/src/map/entities/trustentity.cpp index 2ba30a64bb2..5284b135b3f 100644 --- a/src/map/entities/trustentity.cpp +++ b/src/map/entities/trustentity.cpp @@ -19,8 +19,6 @@ along with this program. If not, see http://www.gnu.org/licenses/ =========================================================================== */ -#include - #include "trustentity.h" #include "../mob_spell_container.h" #include "../mob_spell_list.h" @@ -33,10 +31,7 @@ along with this program. If not, see http://www.gnu.org/licenses/ #include "../ai/helpers/targetfind.h" #include "../ai/states/ability_state.h" #include "../utils/battleutils.h" -#include "../utils/petutils.h" -#include "../utils/mobutils.h" -#include "../../common/utils.h" -#include "../mob_modifier.h" +#include "../utils/trustutils.h" CTrustEntity::CTrustEntity(CCharEntity* PChar) { @@ -48,8 +43,9 @@ CTrustEntity::CTrustEntity(CCharEntity* PChar) PAI = std::make_unique(this, std::make_unique(this), std::make_unique(PChar, this), std::make_unique(this)); } -CTrustEntity::~CTrustEntity() +const int8* CTrustEntity::GetName() { + return (const int8*)packetName.c_str(); } void CTrustEntity::PostTick() @@ -58,57 +54,39 @@ void CTrustEntity::PostTick() if (loc.zone && updatemask && status != STATUS_DISAPPEAR) { loc.zone->PushPacket(this, CHAR_INRANGE, new CEntityUpdatePacket(this, ENTITY_UPDATE, updatemask)); - for (auto PTrust : ((CCharEntity*)PMaster)->PTrusts) - { - if (PTrust == this) - { - ((CCharEntity*)PMaster)->pushPacket(new CTrustSyncPacket((CCharEntity*)PMaster, this)); - } - } - if (updatemask & UPDATE_HP) + if (PMaster && PMaster->PParty && updatemask & UPDATE_HP) { - if (PMaster->PParty != nullptr) + PMaster->ForParty([this](auto PMember) { - PMaster->ForParty([this](auto PMember) - { - if (PMember->objtype == TYPE_PC) - { - static_cast(PMember)->pushPacket(new CCharHealthPacket(this)); - } - }); - } + static_cast(PMember)->pushPacket(new CCharHealthPacket(this)); + }); } - updatemask = 0; } } void CTrustEntity::FadeOut() { - CMobEntity::FadeOut(); + CBaseEntity::FadeOut(); loc.zone->PushPacket(this, CHAR_INRANGE, new CEntityUpdatePacket(this, ENTITY_DESPAWN, UPDATE_NONE)); } void CTrustEntity::Die() { + luautils::OnMobDeath(this, nullptr); PAI->ClearStateStack(); PAI->Internal_Die(0s); - luautils::OnMobDeath(this, nullptr); + ((CCharEntity*)PMaster)->RemoveTrust(this); CBattleEntity::Die(); - if (PMaster->objtype == TYPE_PC) - { - CCharEntity* PChar = (CCharEntity*)PMaster; - PChar->RemoveTrust(this); - } } void CTrustEntity::Spawn() { //we need to skip CMobEntity's spawn because it calculates stats (and our stats are already calculated) CBattleEntity::Spawn(); - ((CCharEntity*)PMaster)->pushPacket(new CTrustSyncPacket((CCharEntity*)PMaster, this)); luautils::OnMobSpawn(this); + ((CCharEntity*)PMaster)->pushPacket(new CTrustSyncPacket((CCharEntity*)PMaster, this)); } bool CTrustEntity::ValidTarget(CBattleEntity* PInitiator, uint16 targetFlags) @@ -119,3 +97,14 @@ bool CTrustEntity::ValidTarget(CBattleEntity* PInitiator, uint16 targetFlags) } return CMobEntity::ValidTarget(PInitiator, targetFlags); } + +void CTrustEntity::OnDespawn(CDespawnState&) +{ + if (GetHPP()) + { + // Don't call this when despawning after being killed + luautils::OnMobDespawn(this); + } + FadeOut(); + PAI->EventHandler.triggerListener("DESPAWN", this); +} \ No newline at end of file diff --git a/src/map/entities/trustentity.h b/src/map/entities/trustentity.h index 05a5460b45b..7e46682cb4c 100644 --- a/src/map/entities/trustentity.h +++ b/src/map/entities/trustentity.h @@ -28,16 +28,22 @@ class CCharEntity; class CTrustEntity : public CMobEntity { public: - CTrustEntity(CCharEntity*); - ~CTrustEntity(); - uint8 m_Element; - uint32 m_PetID; - - virtual void PostTick() override; - virtual void FadeOut() override; - virtual void Die() override; - virtual void Spawn() override; - virtual bool ValidTarget(CBattleEntity* PInitiator, uint16 targetFlags) override; + explicit CTrustEntity(CCharEntity*); + ~CTrustEntity() override = default; + + // Note: The default name is the lowercase spell script name, so we override GetName() + // to return the packetName instead, which makes the behaviour consistant with other uses + // of GetName() + const int8* GetName() override; + + void PostTick() override; + void FadeOut() override; + void Die() override; + void Spawn() override; + bool ValidTarget(CBattleEntity* PInitiator, uint16 targetFlags) override; + void OnDespawn(CDespawnState&) override; + + uint32 m_TrustID{}; }; #endif diff --git a/src/map/lua/lua_baseentity.cpp b/src/map/lua/lua_baseentity.cpp index afe5889091a..1a37896b8d0 100644 --- a/src/map/lua/lua_baseentity.cpp +++ b/src/map/lua/lua_baseentity.cpp @@ -79,6 +79,7 @@ #include "../entities/mobentity.h" #include "../entities/npcentity.h" #include "../entities/petentity.h" +#include "../entities/trustentity.h" #include "../packets/action.h" #include "../packets/auction_house.h" @@ -141,6 +142,7 @@ #include "../utils/mobutils.h" #include "../utils/petutils.h" #include "../utils/puppetutils.h" +#include "../utils/trustutils.h" #include "../utils/zoneutils.h" CLuaBaseEntity::CLuaBaseEntity(lua_State* L) @@ -8489,10 +8491,50 @@ inline int32 CLuaBaseEntity::getParty(lua_State* L) return 1; } +/************************************************************************ +* Function: getPartyWithTrusts() +* Purpose : Returns a Lua table of party member and trust Entity objects +* Example : local party = player:getPartyWithTrusts() +* Notes : +************************************************************************/ + +inline int32 CLuaBaseEntity::getPartyWithTrusts(lua_State* L) +{ + TPZ_DEBUG_BREAK_IF(m_PBaseEntity->objtype == TYPE_NPC); + + CParty* party = ((CBattleEntity*)m_PBaseEntity)->PParty; + + int size = 0; + if (party) + { + size = party->MemberCount(m_PBaseEntity->getZone()); + } + else + { + size = 1; + } + + lua_createtable(L, size, 0); + int i = 1; + ((CBattleEntity*)m_PBaseEntity)->ForPartyWithTrusts([&L, &i](CBattleEntity* member) + { + lua_getglobal(L, CLuaBaseEntity::className); + lua_pushstring(L, "new"); + lua_gettable(L, -2); + lua_insert(L, -2); + lua_pushlightuserdata(L, (void*)member); + lua_pcall(L, 2, 1, 0); + + lua_rawseti(L, -2, i++); + }); + + return 1; +} + /************************************************************************ * Function: getPartySize() * Purpose : Returns the count of members in the party -* Example : local count = getPartySize() +* Example : local count = player:getPartySize() * Notes : ************************************************************************/ @@ -8501,9 +8543,7 @@ inline int32 CLuaBaseEntity::getPartySize(lua_State* L) TPZ_DEBUG_BREAK_IF(m_PBaseEntity == nullptr); TPZ_DEBUG_BREAK_IF(m_PBaseEntity->objtype == TYPE_NPC); - TPZ_DEBUG_BREAK_IF(lua_isnil(L, 1) || !lua_isnumber(L, 1)); - - uint8 allianceparty = (uint8)lua_tonumber(L, 1); + uint8 allianceparty = lua_isnil(L, 1) ? 0 : (uint8)lua_tonumber(L, 1); uint8 partysize = 1; if (((CBattleEntity*)m_PBaseEntity)->PParty != nullptr) @@ -11901,7 +11941,7 @@ inline int32 CLuaBaseEntity::spawnTrust(lua_State *L) if (!lua_isnil(L, 1) && lua_isstring(L, 1)) { uint16 trustId = (uint16)lua_tointeger(L, 1); - petutils::SpawnTrust((CCharEntity*)m_PBaseEntity, trustId); + trustutils::SpawnTrust((CCharEntity*)m_PBaseEntity, trustId); } else { @@ -11910,6 +11950,22 @@ inline int32 CLuaBaseEntity::spawnTrust(lua_State *L) return 0; } +/************************************************************************ +* Function: getTrustID() +* Purpose : +* Example : trust:getTrustID() +* Notes : +************************************************************************/ + +inline int32 CLuaBaseEntity::getTrustID(lua_State* L) +{ + TPZ_DEBUG_BREAK_IF(m_PBaseEntity == nullptr); + TPZ_DEBUG_BREAK_IF(m_PBaseEntity->objtype != TYPE_TRUST); + + lua_pushinteger(L, ((CTrustEntity*)m_PBaseEntity)->m_TrustID); + return 1; +} + /************************************************************************ * Function: despawnPet() * Purpose : Despawns a Pet Entity @@ -12075,20 +12131,19 @@ inline int32 CLuaBaseEntity::getMaster(lua_State* L) TPZ_DEBUG_BREAK_IF(m_PBaseEntity == nullptr); TPZ_DEBUG_BREAK_IF(m_PBaseEntity->objtype == TYPE_NPC) - if (((CBattleEntity*)m_PBaseEntity)->PMaster != nullptr) - { - //uint32 petid = (uint32); + if (((CBattleEntity*)m_PBaseEntity)->PMaster != nullptr) + { + CBaseEntity* PMaster = ((CBattleEntity*)m_PBaseEntity)->PMaster; - CBaseEntity* PMaster = ((CBattleEntity*)m_PBaseEntity)->PMaster; + lua_getglobal(L, CLuaBaseEntity::className); + lua_pushstring(L, "new"); + lua_gettable(L, -2); + lua_insert(L, -2); + lua_pushlightuserdata(L, (void*)PMaster); + lua_pcall(L, 2, 1, 0); + return 1; + } - lua_getglobal(L, CLuaBaseEntity::className); - lua_pushstring(L, "new"); - lua_gettable(L, -2); - lua_insert(L, -2); - lua_pushlightuserdata(L, (void*)PMaster); - lua_pcall(L, 2, 1, 0); - return 1; - } lua_pushnil(L); return 1; } @@ -13631,7 +13686,7 @@ inline int32 CLuaBaseEntity::useJobAbility(lua_State* L) inline int32 CLuaBaseEntity::useMobAbility(lua_State* L) { TPZ_DEBUG_BREAK_IF(m_PBaseEntity == nullptr); - TPZ_DEBUG_BREAK_IF(m_PBaseEntity->objtype != TYPE_MOB && m_PBaseEntity->objtype != TYPE_PET); + TPZ_DEBUG_BREAK_IF(m_PBaseEntity->objtype != TYPE_TRUST && m_PBaseEntity->objtype != TYPE_MOB && m_PBaseEntity->objtype != TYPE_PET); if (lua_isnumber(L, 1)) { @@ -14343,6 +14398,7 @@ Lunar::Register_t CLuaBaseEntity::methods[] = // Parties and Alliances LUNAR_DECLARE_METHOD(CLuaBaseEntity,getParty), + LUNAR_DECLARE_METHOD(CLuaBaseEntity,getPartyWithTrusts), LUNAR_DECLARE_METHOD(CLuaBaseEntity,getPartySize), LUNAR_DECLARE_METHOD(CLuaBaseEntity,hasPartyJob), LUNAR_DECLARE_METHOD(CLuaBaseEntity,getPartyMember), @@ -14547,7 +14603,9 @@ Lunar::Register_t CLuaBaseEntity::methods[] = LUNAR_DECLARE_METHOD(CLuaBaseEntity,removeAllManeuvers), LUNAR_DECLARE_METHOD(CLuaBaseEntity,updateAttachments), - LUNAR_DECLARE_METHOD(CLuaBaseEntity, spawnTrust), + // Trust related + LUNAR_DECLARE_METHOD(CLuaBaseEntity,spawnTrust), + LUNAR_DECLARE_METHOD(CLuaBaseEntity,getTrustID), // Mob Entity-Specific LUNAR_DECLARE_METHOD(CLuaBaseEntity,setMobLevel), diff --git a/src/map/lua/lua_baseentity.h b/src/map/lua/lua_baseentity.h index 9458caceb2e..41c6f5bdf65 100644 --- a/src/map/lua/lua_baseentity.h +++ b/src/map/lua/lua_baseentity.h @@ -408,6 +408,7 @@ class CLuaBaseEntity // Parties and Alliances int32 getParty(lua_State* L); + int32 getPartyWithTrusts(lua_State* L); int32 getPartySize(lua_State* L); // Get the size of a party in an entity's alliance int32 hasPartyJob(lua_State*); int32 getPartyMember(lua_State* L); // Get a character entity from another entity's party or alliance @@ -577,7 +578,9 @@ class CLuaBaseEntity // Pets and Automations int32 spawnPet(lua_State*); // Calls Pet int32 despawnPet(lua_State*); // Despawns Pet + int32 spawnTrust(lua_State*); // Spawns trust + int32 getTrustID(lua_State*); int32 isJugPet(lua_State*); // If the entity has a pet, test if it is a jug pet. int32 hasValidJugPetItem(lua_State*); diff --git a/src/map/lua/luautils.cpp b/src/map/lua/luautils.cpp index f58f4df7e98..ec30165b0d6 100644 --- a/src/map/lua/luautils.cpp +++ b/src/map/lua/luautils.cpp @@ -2885,9 +2885,18 @@ namespace luautils else { int8 File[255]; - memset(File, 0, sizeof(File)); - PMob->objtype == TYPE_PET ? snprintf((char*)File, sizeof(File), "scripts/globals/pets/%s.lua", static_cast(PMob)->GetScriptName().c_str()) : - snprintf((char*)File, sizeof(File), "scripts/zones/%s/mobs/%s.lua", PMob->loc.zone->GetName(), PMob->GetName());; + switch (PMob->objtype) + { + case TYPE_MOB: + snprintf((char*)File, sizeof(File), "scripts/zones/%s/mobs/%s.lua", PMob->loc.zone->GetName(), PMob->GetName()); + break; + case TYPE_PET: + snprintf((char*)File, sizeof(File), "scripts/globals/pets/%s.lua", static_cast(PMob)->GetScriptName().c_str()); + break; + case TYPE_TRUST: + snprintf((char*)File, sizeof(File), "scripts/globals/spells/trust/%s.lua", PMob->GetName()); + break; + } lua_pushnil(LuaHandle); lua_setglobal(LuaHandle, "onMobDeath"); @@ -2934,8 +2943,19 @@ namespace luautils TPZ_DEBUG_BREAK_IF(PMob == nullptr); int8 File[255]; - PMob->objtype == TYPE_PET ? snprintf((char*)File, sizeof(File), "scripts/globals/pets/%s.lua", static_cast(PMob)->GetScriptName().c_str()) : + switch (PMob->objtype) + { + case TYPE_MOB: snprintf((char*)File, sizeof(File), "scripts/zones/%s/mobs/%s.lua", PMob->loc.zone->GetName(), PMob->GetName()); + break; + case TYPE_PET: + snprintf((char*)File, sizeof(File), "scripts/globals/pets/%s.lua", static_cast(PMob)->GetScriptName().c_str()); + break; + case TYPE_TRUST: + snprintf((char*)File, sizeof(File), "scripts/globals/spells/trust/%s.lua", PMob->GetName()); + break; + } + if (prepFile(File, "onMobSpawn")) { return -1; @@ -2944,7 +2964,6 @@ namespace luautils CLuaBaseEntity LuaMobEntity(PMob); Lunar::push(LuaHandle, &LuaMobEntity); - if (lua_pcall(LuaHandle, 1, 0, 0)) { ShowError("luautils::onMobSpawn: %s\n", lua_tostring(LuaHandle, -1)); @@ -3021,8 +3040,18 @@ namespace luautils TPZ_DEBUG_BREAK_IF(PMob == nullptr); int8 File[255]; - PMob->objtype == TYPE_PET ? snprintf((char*)File, sizeof(File), "scripts/globals/pets/%s.lua", static_cast(PMob)->GetScriptName().c_str()) : + switch (PMob->objtype) + { + case TYPE_MOB: snprintf((char*)File, sizeof(File), "scripts/zones/%s/mobs/%s.lua", PMob->loc.zone->GetName(), PMob->GetName()); + break; + case TYPE_PET: + snprintf((char*)File, sizeof(File), "scripts/globals/pets/%s.lua", static_cast(PMob)->GetScriptName().c_str()); + break; + case TYPE_TRUST: + snprintf((char*)File, sizeof(File), "scripts/globals/spells/trust/%s.lua", PMob->GetName()); + break; + } if (prepFile(File, "onMobDespawn")) { diff --git a/src/map/map.cpp b/src/map/map.cpp index bb467747d56..91f1918a3d0 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -47,6 +47,7 @@ along with this program. If not, see http://www.gnu.org/licenses/ #include "packet_system.h" #include "party.h" #include "utils/petutils.h" +#include "utils/trustutils.h" #include "spell.h" #include "time_server.h" #include "transport.h" @@ -217,6 +218,7 @@ int32 do_init(int32 argc, char** argv) battleutils::LoadMobSkillsList(); battleutils::LoadSkillChainDamageModifiers(); petutils::LoadPetList(); + trustutils::LoadTrustList(); mobutils::LoadCustomMods(); ShowStatus("do_init: loading zones"); @@ -263,6 +265,7 @@ void do_final(int code) battleutils::FreeMobSkillList(); petutils::FreePetList(); + trustutils::FreeTrustList(); zoneutils::FreeZoneList(); luautils::free(); message::close(); diff --git a/src/map/packet_system.cpp b/src/map/packet_system.cpp index 72bfe6bc227..b6edd735cbe 100644 --- a/src/map/packet_system.cpp +++ b/src/map/packet_system.cpp @@ -374,6 +374,11 @@ void SmallPacket0x00D(map_session_data_t* session, CCharEntity* PChar, CBasicPac PChar->updatemask |= UPDATE_HP; } + if (!PChar->PTrusts.empty()) + { + PChar->ClearTrusts(); + } + if (PChar->status == STATUS_SHUTDOWN) { if (PChar->PParty != nullptr) @@ -540,6 +545,7 @@ void SmallPacket0x015(map_session_data_t* session, CCharEntity* PChar, CBasicPac PChar->loc.zone->SpawnMOBs(PChar); PChar->loc.zone->SpawnPETs(PChar); + PChar->loc.zone->SpawnTRUSTs(PChar); if (PChar->PWideScanTarget != nullptr) { @@ -809,6 +815,7 @@ void SmallPacket0x01A(map_session_data_t* session, CCharEntity* PChar, CBasicPac PChar->loc.zone->SpawnPCs(PChar); PChar->loc.zone->SpawnNPCs(PChar); PChar->loc.zone->SpawnMOBs(PChar); + PChar->loc.zone->SpawnTRUSTs(PChar); } } break; @@ -3553,7 +3560,7 @@ void SmallPacket0x076(map_session_data_t* session, CCharEntity* PChar, CBasicPac else { //previous CPartyDefine was dropped or otherwise didn't work? - PChar->pushPacket(new CPartyDefinePacket(nullptr)); + PChar->pushPacket(new CPartyDefinePacket(nullptr, false)); } return; } diff --git a/src/map/packets/entity_update.cpp b/src/map/packets/entity_update.cpp index e9187a3498a..7418db112e4 100644 --- a/src/map/packets/entity_update.cpp +++ b/src/map/packets/entity_update.cpp @@ -28,6 +28,7 @@ #include "../entities/baseentity.h" #include "../entities/mobentity.h" +#include "../entities/trustentity.h" #include "../entities/npcentity.h" #include "../entities/petentity.h" #include "../status_effect_container.h" @@ -112,19 +113,6 @@ CEntityUpdatePacket::CEntityUpdatePacket(CBaseEntity* PEntity, ENTITYUPDATE type case TYPE_TRUST: { CMobEntity* PMob = (CMobEntity*)PEntity; - - //if(PMob->PMaster != nullptr && PMob->PMaster->objtype == TYPE_PC && - // PMob->PBattleAI->GetCurrentAction() == ACTION_FALL) - //{ - // ref(data,(0x21)) = 0x99; - // //ref (data,(0x27)) = 0x28; - // ref(data,(0x1E)) = 0x00; //0% HP - // ref(data,(0x1F)) = ANIMATION_DEATH; //death anim - // ref(data,(0x20)) = STATUS_NORMAL; - // ref(data,(0x29)) = PEntity->allegiance; - // ref(data,(0x2B)) = PEntity->namevis; - //} - //else { if (updatemask & UPDATE_HP) { @@ -166,11 +154,11 @@ CEntityUpdatePacket::CEntityUpdatePacket(CBaseEntity* PEntity, ENTITYUPDATE type // TODO: Read from the trust model itself if (PEntity->objtype == TYPE_TRUST) { - ref(0x21) = 0x21b; - ref(0x2B) = 0x06; - ref(0x2A) = 0x08; - ref(0x25) = 0x0f; - ref(0x27) = 0x28; + //ref(0x21) = 0x21b; + //ref(0x2B) = 0x06; + //ref(0x2A) = 0x08; + //ref(0x25) = 0x0f; + //ref(0x27) = 0x28; ref(0x28) = 0x45; } diff --git a/src/map/packets/message_basic.h b/src/map/packets/message_basic.h index 12d93338e57..cf6e60d1acf 100644 --- a/src/map/packets/message_basic.h +++ b/src/map/packets/message_basic.h @@ -123,6 +123,9 @@ enum MSGBASIC_ID : uint16 MSGBASIC_TREASURE_HUNTER_UP = 603, /* Additional effect: Treasure Hunter effectiveness against increases to .. */ /* DNC */ MSGBASIC_NO_FINISHINGMOVES = 524, + /* TRUST & ALTER EGO */ + MSGBASIC_TRUST_NO_CAST_TRUST = 700, // You are unable to use Trust magic at this time. + MSGBASIC_TRUST_NO_CALL_AE = 717, // You cannot call forth alter egos here. /* DEBUG MESSAGES */ MSGBASIC_DEBUG_RESISTED_SPELL = 66, /* Debug: Resisted spell! */ diff --git a/src/map/packets/message_standard.h b/src/map/packets/message_standard.h index d75e0b11ac6..0feb194af88 100644 --- a/src/map/packets/message_standard.h +++ b/src/map/packets/message_standard.h @@ -78,12 +78,12 @@ enum class MsgStd CannotHere = 256, // You cannot use that command in this area. HeadgearShow = 260, HeadgearHide = 261, + TrustCannotJoinParty = 265, // You are unable to join a party whose leader currently has an alter ego present. + TrustCannotJoinAlliance = 266, // You are unable to join an alliance whose leader currently has an alter ego present. StyleLockOn = 267, // Style lock mode enabled. StyleLockOff = 268, // Style lock mode disabled. StyleLockIsOn = 269, // Style lock mode is enabled. StyleLockIsOff = 270, // Style lock mode is disabled. - TrustCannotJoinParty = 265, // You are unable to join a party whose leader currently has an alter ego present. - TrustCannotJoinAlliance = 266, // You are unable to join an alliance whose leader currently has an alter ego present. PollProposalLinkshell2 = 289, // Player Name's proposal to the linkshell group (cast vote with command: "/vote ?"): CurrentPollResultsLinkshell2 = 290, // Player Name's proposal - Current poll results: FinalPollResultsLinkshell2 = 291, // Player Name's proposal - Final poll results: diff --git a/src/map/packets/party_define.cpp b/src/map/packets/party_define.cpp index b63558fbe03..020158c1eef 100644 --- a/src/map/packets/party_define.cpp +++ b/src/map/packets/party_define.cpp @@ -25,10 +25,11 @@ along with this program. If not, see http://www.gnu.org/licenses/ #include "../entities/charentity.h" #include "../entities/trustentity.h" -#include "../party.h" -#include "../alliance.h" #include "../utils/zoneutils.h" +const char* msg = "SELECT chars.charid, partyflag, pos_zone, pos_prevzone FROM accounts_parties \ + LEFT JOIN chars ON accounts_parties.charid = chars.charid WHERE \ + IF (allianceid <> 0, allianceid = %d, partyid = %d) ORDER BY partyflag & %u, timestamp;"; CPartyDefinePacket::CPartyDefinePacket(CParty* PParty) { @@ -45,10 +46,8 @@ CPartyDefinePacket::CPartyDefinePacket(CParty* PParty) uint8 i = 0; - int ret = Sql_Query(SqlHandle, "SELECT chars.charid, partyflag, pos_zone, pos_prevzone FROM accounts_parties \ - LEFT JOIN chars ON accounts_parties.charid = chars.charid WHERE \ - IF (allianceid <> 0, allianceid = %d, partyid = %d) ORDER BY partyflag & %u, timestamp;", - allianceid, PParty->GetPartyID(), PARTY_SECOND | PARTY_THIRD); + int ret = Sql_Query(SqlHandle, msg, allianceid, PParty->GetPartyID(), PARTY_SECOND | PARTY_THIRD); + if (ret != SQL_ERROR && Sql_NumRows(SqlHandle) > 0) { while (Sql_NextRow(SqlHandle) == SQL_SUCCESS) @@ -63,18 +62,62 @@ CPartyDefinePacket::CPartyDefinePacket(CParty* PParty) i++; } } + } +} + +CPartyDefinePacket::CPartyDefinePacket(CParty* PParty, bool loadTrust) +{ + this->type = 0xC8; + this->size = 0x7C; + + if (PParty) + { + uint32 allianceid = 0; + if (PParty->m_PAlliance) + { + allianceid = PParty->m_PAlliance->m_AllianceID; + } - if (PParty->GetLeader() != nullptr && PParty->GetLeader()->objtype == TYPE_PC) + uint8 i = 0; + + int ret = Sql_Query(SqlHandle, msg, allianceid, PParty->GetPartyID(), PARTY_SECOND | PARTY_THIRD); + + if (ret != SQL_ERROR && Sql_NumRows(SqlHandle) > 0) { - CCharEntity* PLeader = (CCharEntity*)PParty->GetLeader(); - for (auto PTrust : PLeader->PTrusts) + while (Sql_NextRow(SqlHandle) == SQL_SUCCESS) { - ref(12 * i + (0x08)) = PTrust->id; - ref(12 * i + (0x0C)) = PTrust->targid; - ref(12 * i + (0x0E)) = 0; - ref(12 * i + (0x10)) = PTrust->getZone(); + uint16 targid = 0; + CCharEntity* PChar = zoneutils::GetChar(Sql_GetUIntData(SqlHandle, 0)); + if (PChar) targid = PChar->targid; + ref(12 * i + 0x08) = Sql_GetUIntData(SqlHandle, 0); + ref(12 * i + 0x0C) = targid; + ref(12 * i + 0x0E) = Sql_GetUIntData(SqlHandle, 1); + ref(12 * i + 0x10) = Sql_GetUIntData(SqlHandle, 2) ? Sql_GetUIntData(SqlHandle, 2) : Sql_GetUIntData(SqlHandle, 3); i++; } } + + ret = Sql_Query(SqlHandle, msg, allianceid, PParty->GetPartyID(), PARTY_SECOND | PARTY_THIRD); + + if (ret != SQL_ERROR && Sql_NumRows(SqlHandle) > 0) + { + while (Sql_NextRow(SqlHandle) == SQL_SUCCESS) + { + CCharEntity* PChar = zoneutils::GetChar(Sql_GetUIntData(SqlHandle, 0)); + CCharEntity* PLeader = (CCharEntity*)PParty->GetLeader(); + + if (PParty->GetLeader() != nullptr && PParty->GetLeader()->objtype == TYPE_PC) + { + for (auto PTrust : PLeader->PTrusts) + { + ref(12 * i + (0x08)) = PTrust->id; + ref(12 * i + (0x0C)) = PTrust->targid; + ref(12 * i + (0x0E)) = 0; + ref(12 * i + (0x10)) = PTrust->getZone(); + i++; + } + } + } + } } } \ No newline at end of file diff --git a/src/map/packets/party_define.h b/src/map/packets/party_define.h index 737f6313718..d8468263933 100644 --- a/src/map/packets/party_define.h +++ b/src/map/packets/party_define.h @@ -38,7 +38,8 @@ class CPartyDefinePacket : public CBasicPacket { public: - CPartyDefinePacket(CParty* PParty); + CPartyDefinePacket(CParty* PParty); + CPartyDefinePacket(CParty* PParty, bool loadTrust); }; #endif \ No newline at end of file diff --git a/src/map/packets/party_member_update.cpp b/src/map/packets/party_member_update.cpp index dc9334dab55..8a56d634ea9 100644 --- a/src/map/packets/party_member_update.cpp +++ b/src/map/packets/party_member_update.cpp @@ -90,8 +90,9 @@ CPartyMemberUpdatePacket::CPartyMemberUpdatePacket(CTrustEntity* PTrust, uint8 M ref(0x24) = PTrust->GetSJob(); ref(0x25) = PTrust->GetSLevel(); - memcpy(data + (0x26), PTrust->GetName(), PTrust->name.size()); + memcpy(data + (0x26), PTrust->packetName.c_str(), PTrust->packetName.size()); } + CPartyMemberUpdatePacket::CPartyMemberUpdatePacket(uint32 id, const int8* name, uint16 memberFlags, uint8 MemberNumber, uint16 ZoneID) { diff --git a/src/map/packets/trust_sync.cpp b/src/map/packets/trust_sync.cpp index f46f3fd7efc..8ef08227c56 100644 --- a/src/map/packets/trust_sync.cpp +++ b/src/map/packets/trust_sync.cpp @@ -19,6 +19,7 @@ along with this program. If not, see http://www.gnu.org/licenses/ =========================================================================== */ #include "../../common/socket.h" +#include "../../common/utils.h" #include "trust_sync.h" @@ -30,7 +31,7 @@ CTrustSyncPacket::CTrustSyncPacket(CCharEntity* PChar, CTrustEntity* PTrust) // The purpose of this packet is to make the client aware that this pet is a trust, and hence // to show trust options in the menu (like "Release"). this->type = 0x67; - this->size = 0x0C; + this->size = 0x16; // Sample packet: // 67 0C 58 00 03 05 F4 07 F4 28 08 01 00 04 00 00 @@ -43,6 +44,9 @@ CTrustSyncPacket::CTrustSyncPacket(CCharEntity* PChar, CTrustEntity* PTrust) ref(0x08) = PTrust->id; ref(0x0C) = PChar->targid; + packBitsBE(data + (0x04), (0x18) + PTrust->packetName.size(), 0, 6, 10); // Message Size + memcpy(data + (0x18), PTrust->packetName.c_str(), PTrust->packetName.size()); + // Unknown ref(0x10) = 0x04; } diff --git a/src/map/party.cpp b/src/map/party.cpp index 7de1a60a0e5..cefe94e6134 100644 --- a/src/map/party.cpp +++ b/src/map/party.cpp @@ -200,10 +200,18 @@ uint8 CParty::MemberCount(uint16 ZoneID) for (uint32 i = 0; i < members.size(); ++i) { - if (members.at(i)->getZone() == ZoneID) + auto* member = members.at(i); + if (member->getZone() == ZoneID) { count++; } + if (member->objtype == TYPE_PC) + { + for (auto* trust : static_cast(member)->PTrusts) + { + count++; + } + } } return count; } @@ -238,10 +246,11 @@ void CParty::RemoveMember(CBattleEntity* PEntity) if (m_PLeader == PEntity) { + RemovePartyLeader(PEntity); + // Remove their trusts CCharEntity* PChar = (CCharEntity*)PEntity; PChar->ClearTrusts(); - RemovePartyLeader(PEntity); } else { @@ -733,6 +742,7 @@ void CParty::ReloadParty() else { RefreshFlags(info); + CBattleEntity* PLeader = GetLeader(); //regular party for (uint8 i = 0; i < members.size(); ++i) { @@ -742,7 +752,14 @@ void CParty::ReloadParty() PChar->PLatentEffectContainer->CheckLatentsPartyMembers(members.size()); PChar->PLatentEffectContainer->CheckLatentsPartyAvatar(); PChar->ReloadPartyDec(); - PChar->pushPacket(new CPartyDefinePacket(this)); + if (PChar->loc.zone->GetID() == PLeader->loc.zone->GetID()) + { + PChar->pushPacket(new CPartyDefinePacket(this, true)); + } + else + { + PChar->pushPacket(new CPartyDefinePacket(this)); + } //auto effects = std::make_unique(); uint8 j = 0; for (auto&& memberinfo : info) @@ -772,13 +789,9 @@ void CParty::ReloadParty() PChar->pushPacket(new CPartyMemberUpdatePacket( memberinfo.id, (const int8*)memberinfo.name.c_str(), memberinfo.flags, j, zoneid)); - //effects->AddMemberEffects(memberinfo.id); } j++; } - - - //PChar->pushPacket(effects.release()); } } } diff --git a/src/map/status_effect_container.cpp b/src/map/status_effect_container.cpp index 68515ee524b..19a34b795ac 100644 --- a/src/map/status_effect_container.cpp +++ b/src/map/status_effect_container.cpp @@ -1236,11 +1236,16 @@ void CStatusEffectContainer::SetEffectParams(CStatusEffect* StatusEffect) if (m_POwner->isAlive()) { // this should actually go into a char charm AI - if (m_POwner->PPet != nullptr && m_POwner->objtype == TYPE_PC) + if (m_POwner->objtype == TYPE_PC) { + auto PChar = (CCharEntity*)m_POwner; + if (effect == EFFECT_CHARM || effect == EFFECT_CHARM_II) { - petutils::DespawnPet(m_POwner); + if (m_POwner->PPet != nullptr) + { + petutils::DespawnPet(m_POwner); + } } } diff --git a/src/map/utils/mobutils.cpp b/src/map/utils/mobutils.cpp index 9c3d666083d..065b579972d 100644 --- a/src/map/utils/mobutils.cpp +++ b/src/map/utils/mobutils.cpp @@ -899,7 +899,7 @@ void GetAvailableSpells(CMobEntity* PMob) { } // catch all non-defaulted spell chances - PMob->defaultMobMod(MOBMOD_MAGIC_COOL, 35); + PMob->defaultMobMod(MOBMOD_MAGIC_COOL, 35); PMob->defaultMobMod(MOBMOD_GA_CHANCE, 35); PMob->defaultMobMod(MOBMOD_NA_CHANCE, 40); PMob->defaultMobMod(MOBMOD_BUFF_CHANCE, 35); diff --git a/src/map/utils/petutils.cpp b/src/map/utils/petutils.cpp index 7d0fa5aded9..e233a934ac9 100644 --- a/src/map/utils/petutils.cpp +++ b/src/map/utils/petutils.cpp @@ -34,7 +34,6 @@ along with this program. If not, see http://www.gnu.org/licenses/ #include "petutils.h" #include "zoneutils.h" #include "../entities/mobentity.h" -#include "../entities/trustentity.h" #include "../entities/automatonentity.h" #include "../ability.h" #include "../status_effect_container.h" @@ -56,29 +55,28 @@ along with this program. If not, see http://www.gnu.org/licenses/ #include "../packets/entity_update.h" #include "../packets/message_standard.h" #include "../packets/pet_sync.h" -#include "../packets/trust_sync.h" struct Pet_t { - look_t look; // внешний вид - string_t name; // имя - ECOSYSTEM EcoSystem; // эко-система + look_t look; // внешний вид + string_t name; // имя + ECOSYSTEM EcoSystem; // эко-система - uint8 minLevel; // минимально-возможный уровень - uint8 maxLevel; // максимально-возможный уровень + uint8 minLevel; // минимально-возможный уровень + uint8 maxLevel; // максимально-возможный уровень uint8 name_prefix; - uint8 size; // размер модели - uint16 m_Family; - uint32 time; // время существования (будет использоваться для задания длительности статус эффекта) + uint8 size; // размер модели + uint16 m_Family; + uint32 time; // время существования (будет использоваться для задания длительности статус эффекта) - uint8 mJob; - uint8 m_Element; + uint8 mJob; + uint8 m_Element; float HPscale; // HP boost percentage float MPscale; // MP boost percentage uint16 cmbDelay; - uint8 speed; + uint8 speed; // stat ranks uint8 strRank; uint8 dexRank; @@ -634,190 +632,6 @@ namespace petutils } } - void LoadTrustStats(CTrustEntity* PTrust) - { - // Cargo cult of PC calculations. - - float raceStat = 0; // конечное число HP для уровня на основе расы. - float jobStat = 0; // конечное число HP для уровня на основе первичной профессии. - float sJobStat = 0; // коенчное число HP для уровня на основе вторичной профессии. - int32 bonusStat = 0; // бонусное число HP которое добавляется при соблюдении некоторых условий. - - int32 baseValueColumn = 0; // номер колонки с базовым количеством HP - int32 scaleTo60Column = 1; // номер колонки с модификатором до 60 уровня - int32 scaleOver30Column = 2; // номер колонки с модификатором после 30 уровня - int32 scaleOver60Column = 3; // номер колонки с модификатором после 60 уровня - int32 scaleOver75Column = 4; // номер колонки с модификатором после 75 уровня - int32 scaleOver60 = 2; // номер колонки с модификатором для расчета MP после 60 уровня - int32 scaleOver75 = 3; // номер колонки с модификатором для расчета Статов после 75-го уровня - - uint8 grade; - - uint8 mlvl = PTrust->GetMLevel(); - uint8 slvl = PTrust->GetSLevel(); - JOBTYPE mjob = PTrust->GetMJob(); - JOBTYPE sjob = PTrust->GetSJob(); - - uint8 race = 0; //Human - - switch (PTrust->look.race) - { - case 3: - case 4: race = 1; break; //Elvaan - case 5: - case 6: race = 2; break; //Tarutaru - case 7: race = 3; break; //Mithra - case 8: race = 4; break; //Galka - } - - // Расчет прироста HP от main job - - int32 mainLevelOver30 = std::clamp(mlvl - 30, 0, 30); // Расчет условия +1HP каждый лвл после 30 уровня - int32 mainLevelUpTo60 = (mlvl < 60 ? mlvl - 1 : 59); // Первый режим рассчета до 60 уровня (Используется так же и для MP) - int32 mainLevelOver60To75 = std::clamp(mlvl - 60, 0, 15); // Второй режим расчета после 60 уровня - int32 mainLevelOver75 = (mlvl < 75 ? 0 : mlvl - 75); // Третий режим расчета после 75 уровня - - //Расчет бонусного количества HP - - int32 mainLevelOver10 = (mlvl < 10 ? 0 : mlvl - 10); // +2HP на каждом уровне после 10 - int32 mainLevelOver50andUnder60 = std::clamp(mlvl - 50, 0, 10); // +2HP на каждом уровне в промежутке от 50 до 60 уровня - int32 mainLevelOver60 = (mlvl < 60 ? 0 : mlvl - 60); - - // Расчет прироста HP от дополнительной профессии - - int32 subLevelOver10 = std::clamp(slvl - 10, 0, 20); // +1HP на каждый уровень после 10 (/2) - int32 subLevelOver30 = (slvl < 30 ? 0 : slvl - 30); // +1HP на каждый уровень после 30 - - // Расчет raceStat jobStat bonusStat sJobStat - // Расчет по расе - - grade = grade::GetRaceGrades(race, 0); - - raceStat = grade::GetHPScale(grade, baseValueColumn) + - (grade::GetHPScale(grade, scaleTo60Column) * mainLevelUpTo60) + - (grade::GetHPScale(grade, scaleOver30Column) * mainLevelOver30) + - (grade::GetHPScale(grade, scaleOver60Column) * mainLevelOver60To75) + - (grade::GetHPScale(grade, scaleOver75Column) * mainLevelOver75); - - // raceStat = (int32)(statScale[grade][baseValueColumn] + statScale[grade][scaleTo60Column] * (mlvl - 1)); - - // Расчет по main job - grade = grade::GetJobGrade(mjob, 0); - - jobStat = grade::GetHPScale(grade, baseValueColumn) + - (grade::GetHPScale(grade, scaleTo60Column) * mainLevelUpTo60) + - (grade::GetHPScale(grade, scaleOver30Column) * mainLevelOver30) + - (grade::GetHPScale(grade, scaleOver60Column) * mainLevelOver60To75) + - (grade::GetHPScale(grade, scaleOver75Column) * mainLevelOver75); - - // Расчет бонусных HP - bonusStat = (mainLevelOver10 + mainLevelOver50andUnder60) * 2; - - // Расчет по support job - if (slvl > 0) - { - grade = grade::GetJobGrade(sjob, 0); - - sJobStat = grade::GetHPScale(grade, baseValueColumn) + - (grade::GetHPScale(grade, scaleTo60Column) * (slvl - 1)) + - (grade::GetHPScale(grade, scaleOver30Column) * subLevelOver30) + - subLevelOver30 + subLevelOver10; - sJobStat = sJobStat / 2; - } - - - PTrust->health.maxhp = (int16)(map_config.player_hp_multiplier * (raceStat + jobStat + bonusStat + sJobStat)); - - //Начало расчера MP - - raceStat = 0; - jobStat = 0; - sJobStat = 0; - - // Расчет MP расе. - grade = grade::GetRaceGrades(race, 1); - - //Если у main job нет МП рейтинга, расчитиваем расовый бонус на основе уровня subjob уровня(при условии, что у него есть МП рейтинг) - if (grade::GetJobGrade(mjob, 1) == 0) - { - if (grade::GetJobGrade(sjob, 1) != 0 && slvl > 0) // В этом выражении ошибка - { - raceStat = (grade::GetMPScale(grade, 0) + grade::GetMPScale(grade, scaleTo60Column) * (slvl - 1)) / map_config.sj_mp_divisor; // Вот здесь ошибка - } - } - else { - //Расчет нормального расового бонуса - raceStat = grade::GetMPScale(grade, 0) + - grade::GetMPScale(grade, scaleTo60Column) * mainLevelUpTo60 + - grade::GetMPScale(grade, scaleOver60) * mainLevelOver60; - } - - //Для главной профессии - grade = grade::GetJobGrade(mjob, 1); - if (grade > 0) - { - jobStat = grade::GetMPScale(grade, 0) + - grade::GetMPScale(grade, scaleTo60Column) * mainLevelUpTo60 + - grade::GetMPScale(grade, scaleOver60) * mainLevelOver60; - } - - //Для дополнительной профессии - if (slvl > 0) - { - grade = grade::GetJobGrade(sjob, 1); - sJobStat = (grade::GetMPScale(grade, 0) + grade::GetMPScale(grade, scaleTo60Column) * (slvl - 1)) / map_config.sj_mp_divisor; - } - - PTrust->health.maxmp = (int16)(map_config.player_mp_multiplier * (raceStat + jobStat + sJobStat)); // результат расчета MP - - uint8 counter = 0; - - for (uint8 StatIndex = 2; StatIndex <= 8; ++StatIndex) - { - // расчет по расе - grade = grade::GetRaceGrades(race, StatIndex); - raceStat = grade::GetStatScale(grade, 0) + grade::GetStatScale(grade, scaleTo60Column) * mainLevelUpTo60; - - if (mainLevelOver60 > 0) - { - raceStat += grade::GetStatScale(grade, scaleOver60) * mainLevelOver60; - - if (mainLevelOver75 > 0) - { - raceStat += grade::GetStatScale(grade, scaleOver75) * mainLevelOver75 - (mlvl >= 75 ? 0.01f : 0); - } - } - - // расчет по профессии - grade = grade::GetJobGrade(mjob, StatIndex); - jobStat = grade::GetStatScale(grade, 0) + grade::GetStatScale(grade, scaleTo60Column) * mainLevelUpTo60; - - if (mainLevelOver60 > 0) - { - jobStat += grade::GetStatScale(grade, scaleOver60) * mainLevelOver60; - - if (mainLevelOver75 > 0) - { - jobStat += grade::GetStatScale(grade, scaleOver75) * mainLevelOver75 - (mlvl >= 75 ? 0.01f : 0); - } - } - - // расчет по дополнительной профессии - if (slvl > 0) - { - grade = grade::GetJobGrade(sjob, StatIndex); - sJobStat = (grade::GetStatScale(grade, 0) + grade::GetStatScale(grade, scaleTo60Column) * (slvl - 1)) / 2; - } - else { - sJobStat = 0; - } - - // Вывод значения - ref(&PTrust->stats, counter) = (uint16)((raceStat + jobStat + sJobStat)); - counter += 2; - } - } - void LoadAvatarStats(CPetEntity* PPet) { // Объявление переменных, нужных для рассчета. @@ -1027,73 +841,6 @@ namespace petutils } } - void SpawnTrust(CCharEntity* PMaster, uint32 TrustID) - { - // TODO: You can only spawn trusts in battle areas, similar to pets. See MSGBASIC_TRUST_NOT_HERE - - // TODO: There is an expandable limit of trusts you can summon, based on key items. - size_t maxTrusts = 5; - - // TODO: These checks should be done at before spellcast time!! - // If you're in a party, you can only spawn trusts if: - // * You're the party leader - // * The party isn't full - // * The party isn't part of an alliance - if (PMaster->PParty != nullptr) - { - CBattleEntity* PLeader = PMaster->PParty->GetLeader(); - if (PLeader == nullptr || PLeader->id != PMaster->id) - { - PMaster->pushPacket(new CMessageStandardPacket(PMaster, 0, MsgStd::TrustSoloOrLeader)); - return; - } - if (PMaster->PParty->members.size() >= 6) - { - PMaster->pushPacket(new CMessageStandardPacket(PMaster, 0, MsgStd::TrustLimit)); - return; - } - if (PMaster->PParty->m_PAlliance != nullptr) - { - PMaster->pushPacket(new CMessageStandardPacket(PMaster, 0, MsgStd::TrustSoloOrLeader)); - return; - } - - // Reduce the max number of summonable trusts - maxTrusts = 6 - PMaster->PParty->members.size(); - } - - if (PMaster->PTrusts.size() >= maxTrusts) - { - PMaster->pushPacket(new CMessageStandardPacket(PMaster, 0, MsgStd::TrustLimit)); - return; - } - - // You can't spawn the same trust twice - // TODO: This includes otherwise distinct trusts, e.g. Shantotto and Shantotto II, only 1 can be called. - // It'd probably be "good enough" to use the name as a heuristic, looking for "II" (this catches 99% of them). - for (auto PTrust : PMaster->PTrusts) - { - if (PTrust->m_PetID == TrustID) - { - PMaster->pushPacket(new CMessageStandardPacket(PMaster, 0, MsgStd::TrustSame)); - return; - } - } - - // Make a new party if we weren't in one. - // TODO: It's actually not a real party: /sea shows your name as grey not yellow, but it shows as a party on the GUI. - if (PMaster->PParty == nullptr) - { - PMaster->PParty = new CParty(PMaster); - } - - CTrustEntity* PTrust = LoadTrust(PMaster, TrustID); - PMaster->PTrusts.insert(PMaster->PTrusts.begin(), PTrust); - PMaster->StatusEffectContainer->CopyConfrontationEffect(PTrust); - PMaster->loc.zone->InsertPET(PTrust); - PMaster->PParty->ReloadParty(); - } - void SpawnMobPet(CBattleEntity* PMaster, uint32 PetID) { // this is ONLY used for mob smn elementals / avatars @@ -1720,53 +1467,6 @@ namespace petutils PMaster->PPet = PPet; } - CTrustEntity* LoadTrust(CCharEntity* PMaster, uint32 TrustID) - { - TPZ_DEBUG_BREAK_IF(TrustID >= g_PPetList.size()); - CTrustEntity* PTrust = new CTrustEntity(PMaster); - PTrust->loc = PMaster->loc; - PTrust->m_OwnerID.id = PMaster->id; - PTrust->m_OwnerID.targid = PMaster->targid; - - // spawn me randomly around master - PTrust->loc.p = nearPosition(PMaster->loc.p, CPetController::PetRoamDistance, (float)M_PI); - Pet_t* trust = g_PPetList.at(TrustID); - PTrust->look = trust->look; - PTrust->name = trust->name; - PTrust->m_name_prefix = trust->name_prefix; - PTrust->m_Family = trust->m_Family; - PTrust->m_MobSkillList = trust->m_MobSkillList; - PTrust->SetMJob(trust->mJob); - PTrust->SetSJob(trust->mJob); // TODO: This may not be true for some trusts - PTrust->m_Element = trust->m_Element; - PTrust->m_PetID = TrustID; - PTrust->status = STATUS_NORMAL; - PTrust->m_ModelSize = trust->size; - PTrust->m_EcoSystem = trust->EcoSystem; - - // assume level matches master - PTrust->SetMLevel(PMaster->GetMLevel()); - PTrust->SetSLevel(PMaster->GetSLevel()); - - // TODO: Proper stats per trust - PTrust->setModifier(Mod::ATT, battleutils::GetMaxSkill(SKILL_CLUB, JOB_WHM, PTrust->GetMLevel())); - PTrust->setModifier(Mod::ACC, battleutils::GetMaxSkill(SKILL_CLUB, JOB_WHM, PTrust->GetMLevel())); - PTrust->setModifier(Mod::EVA, battleutils::GetMaxSkill(SKILL_THROWING, JOB_WHM, PTrust->GetMLevel())); // Throwing?? - PTrust->setModifier(Mod::DEF, battleutils::GetMaxSkill(SKILL_THROWING, JOB_WHM, PTrust->GetMLevel())); - //set C magic evasion - PTrust->setModifier(Mod::MEVA, battleutils::GetMaxSkill(SKILL_ELEMENTAL_MAGIC, JOB_RDM, PTrust->GetMLevel())); - // HP/MP STR/DEX/etc.. - LoadTrustStats(PTrust); - - PTrust->health.tp = 0; - PTrust->UpdateHealth(); - PTrust->health.hp = PTrust->GetMaxHP(); - PTrust->health.mp = PTrust->GetMaxMP(); - - // TODO: Load stats from script - return PTrust; - } - void LoadWyvernStatistics(CBattleEntity* PMaster, CPetEntity* PPet, bool finalize) { //set the wyvern job based on master's SJ diff --git a/src/map/utils/petutils.h b/src/map/utils/petutils.h index 5e066fe45ac..daa32038a64 100644 --- a/src/map/utils/petutils.h +++ b/src/map/utils/petutils.h @@ -56,26 +56,20 @@ enum PETID PETID_STORMWAKERFRAME = 72, PETID_ADVENTURING_FELLOW = 73, PETID_CHOCOBO = 74, - - // Trusts are 896 and above - // PETID_SHANTOTTO = 896 - PETID_SHANTOTTO = 75 - // Todo: change how this works so trusts don't need PetID at all.. + PETID_TRUST = 75 }; class CBattleEntity; class CPetEntity; -class CTrustEntity; namespace petutils { - void LoadPetList(); - void FreePetList(); + void LoadPetList(); + void FreePetList(); - void SpawnPet(CBattleEntity* PMaster, uint32 PetID, bool spawningFromZone); + void SpawnPet(CBattleEntity* PMaster, uint32 PetID, bool spawningFromZone); void SpawnMobPet(CBattleEntity* PMaster, uint32 PetID); - void SpawnTrust(CCharEntity * PMaster, uint32 TrustID); void DetachPet(CBattleEntity* PMaster); void DespawnPet(CBattleEntity* PMaster); void AttackTarget(CBattleEntity* PMaster, CBattleEntity* PTarget); @@ -86,7 +80,6 @@ namespace petutils void LoadWyvernStatistics(CBattleEntity* PMaster, CPetEntity* PPet, bool finalize); void FinalizePetStatistics(CBattleEntity* PMaster, CPetEntity* PPet); bool CheckPetModType(CBattleEntity* PPet, PetModType petmod); - CTrustEntity* LoadTrust(CCharEntity* PMaster, uint32 TrustID); }; #endif diff --git a/src/map/utils/trustutils.cpp b/src/map/utils/trustutils.cpp new file mode 100644 index 00000000000..3afeed1937b --- /dev/null +++ b/src/map/utils/trustutils.cpp @@ -0,0 +1,461 @@ +#include "trustutils.h" + +#include "../../common/timer.h" +#include "../../common/utils.h" + +#include +#include +#include + +#include "battleutils.h" +#include "charutils.h" +#include "mobutils.h" +#include "zoneutils.h" + +#include "../grades.h" +#include "../map.h" +#include "../mob_modifier.h" + +#include "../ai/ai_container.h" +#include "../ai/controllers/trust_controller.h" +#include "../entities/mobentity.h" +#include "../entities/trustentity.h" +#include "../items/item_weapon.h" +#include "../packets/char_sync.h" +#include "../packets/entity_update.h" +#include "../packets/message_standard.h" +#include "../packets/trust_sync.h" +#include "../status_effect_container.h" +#include "../zone_instance.h" + +struct TrustSpell_ID +{ + uint32 spellID; +}; + +std::vector g_PTrustIDList; + +struct Trust_t +{ + uint32 trustID; + look_t look; // appearance data + string_t name; // script name string + string_t packet_name; // packet name string + ECOSYSTEM EcoSystem; // ecosystem + + uint8 name_prefix; + uint8 size; // размер модели + uint16 m_Family; + + uint8 mJob; + uint8 sJob; + float HPscale; // HP boost percentage + float MPscale; // MP boost percentage + + uint16 cmbDelay; + uint8 speed; + // stat ranks + uint8 strRank; + uint8 dexRank; + uint8 vitRank; + uint8 agiRank; + uint8 intRank; + uint8 mndRank; + uint8 chrRank; + uint8 attRank; + uint8 defRank; + uint8 evaRank; + uint8 accRank; + + uint16 m_MobSkillList; + + // magic stuff + bool hasSpellScript; + uint16 spellList; + + // resists + int16 slashres; + int16 pierceres; + int16 hthres; + int16 impactres; + + int16 firedef; + int16 icedef; + int16 winddef; + int16 earthdef; + int16 thunderdef; + int16 waterdef; + int16 lightdef; + int16 darkdef; + + int16 fireres; + int16 iceres; + int16 windres; + int16 earthres; + int16 thunderres; + int16 waterres; + int16 lightres; + int16 darkres; +}; + +std::vector g_PTrustList; + +namespace trustutils +{ +void LoadTrustList() +{ + FreeTrustList(); + + const char* Query = "SELECT \ + spell_list.spellid, mob_pools.poolid \ + FROM spell_list, mob_pools \ + WHERE spell_list.spellid >= 896 AND mob_pools.poolid = (spell_list.spellid+5000) ORDER BY spell_list.spellid"; + + if (Sql_Query(SqlHandle, Query) != SQL_ERROR && Sql_NumRows(SqlHandle) != 0) + { + while (Sql_NextRow(SqlHandle) == SQL_SUCCESS) + { + TrustSpell_ID* trustID = new TrustSpell_ID(); + + trustID->spellID = (uint32)Sql_GetIntData(SqlHandle, 0); + + g_PTrustIDList.push_back(trustID); + } + } + + for (uint32 index = 0; index < g_PTrustIDList.size(); index++) + { + BuildTrust(g_PTrustIDList.at(index)->spellID); + } +} + +void BuildTrust(uint32 TrustID) +{ + const char* Query = "SELECT \ + mob_pools.name,\ + mob_pools.packet_name,\ + mob_pools.modelid,\ + mob_pools.familyid,\ + mob_pools.mJob,\ + mob_pools.sJob,\ + mob_pools.hasSpellScript, mob_pools.spellList, \ + mob_pools.cmbDelay, mob_pools.name_prefix, \ + mob_pools.behavior, mob_pools.skill_list_id, \ + spell_list.spellid, \ + mob_family_system.mobsize, mob_family_system.systemid, \ + (mob_family_system.HP / 100), \ + (mob_family_system.MP / 100), \ + mob_family_system.speed, \ + mob_family_system.STR, \ + mob_family_system.DEX, \ + mob_family_system.VIT, \ + mob_family_system.AGI, \ + mob_family_system.INT, \ + mob_family_system.MND, \ + mob_family_system.CHR, \ + mob_family_system.DEF, \ + mob_family_system.ATT, \ + mob_family_system.ACC, \ + mob_family_system.EVA, \ + mob_family_system.Slash, mob_family_system.Pierce, \ + mob_family_system.H2H, mob_family_system.Impact, \ + mob_family_system.Fire, mob_family_system.Ice, \ + mob_family_system.Wind, mob_family_system.Earth, \ + mob_family_system.Lightning, mob_family_system.Water, \ + mob_family_system.Light, mob_family_system.Dark \ + FROM spell_list, mob_pools, mob_family_system WHERE spell_list.spellid = %u \ + AND (spell_list.spellid+5000) = mob_pools.poolid AND mob_pools.familyid = mob_family_system.familyid ORDER BY spell_list.spellid"; + + uint32 ret = Sql_Query(SqlHandle, Query, TrustID); + + if (ret != SQL_ERROR && Sql_NumRows(SqlHandle) != 0) + { + while (Sql_NextRow(SqlHandle) == SQL_SUCCESS) + { + Trust_t* trust = new Trust_t(); + + trust->trustID = TrustID; + trust->name.insert(0, (const char*)Sql_GetData(SqlHandle, 0)); + trust->packet_name.insert(0, (const char*)Sql_GetData(SqlHandle, 1)); + memcpy(&trust->look, Sql_GetData(SqlHandle, 2), 20); + trust->m_Family = (uint16)Sql_GetIntData(SqlHandle, 3); + trust->mJob = (uint8)Sql_GetIntData(SqlHandle, 4); + trust->sJob = (uint8)Sql_GetIntData(SqlHandle, 5); + trust->hasSpellScript = (bool)Sql_GetIntData(SqlHandle, 6); + trust->spellList = (uint16)Sql_GetIntData(SqlHandle, 7); + trust->cmbDelay = (uint16)Sql_GetIntData(SqlHandle, 8); + trust->name_prefix = (uint8)Sql_GetUIntData(SqlHandle, 9); + // Behaviour + trust->m_MobSkillList = (uint16)Sql_GetUIntData(SqlHandle, 11); + // SpellID + trust->size = Sql_GetUIntData(SqlHandle, 13); + trust->EcoSystem = (ECOSYSTEM)Sql_GetIntData(SqlHandle, 14); + trust->HPscale = Sql_GetFloatData(SqlHandle, 15); + trust->MPscale = Sql_GetFloatData(SqlHandle, 16); + trust->speed = (uint8)Sql_GetIntData(SqlHandle, 17); + trust->strRank = (uint8)Sql_GetIntData(SqlHandle, 18); + trust->dexRank = (uint8)Sql_GetIntData(SqlHandle, 19); + trust->vitRank = (uint8)Sql_GetIntData(SqlHandle, 20); + trust->agiRank = (uint8)Sql_GetIntData(SqlHandle, 21); + trust->intRank = (uint8)Sql_GetIntData(SqlHandle, 22); + trust->mndRank = (uint8)Sql_GetIntData(SqlHandle, 23); + trust->chrRank = (uint8)Sql_GetIntData(SqlHandle, 24); + trust->defRank = (uint8)Sql_GetIntData(SqlHandle, 25); + trust->attRank = (uint8)Sql_GetIntData(SqlHandle, 26); + trust->accRank = (uint8)Sql_GetIntData(SqlHandle, 27); + trust->evaRank = (uint8)Sql_GetIntData(SqlHandle, 28); + + // resistances + trust->slashres = (uint16)(Sql_GetFloatData(SqlHandle, 29) * 1000); + trust->pierceres = (uint16)(Sql_GetFloatData(SqlHandle, 30) * 1000); + trust->hthres = (uint16)(Sql_GetFloatData(SqlHandle, 31) * 1000); + trust->impactres = (uint16)(Sql_GetFloatData(SqlHandle, 32) * 1000); + + trust->firedef = 0; + trust->icedef = 0; + trust->winddef = 0; + trust->earthdef = 0; + trust->thunderdef = 0; + trust->waterdef = 0; + trust->lightdef = 0; + trust->darkdef = 0; + + trust->fireres = (uint16)((Sql_GetFloatData(SqlHandle, 33) - 1) * -100); + trust->iceres = (uint16)((Sql_GetFloatData(SqlHandle, 34) - 1) * -100); + trust->windres = (uint16)((Sql_GetFloatData(SqlHandle, 35) - 1) * -100); + trust->earthres = (uint16)((Sql_GetFloatData(SqlHandle, 36) - 1) * -100); + trust->thunderres = (uint16)((Sql_GetFloatData(SqlHandle, 37) - 1) * -100); + trust->waterres = (uint16)((Sql_GetFloatData(SqlHandle, 38) - 1) * -100); + trust->lightres = (uint16)((Sql_GetFloatData(SqlHandle, 39) - 1) * -100); + trust->darkres = (uint16)((Sql_GetFloatData(SqlHandle, 40) - 1) * -100); + + g_PTrustList.push_back(trust); + } + } +} + +void FreeTrustList() +{ + g_PTrustIDList.clear(); +} + +void SpawnTrust(CCharEntity* PMaster, uint32 TrustID) +{ + if (PMaster->PParty == nullptr) + { + PMaster->PParty = new CParty(PMaster); + } + + CTrustEntity* PTrust = LoadTrust(PMaster, TrustID); + PMaster->PTrusts.insert(PMaster->PTrusts.end(), PTrust); + PMaster->StatusEffectContainer->CopyConfrontationEffect(PTrust); + PMaster->loc.zone->InsertTRUST(PTrust); + PTrust->Spawn(); + + PMaster->PParty->ReloadParty(); +} + +CTrustEntity* LoadTrust(CCharEntity* PMaster, uint32 TrustID) +{ + CTrustEntity* PTrust = new CTrustEntity(PMaster); + Trust_t* trustData = new Trust_t(); + + trustData = *std::find_if(g_PTrustList.begin(), g_PTrustList.end(), [TrustID](Trust_t* t) { return t->trustID == TrustID; }); + + PTrust->loc = PMaster->loc; + PTrust->m_OwnerID.id = PMaster->id; + PTrust->m_OwnerID.targid = PMaster->targid; + + // spawn me randomly around master + PTrust->loc.p = nearPosition(PMaster->loc.p, CTrustController::SpawnDistance, (float)M_PI * tpzrand::GetRandomNumber(2.0f)); + PTrust->look = trustData->look; + PTrust->name = trustData->name; + + PTrust->packetName = trustData->packet_name; + PTrust->m_name_prefix = trustData->name_prefix; + PTrust->m_Family = trustData->m_Family; + PTrust->m_MobSkillList = trustData->m_MobSkillList; + PTrust->HPscale = trustData->HPscale; + PTrust->MPscale = trustData->MPscale; + PTrust->speed = trustData->speed; + PTrust->m_HasSpellScript = trustData->hasSpellScript; + PTrust->m_TrustID = trustData->trustID; + PTrust->status = STATUS_NORMAL; + PTrust->m_ModelSize = trustData->size; + PTrust->m_EcoSystem = trustData->EcoSystem; + + PTrust->SetMJob(trustData->mJob); + PTrust->SetSJob(trustData->sJob); + + ((CItemWeapon*)PTrust->m_Weapons[SLOT_MAIN])->setDelay((trustData->cmbDelay * 1000) / 60); + ((CItemWeapon*)PTrust->m_Weapons[SLOT_MAIN])->setBaseDelay((trustData->cmbDelay * 1000) / 60); + + // assume level matches master + PTrust->SetMLevel(PMaster->GetMLevel()); + PTrust->SetSLevel(PMaster->GetSLevel()); + + LoadTrustStatsAndSkills(PTrust); + mobutils::SetSpellList(PTrust, trustData->spellList); + + // TODO: This is temporary until a proper solution for decision making is chosen + PTrust->setMobMod(MOBMOD_SKILL_LIST, PTrust->m_MobSkillList); + + return PTrust; +} + +void LoadTrustStatsAndSkills(CTrustEntity* PTrust) +{ + JOBTYPE mJob = PTrust->GetMJob(); + JOBTYPE sJob = PTrust->GetSJob(); + uint8 mLvl = PTrust->GetMLevel(); + uint8 sLvl = PTrust->GetSLevel(); + + // TODO: HP/MP should take into account family, job, etc. + + float growth = 1.06f; + float base = 18.0f; + + PTrust->health.maxhp = (int16)(base * pow(mLvl, growth) * PTrust->HPscale); + + bool hasMp = false; + switch (mJob) + { + case JOB_PLD: + case JOB_WHM: + case JOB_BLM: + case JOB_RDM: + case JOB_DRK: + case JOB_BLU: + case JOB_SCH: + case JOB_SMN: + hasMp = true; + break; + default: + break; + } + + switch (sJob) + { + case JOB_PLD: + case JOB_WHM: + case JOB_BLM: + case JOB_RDM: + case JOB_DRK: + case JOB_BLU: + case JOB_SCH: + case JOB_SMN: + hasMp = true; + break; + default: + break; + } + + if (hasMp) + { + PTrust->health.maxmp = (int16)(base * pow(mLvl, growth) * PTrust->MPscale); + } + + PTrust->health.tp = 0; + PTrust->UpdateHealth(); + PTrust->health.hp = PTrust->GetMaxHP(); + PTrust->health.mp = PTrust->GetMaxMP(); + + ((CItemWeapon*)PTrust->m_Weapons[SLOT_MAIN])->setDamage(mobutils::GetWeaponDamage(PTrust)); + + uint16 fSTR = mobutils::GetBaseToRank(PTrust->strRank, mLvl); + uint16 fDEX = mobutils::GetBaseToRank(PTrust->dexRank, mLvl); + uint16 fVIT = mobutils::GetBaseToRank(PTrust->vitRank, mLvl); + uint16 fAGI = mobutils::GetBaseToRank(PTrust->agiRank, mLvl); + uint16 fINT = mobutils::GetBaseToRank(PTrust->intRank, mLvl); + uint16 fMND = mobutils::GetBaseToRank(PTrust->mndRank, mLvl); + uint16 fCHR = mobutils::GetBaseToRank(PTrust->chrRank, mLvl); + + uint16 mSTR = mobutils::GetBaseToRank(grade::GetJobGrade(PTrust->GetMJob(), 2), mLvl); + uint16 mDEX = mobutils::GetBaseToRank(grade::GetJobGrade(PTrust->GetMJob(), 3), mLvl); + uint16 mVIT = mobutils::GetBaseToRank(grade::GetJobGrade(PTrust->GetMJob(), 4), mLvl); + uint16 mAGI = mobutils::GetBaseToRank(grade::GetJobGrade(PTrust->GetMJob(), 5), mLvl); + uint16 mINT = mobutils::GetBaseToRank(grade::GetJobGrade(PTrust->GetMJob(), 6), mLvl); + uint16 mMND = mobutils::GetBaseToRank(grade::GetJobGrade(PTrust->GetMJob(), 7), mLvl); + uint16 mCHR = mobutils::GetBaseToRank(grade::GetJobGrade(PTrust->GetMJob(), 8), mLvl); + + uint16 sSTR = mobutils::GetBaseToRank(grade::GetJobGrade(PTrust->GetSJob(), 2), sLvl); + uint16 sDEX = mobutils::GetBaseToRank(grade::GetJobGrade(PTrust->GetSJob(), 3), sLvl); + uint16 sVIT = mobutils::GetBaseToRank(grade::GetJobGrade(PTrust->GetSJob(), 4), sLvl); + uint16 sAGI = mobutils::GetBaseToRank(grade::GetJobGrade(PTrust->GetSJob(), 5), sLvl); + uint16 sINT = mobutils::GetBaseToRank(grade::GetJobGrade(PTrust->GetSJob(), 6), sLvl); + uint16 sMND = mobutils::GetBaseToRank(grade::GetJobGrade(PTrust->GetSJob(), 7), sLvl); + uint16 sCHR = mobutils::GetBaseToRank(grade::GetJobGrade(PTrust->GetSJob(), 8), sLvl); + + if (sLvl > 15) + { + sSTR /= 2; + sDEX /= 2; + sAGI /= 2; + sINT /= 2; + sMND /= 2; + sCHR /= 2; + sVIT /= 2; + } + else + { + sSTR = 0; + sDEX = 0; + sAGI = 0; + sINT = 0; + sMND = 0; + sCHR = 0; + sVIT = 0; + } + + PTrust->stats.STR = fSTR + mSTR + sSTR; + PTrust->stats.DEX = fDEX + mDEX + sDEX; + PTrust->stats.VIT = fVIT + mVIT + sVIT; + PTrust->stats.AGI = fAGI + mAGI + sAGI; + PTrust->stats.INT = fINT + mINT + sINT; + PTrust->stats.MND = fMND + mMND + sMND; + PTrust->stats.CHR = fCHR + mCHR + sCHR; + + // cap all stats for mLvl / job + for (int i = SKILL_DIVINE_MAGIC; i <= SKILL_BLUE_MAGIC; i++) + { + uint16 maxSkill = battleutils::GetMaxSkill((SKILLTYPE)i, mJob, mLvl > 99 ? 99 : mLvl); + if (maxSkill != 0) + { + PTrust->WorkingSkills.skill[i] = maxSkill; + } + else //if the mob is WAR/BLM and can cast spell + { + // set skill as high as main level, so their spells won't get resisted + uint16 maxSubSkill = battleutils::GetMaxSkill((SKILLTYPE)i, sJob, mLvl > 99 ? 99 : mLvl); + + if (maxSubSkill != 0) + { + PTrust->WorkingSkills.skill[i] = maxSubSkill; + } + } + } + + for (int i = SKILL_HAND_TO_HAND; i <= SKILL_STAFF; i++) + { + uint16 maxSkill = battleutils::GetMaxSkill((SKILLTYPE)i, mLvl > 99 ? 99 : mLvl); + if (maxSkill != 0) + { + PTrust->WorkingSkills.skill[i] = maxSkill; + } + } + + PTrust->addModifier(Mod::DEF, mobutils::GetBase(PTrust, PTrust->defRank)); + PTrust->addModifier(Mod::EVA, mobutils::GetEvasion(PTrust)); + PTrust->addModifier(Mod::ATT, mobutils::GetBase(PTrust, PTrust->attRank)); + PTrust->addModifier(Mod::ACC, mobutils::GetBase(PTrust, PTrust->accRank)); + + //natural magic evasion + PTrust->addModifier(Mod::MEVA, mobutils::GetMagicEvasion(PTrust)); + + // add traits for sub and main + battleutils::AddTraits(PTrust, traits::GetTraits(mJob), mLvl); + battleutils::AddTraits(PTrust, traits::GetTraits(sJob), sLvl); + + mobutils::SetupJob(PTrust); +} +}; // namespace trustutils diff --git a/src/map/utils/trustutils.h b/src/map/utils/trustutils.h new file mode 100644 index 00000000000..d66985ec5f0 --- /dev/null +++ b/src/map/utils/trustutils.h @@ -0,0 +1,24 @@ +#ifndef _ITRUSTUTILS_H +#define _ITRUSTUTILS_H + +#include "../../common/cbasetypes.h" +#include "../../common/mmo.h" + +class CBattleEntity; +class CCharEntity; +class CTrustEntity; + +namespace trustutils +{ + void LoadTrustList(); + void FreeTrustList(); + + void SpawnTrust(CCharEntity* PMaster, uint32 TrustID); + + // Internal + void BuildTrust(uint32 TrustID); + CTrustEntity* LoadTrust(CCharEntity* PMaster, uint32 TrustID); + void LoadTrustStatsAndSkills(CTrustEntity* PTrust); +}; // namespace trustutils + +#endif diff --git a/src/map/zone.cpp b/src/map/zone.cpp index 2f6332fb8e9..318646d62c0 100644 --- a/src/map/zone.cpp +++ b/src/map/zone.cpp @@ -439,6 +439,22 @@ void CZone::InsertPET(CBaseEntity* PPet) m_zoneEntities->InsertPET(PPet); } +/************************************************************************ +* * +* Add a trust to the zone * +* * +************************************************************************/ + +void CZone::InsertTRUST(CBaseEntity* PTrust) +{ + m_zoneEntities->InsertTRUST(PTrust); +} + +void CZone::DeleteTRUST(CBaseEntity* PTrust) +{ + m_zoneEntities->DeleteTRUST(PTrust); +} + /************************************************************************ * * * Добавляем в зону активную область * @@ -652,6 +668,11 @@ void CZone::SpawnPETs(CCharEntity* PChar) m_zoneEntities->SpawnPETs(PChar); } +void CZone::SpawnTRUSTs(CCharEntity* PChar) +{ + m_zoneEntities->SpawnTRUSTs(PChar); +} + /************************************************************************ * * * Проверка видимости NPCs персонажем. * @@ -815,6 +836,22 @@ void CZone::ForEachMobInstance(CBaseEntity* PEntity, std::function func) +{ + for (auto PTrust : m_zoneEntities->m_trustList) + { + func((CTrustEntity*)PTrust.second); + } +} + +void CZone::ForEachTrustInstance(CBaseEntity* PEntity, std::function func) +{ + for (auto PTrust : m_zoneEntities->m_trustList) + { + func((CTrustEntity*)PTrust.second); + } +} + void CZone::ForEachNpc(std::function func) { for (auto PNpc : m_zoneEntities->m_npcList) @@ -962,6 +999,7 @@ void CZone::CharZoneOut(CCharEntity* PChar) PChar->SpawnNPCList.clear(); PChar->SpawnMOBList.clear(); PChar->SpawnPETList.clear(); + PChar->SpawnTRUSTList.clear(); if (PChar->PParty && PChar->loc.destination != 0 && PChar->m_moghouseID == 0) { diff --git a/src/map/zone.h b/src/map/zone.h index ef500b561cc..72f443b9f6d 100644 --- a/src/map/zone.h +++ b/src/map/zone.h @@ -509,6 +509,7 @@ class CBaseEntity; class CCharEntity; class CNpcEntity; class CBattleEntity; +class CTrustEntity; class CTreasurePool; class CZoneEntities; @@ -555,6 +556,7 @@ class CZone virtual void SpawnMOBs(CCharEntity* PChar); // отображаем MOBs в зоне virtual void SpawnPETs(CCharEntity* PChar); // отображаем PETs в зоне virtual void SpawnNPCs(CCharEntity* PChar); // отображаем NPCs в зоне + virtual void SpawnTRUSTs(CCharEntity* PChar); // Display TRUSTs in zone virtual void SpawnMoogle(CCharEntity* PChar); // отображаем Moogle в MogHouse virtual void SpawnTransport(CCharEntity* PChar); // отображаем транспорт void SavePlayTime(); @@ -567,7 +569,10 @@ class CZone virtual void InsertNPC(CBaseEntity* PNpc); // добавляем в зону npc virtual void InsertMOB(CBaseEntity* PMob); // добавляем в зону mob virtual void InsertPET(CBaseEntity* PPet); // добавляем в зону pet + virtual void InsertTRUST(CBaseEntity* PTrust); // Add a trust to the zone + virtual void DeletePET(CBaseEntity* PPet); // derefs the pet's ID from this zone + virtual void DeleteTRUST(CBaseEntity* PTrust); virtual void FindPartyForMob(CBaseEntity* PEntity); // ищем группу для монстра virtual void TransportDepart(uint16 boundary, uint16 zone); // транспотр отправляется, необходимо собрать пассажиров @@ -587,6 +592,8 @@ class CZone virtual void ForEachCharInstance(CBaseEntity* PEntity, std::function func); virtual void ForEachMob(std::function func); virtual void ForEachMobInstance(CBaseEntity* PEntity, std::function func); + virtual void ForEachTrust(std::function func); + virtual void ForEachTrustInstance(CBaseEntity* PEntity, std::function func); virtual void ForEachNpc(std::function func); CZone(ZONEID ZoneID, REGIONTYPE RegionID, CONTINENTTYPE ContinentID); diff --git a/src/map/zone_entities.cpp b/src/map/zone_entities.cpp index 2a0aea4d02f..065bfcc6449 100644 --- a/src/map/zone_entities.cpp +++ b/src/map/zone_entities.cpp @@ -34,11 +34,13 @@ along with this program. If not, see http://www.gnu.org/licenses/ #include "ai/ai_container.h" #include "ai/controllers/mob_controller.h" +#include "entities/trustentity.h" #include "entities/mobentity.h" #include "entities/npcentity.h" #include "packets/char.h" #include "packets/char_sync.h" +#include "packets/trust_sync.h" #include "packets/entity_update.h" #include "packets/entity_visual.h" #include "packets/wide_scan.h" @@ -162,6 +164,57 @@ void CZoneEntities::InsertPET(CBaseEntity* PPet) ShowError(CL_RED"CZone::InsertPET : entity is null\n" CL_RESET); } +void CZoneEntities::InsertTRUST(CBaseEntity* PTrust) +{ + if (PTrust != nullptr) + { + CTrustEntity* trust = (CTrustEntity*)PTrust; + CCharEntity* master = (CCharEntity*)trust->PMaster; + uint16 targid = 0x800; + + for (EntityList_t::const_iterator it = m_trustList.begin(); it != m_trustList.end(); ++it) + { + if (targid != it->first) + { + break; + } + targid++; + } + if (targid >= 0x900) + { + ShowError(CL_RED"CZone::InsertTRUST : targid is high (03hX)\n" CL_RESET, targid); + return; + } + PTrust->id = 0x1000000 + (m_zone->GetID() << 12) + targid; + PTrust->targid = targid; + PTrust->loc.zone = m_zone; + m_trustList[PTrust->targid] = PTrust; + + for (EntityList_t::const_iterator it = m_charList.begin(); it != m_charList.end(); ++it) + { + CCharEntity* PCurrentChar = (CCharEntity*)it->second; + + if (distance(PTrust->loc.p, PCurrentChar->loc.p) < 50) + { + if (PCurrentChar->targid == ((CBattleEntity*)PTrust)->PMaster->targid) + { + PCurrentChar->SpawnTRUSTList[PTrust->id] = PTrust; + } + PCurrentChar->pushPacket(new CEntityUpdatePacket(PTrust, ENTITY_SPAWN, UPDATE_ALL_MOB)); + } + } + return; + } +} + +void CZoneEntities::DeleteTRUST(CBaseEntity* PTrust) +{ + if (PTrust != nullptr) + { + m_trustList.erase(PTrust->id); + } +} + void CZoneEntities::FindPartyForMob(CBaseEntity* PEntity) { TPZ_DEBUG_BREAK_IF(PEntity == nullptr); @@ -318,6 +371,19 @@ void CZoneEntities::DecreaseZoneCounter(CCharEntity* PChar) } } + //remove trusts + for (auto trust : PChar->PTrusts) + { + for (EntityList_t::const_iterator it = m_charList.begin(); it != m_charList.end(); ++it) + { + //inform other players of the pets removal + CCharEntity* PCurrentChar = (CCharEntity*)it->second; + PCurrentChar->pushPacket(new CEntityUpdatePacket(trust, ENTITY_DESPAWN, UPDATE_NONE)); + } + } + PChar->ClearTrusts(); + PChar->SpawnTRUSTList.clear(); + if (m_zone->m_BattlefieldHandler) m_zone->m_BattlefieldHandler->RemoveFromBattlefield(PChar, PChar->PBattlefield, BATTLEFIELD_LEAVE_CODE_WARPDC); @@ -486,6 +552,35 @@ void CZoneEntities::SpawnNPCs(CCharEntity* PChar) } } +void CZoneEntities::SpawnTRUSTs(CCharEntity* PChar) +{ + for (EntityList_t::const_iterator it = m_trustList.begin(); it != m_trustList.end(); ++it) + { + CTrustEntity* PCurrentTrust = (CTrustEntity*)it->second; + CCharEntity* master = (CCharEntity*)PCurrentTrust->PMaster; + SpawnIDList_t::iterator TRUST = PChar->SpawnTRUSTList.lower_bound(PCurrentTrust->id); + + if (PCurrentTrust->status == STATUS_NORMAL && + distance(PChar->loc.p, PCurrentTrust->loc.p) < 50) + { + if (TRUST == PChar->SpawnTRUSTList.end() || PChar->SpawnTRUSTList.key_comp()(PCurrentTrust->id, TRUST->first)) + { + PChar->SpawnTRUSTList.insert(TRUST, SpawnIDList_t::value_type(PCurrentTrust->id, PCurrentTrust)); + PChar->pushPacket(new CEntityUpdatePacket(PCurrentTrust, ENTITY_SPAWN, UPDATE_ALL_MOB)); + PChar->pushPacket(new CTrustSyncPacket(master, PCurrentTrust)); + } + } + else { + if (TRUST != PChar->SpawnTRUSTList.end() && + !(PChar->SpawnTRUSTList.key_comp()(PCurrentTrust->id, TRUST->first))) + { + PChar->SpawnTRUSTList.erase(TRUST); + PChar->pushPacket(new CEntityUpdatePacket(PCurrentTrust, ENTITY_DESPAWN, UPDATE_NONE)); + } + } + } +} + void CZoneEntities::SpawnPCs(CCharEntity* PChar) { for (EntityList_t::const_iterator it = m_charList.begin(); it != m_charList.end(); ++it) @@ -609,7 +704,7 @@ CBaseEntity* CZoneEntities::GetEntity(uint16 targid, uint8 filter) } else if (targid < 0x800) { - if (filter & TYPE_PET || filter & TYPE_TRUST) + if (filter & TYPE_PET) { EntityList_t::const_iterator it = m_petList.find(targid); if (it != m_petList.end()) @@ -618,6 +713,17 @@ CBaseEntity* CZoneEntities::GetEntity(uint16 targid, uint8 filter) } } } + else if (targid < 0x900) + { + if (filter & TYPE_TRUST) + { + EntityList_t::const_iterator it = m_trustList.find(targid); + if (it != m_trustList.end()) + { + return it->second; + } + } + } return nullptr; } @@ -818,10 +924,14 @@ void CZoneEntities::PushPacket(CBaseEntity* PEntity, GLOBAL_MESSAGE_TYPE message spawnlist = PCurrentChar->SpawnNPCList; } } - else if (entity->targid >= 0x700) + else if (entity->targid < 0x800) { spawnlist = PCurrentChar->SpawnPETList; } + else if (entity->targid < 0x900) + { + spawnlist = PCurrentChar->SpawnTRUSTList; + } else { entity = nullptr; @@ -973,6 +1083,43 @@ void CZoneEntities::ZoneServer(time_point tick, bool check_regions) } } + EntityList_t::const_iterator trustit = m_trustList.begin(); + while (trustit != m_trustList.end()) + { + CTrustEntity* PTrust = (CTrustEntity*)trustit->second; + PTrust->PRecastContainer->Check(); + PTrust->StatusEffectContainer->CheckEffectsExpiry(tick); + if (tick > m_EffectCheckTime) + { + PTrust->StatusEffectContainer->TickRegen(tick); + PTrust->StatusEffectContainer->TickEffects(tick); + } + PTrust->PAI->Tick(tick); + if (PTrust->status == STATUS_DISAPPEAR) + { + for (auto PMobIt : m_mobList) + { + CMobEntity* PCurrentMob = (CMobEntity*)PMobIt.second; + PCurrentMob->PEnmityContainer->Clear(PTrust->id); + } + for (EntityList_t::const_iterator it = m_charList.begin(); it != m_charList.end(); ++it) + { + CCharEntity* PChar = (CCharEntity*)it->second; + if (distance(PChar->loc.p, PTrust->loc.p) < 50) + { + PChar->SpawnTRUSTList.erase(PTrust->id); + PChar->ReloadPartyInc(); + } + } + + delete trustit->second; + m_trustList.erase(trustit++); + } + else { + ++trustit; + } + } + for (EntityList_t::const_iterator it = m_charList.begin(); it != m_charList.end(); ++it) { CCharEntity* PChar = (CCharEntity*)it->second; diff --git a/src/map/zone_entities.h b/src/map/zone_entities.h index aff6a48cf97..3309979b672 100644 --- a/src/map/zone_entities.h +++ b/src/map/zone_entities.h @@ -38,6 +38,7 @@ class CZoneEntities void SpawnMOBs(CCharEntity* PChar); // отображаем MOBs в зоне void SpawnPETs(CCharEntity* PChar); // отображаем PETs в зоне void SpawnNPCs(CCharEntity* PChar); // отображаем NPCs в зоне + void SpawnTRUSTs(CCharEntity* PChar); void SpawnMoogle(CCharEntity* PChar); // отображаем Moogle в MogHouse void SpawnTransport(CCharEntity* PChar); // отображаем транспорт void DespawnPC(CCharEntity* PChar); @@ -52,7 +53,9 @@ class CZoneEntities void InsertNPC(CBaseEntity* PNpc); // добавляем в зону npc void InsertMOB(CBaseEntity* PMob); // добавляем в зону mob void InsertPET(CBaseEntity* PPet); // добавляем в зону pet + void InsertTRUST(CBaseEntity* PTrust); void DeletePET(CBaseEntity* PPet); // derefs the pet's ID from this zone + void DeleteTRUST(CBaseEntity* PTrust); void FindPartyForMob(CBaseEntity* PEntity); // ищем группу для монстра void TransportDepart(uint16 boundary, uint16 zone); // транспотр отправляется, необходимо собрать пассажиров @@ -72,6 +75,7 @@ class CZoneEntities EntityList_t m_allyList; EntityList_t m_mobList; // список всех MOBs в зоне EntityList_t m_petList; // список всех PETs в зоне + EntityList_t m_trustList; EntityList_t m_npcList; // список всех NPCs в зоне EntityList_t m_charList; // список всех PCs в зоне diff --git a/src/map/zone_instance.cpp b/src/map/zone_instance.cpp index a2d8a2d588e..20e8dce539a 100644 --- a/src/map/zone_instance.cpp +++ b/src/map/zone_instance.cpp @@ -110,6 +110,22 @@ void CZoneInstance::InsertPET(CBaseEntity* PPet) } } +void CZoneInstance::InsertTRUST(CBaseEntity* PTrust) +{ + if (PTrust->PInstance) + { + PTrust->PInstance->InsertTRUST(PTrust); + } +} + +void CZoneInstance::DeleteTRUST(CBaseEntity* PTrust) +{ + if (PTrust->PInstance) + { + PTrust->PInstance->DeleteTRUST(PTrust); + } +} + void CZoneInstance::FindPartyForMob(CBaseEntity* PEntity) { if (PEntity->PInstance) @@ -241,6 +257,14 @@ void CZoneInstance::SpawnPETs(CCharEntity* PChar) } } +void CZoneInstance::SpawnTRUSTs(CCharEntity* PChar) +{ + if (PChar->PInstance) + { + PChar->PInstance->SpawnTRUSTs(PChar); + } +} + void CZoneInstance::SpawnNPCs(CCharEntity* PChar) { if (PChar->PInstance) diff --git a/src/map/zone_instance.h b/src/map/zone_instance.h index d892bef7e3c..c4da5bea1c7 100644 --- a/src/map/zone_instance.h +++ b/src/map/zone_instance.h @@ -38,6 +38,7 @@ class CZoneInstance : public CZone virtual void SpawnPCs(CCharEntity* PChar) override; // отображаем персонажей в зоне virtual void SpawnMOBs(CCharEntity* PChar) override; // отображаем MOBs в зоне virtual void SpawnPETs(CCharEntity* PChar) override; // отображаем PETs в зоне + virtual void SpawnTRUSTs(CCharEntity* PChar) override; virtual void SpawnNPCs(CCharEntity* PChar) override; // отображаем NPCs в зоне virtual void SpawnMoogle(CCharEntity* PChar) override; // отображаем Moogle в MogHouse virtual void SpawnTransport(CCharEntity* PChar) override; // отображаем транспорт @@ -50,6 +51,8 @@ class CZoneInstance : public CZone virtual void InsertNPC(CBaseEntity* PNpc) override; // добавляем в зону npc virtual void InsertMOB(CBaseEntity* PMob) override; // добавляем в зону mob virtual void InsertPET(CBaseEntity* PPet) override; // добавляем в зону pet + virtual void InsertTRUST(CBaseEntity* PTrust) override; + virtual void DeleteTRUST(CBaseEntity* PTrust) override; virtual void DeletePET(CBaseEntity* PPet) override; // derefs the pet's ID from this zone virtual void FindPartyForMob(CBaseEntity* PEntity) override; // ищем группу для монстра diff --git a/win32/vcxproj/topaz_game.vcxproj b/win32/vcxproj/topaz_game.vcxproj index 49016fddcdd..538dae6cd1b 100644 --- a/win32/vcxproj/topaz_game.vcxproj +++ b/win32/vcxproj/topaz_game.vcxproj @@ -457,6 +457,7 @@ + @@ -708,6 +709,7 @@ + diff --git a/win32/vcxproj/topaz_game.vcxproj.filters b/win32/vcxproj/topaz_game.vcxproj.filters index 2db07ec0a75..1a0f1504d46 100644 --- a/win32/vcxproj/topaz_game.vcxproj.filters +++ b/win32/vcxproj/topaz_game.vcxproj.filters @@ -677,6 +677,9 @@ Header Files\utils + + Header Files\utils + Header Files\utils @@ -1417,6 +1420,9 @@ Source Files\utils + + Source Files\utils + Source Files\utils