From e4e04cc8e53606e123cfa30299185770c61c438d Mon Sep 17 00:00:00 2001 From: Omnione <10185476+Omnione@users.noreply.github.com> Date: Sun, 5 Jan 2020 11:21:44 +0000 Subject: [PATCH 1/7] Added the auto creation of a vector list of trust id's and QueryTrust to iterate through the list to generate a list of trust. Cleaned up some other bits and pieces. --- scripts/globals/spells/trust/Shantotto_II.lua | 2 +- scripts/globals/spells/trust/kupipi.lua | 16 ++ scripts/globals/spells/trust/naji.lua | 16 ++ scripts/globals/spells/trust/shantotto.lua | 4 +- scripts/globals/spells/trust/trion.lua | 16 ++ sql/mob_pools.sql | 18 +- sql/pet_list.sql | 4 +- src/map/ai/controllers/trust_controller.cpp | 67 ++++- src/map/ai/controllers/trust_controller.h | 14 +- src/map/entities/charentity.cpp | 23 +- src/map/entities/charentity.h | 25 +- src/map/entities/trustentity.h | 4 +- src/map/utils/petutils.cpp | 240 ++++++++++++++++-- src/map/utils/petutils.h | 9 +- 14 files changed, 395 insertions(+), 63 deletions(-) create mode 100644 scripts/globals/spells/trust/kupipi.lua create mode 100644 scripts/globals/spells/trust/naji.lua create mode 100644 scripts/globals/spells/trust/trion.lua diff --git a/scripts/globals/spells/trust/Shantotto_II.lua b/scripts/globals/spells/trust/Shantotto_II.lua index 47041e745bd..f6d5643754c 100644 --- a/scripts/globals/spells/trust/Shantotto_II.lua +++ b/scripts/globals/spells/trust/Shantotto_II.lua @@ -9,6 +9,6 @@ function onMagicCastingCheck(caster,target,spell) end function onSpellCast(caster,target,spell) - -- caster:spawnTrust(1019) + caster:spawnTrust(1019) return 0 end diff --git a/scripts/globals/spells/trust/kupipi.lua b/scripts/globals/spells/trust/kupipi.lua new file mode 100644 index 00000000000..7bc12778bfa --- /dev/null +++ b/scripts/globals/spells/trust/kupipi.lua @@ -0,0 +1,16 @@ +----------------------------------------- +-- Spell: Kupipi +----------------------------------------- +require("scripts/globals/trust"); +----------------------------------------- + +function onMagicCastingCheck(caster,target,spell) + return 0 +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(898) + return 0 +end diff --git a/scripts/globals/spells/trust/naji.lua b/scripts/globals/spells/trust/naji.lua new file mode 100644 index 00000000000..0a35f4127c4 --- /dev/null +++ b/scripts/globals/spells/trust/naji.lua @@ -0,0 +1,16 @@ +----------------------------------------- +-- Spell: Naji +----------------------------------------- +require("scripts/globals/trust"); +----------------------------------------- + +function onMagicCastingCheck(caster,target,spell) + return 0 +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(897) + return 0 +end diff --git a/scripts/globals/spells/trust/shantotto.lua b/scripts/globals/spells/trust/shantotto.lua index efb1ff6ed61..6205f0549b1 100644 --- a/scripts/globals/spells/trust/shantotto.lua +++ b/scripts/globals/spells/trust/shantotto.lua @@ -1,7 +1,7 @@ ----------------------------------------- -- Spell: Shantotto ----------------------------------------- --- require("scripts/globals/trust"); +require("scripts/globals/trust"); ----------------------------------------- function onMagicCastingCheck(caster,target,spell) @@ -11,6 +11,6 @@ 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 + caster:spawnTrust(896) return 0 end diff --git a/scripts/globals/spells/trust/trion.lua b/scripts/globals/spells/trust/trion.lua new file mode 100644 index 00000000000..e578db446b0 --- /dev/null +++ b/scripts/globals/spells/trust/trion.lua @@ -0,0 +1,16 @@ +----------------------------------------- +-- Spell: Trion +----------------------------------------- +require("scripts/globals/trust"); +----------------------------------------- + +function onMagicCastingCheck(caster,target,spell) + return 0 +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(905) + return 0 +end diff --git a/sql/mob_pools.sql b/sql/mob_pools.sql index 3bf42ee187a..dde71162d5b 100644 --- a/sql/mob_pools.sql +++ b/sql/mob_pools.sql @@ -5954,15 +5954,15 @@ INSERT INTO `mob_pools` VALUES (5893,'Gloombound_Lurker','Gloombound_Lurker',221 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 (5897,'Naji','Naji',149,0x0000B90B00000000000000000000000000000000,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 (5898,'Kupipi','Kupipi',153,0x0000BA0B00000000000000000000000000000000,3,0,11,230,100,2,0,0,0,0,0,32,0,3,0,1,3,1,0,3); +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,4,1,0,4); +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,5); +INSERT INTO `mob_pools` VALUES (5901,'NanaaMihgo','Nanaa_Mihgo',152,0x0000BD0B00000000000000000000000000000000,6,0,2,190,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,6); +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,7,1,0,7); +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,8); +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,1,9,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,10,1,0,10); -- INSERT INTO `mob_pools` VALUES (5906,'zeid', -- INSERT INTO `mob_pools` VALUES (5907,'lion', -- INSERT INTO `mob_pools` VALUES (5908,'tenzen', diff --git a/sql/pet_list.sql b/sql/pet_list.sql index 2fa4b47a191..6b76f825ce4 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/src/map/ai/controllers/trust_controller.cpp b/src/map/ai/controllers/trust_controller.cpp index 221241e0a4d..3f14ee14ab7 100644 --- a/src/map/ai/controllers/trust_controller.cpp +++ b/src/map/ai/controllers/trust_controller.cpp @@ -25,11 +25,13 @@ This file is part of DarkStar-server source code. #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" +#include "../../lua/lua_baseentity.h" CTrustController::CTrustController(CCharEntity* PChar, CTrustEntity* PTrust) : CController(PTrust) { @@ -51,17 +53,38 @@ void CTrustController::Despawn() if (POwner->PMaster) { POwner->PMaster = nullptr; + POwner->PAI->Internal_Despawn(); } - CController::Despawn(); + //CController::Despawn(); } void CTrustController::Tick(time_point tick) { m_Tick = tick; + if (!POwner->PMaster) + return; + if (POwner->PAI->IsEngaged()) { - DoCombatTick(tick); + auto PTarget{ POwner->GetBattleTarget() }; + + if (PTarget) + { + auto PMob = static_cast(PTarget); + + if (PMob->PEnmityContainer->GetHighestEnmity() != nullptr) + { + if (PMob->PEnmityContainer->HasID(POwner->PMaster->id)) + { + DoCombatTick(tick); + } + else if (!POwner->isDead()) + { + DoRoamTick(tick); + } + } + } } else if (!POwner->isDead()) { @@ -75,11 +98,14 @@ void CTrustController::DoCombatTick(time_point tick) { POwner->PAI->Internal_Disengage(); } + if (POwner->PMaster->GetBattleTargetID() != POwner->GetBattleTargetID()) { POwner->PAI->Internal_ChangeTarget(POwner->PMaster->GetBattleTargetID()); } + auto PTarget{ POwner->GetBattleTarget() }; + if (PTarget) { if (POwner->PAI->CanFollowPath()) @@ -105,17 +131,42 @@ void CTrustController::DoRoamTick(time_point tick) POwner->PAI->Internal_Engage(POwner->PMaster->GetBattleTargetID()); } - float currentDistance = distance(POwner->loc.p, POwner->PMaster->loc.p); + auto master = static_cast(POwner->PMaster); + auto PTrust = static_cast(POwner); + uint8 currentPartyPos = master->TrustPartyPosition(PTrust); + float currentDistance = 0; - if (currentDistance > RoamDistance) + if (currentPartyPos == 0) { - if (currentDistance < 35.0f && POwner->PAI->PathFind->PathAround(POwner->PMaster->loc.p, 2.0f, PATHFLAG_RUN | PATHFLAG_WALLHACK)) + currentDistance = distance(POwner->loc.p, POwner->PMaster->loc.p); + + if (currentDistance > RoamDistance) { - POwner->PAI->PathFind->FollowPath(); + if (currentDistance < 35.0f && PTrust->PAI->PathFind->PathTo(POwner->PMaster->loc.p, PATHFLAG_RUN | PATHFLAG_WALLHACK)) + { + PTrust->PAI->PathFind->FollowPath(); + } + else if (POwner->GetSpeed() > 0) + { + PTrust->PAI->PathFind->WarpTo(POwner->PMaster->loc.p, RoamDistance); + } } - else if (POwner->GetSpeed() > 0) + } + else if(currentPartyPos > 0) + { + CBattleEntity* PFollow = (CBattleEntity*)master->PTrusts.at(currentPartyPos - 1); + currentDistance = distance(PTrust->loc.p, PFollow->loc.p); + + if (currentDistance > 2.0f) { - POwner->PAI->PathFind->WarpTo(POwner->PMaster->loc.p, RoamDistance); + if (currentDistance < 35.0f && PTrust->PAI->PathFind->PathTo(PFollow->loc.p, PATHFLAG_RUN | PATHFLAG_WALLHACK)) + { + PTrust->PAI->PathFind->FollowPath(); + } + else if (POwner->GetSpeed() > 0) + { + PTrust->PAI->PathFind->WarpTo(PFollow->loc.p, RoamDistance); + } } } } diff --git a/src/map/ai/controllers/trust_controller.h b/src/map/ai/controllers/trust_controller.h index 57f6c8d93d9..504bfd91c86 100644 --- a/src/map/ai/controllers/trust_controller.h +++ b/src/map/ai/controllers/trust_controller.h @@ -32,22 +32,26 @@ class CTrustEntity; class CTrustController : public CController { public: + CTrustController(CCharEntity*, CTrustEntity*); + CBattleEntity* PTarget{ nullptr }; virtual ~CTrustController(); + static constexpr float RoamDistance{ 5.5f }; + virtual void DoCombatTick(time_point tick); + virtual void DoRoamTick(time_point tick); + +protected: virtual void Tick(time_point) override; virtual void Despawn() 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; } private: - static constexpr float RoamDistance{ 2.1f }; - void DoCombatTick(time_point tick); - void DoRoamTick(time_point tick); + + }; #endif // _TRUSTCONTROLLER \ No newline at end of file diff --git a/src/map/entities/charentity.cpp b/src/map/entities/charentity.cpp index 4d53b7335d5..3bb424bd702 100644 --- a/src/map/entities/charentity.cpp +++ b/src/map/entities/charentity.cpp @@ -478,17 +478,38 @@ void CCharEntity::RemoveTrust(CTrustEntity* PTrust) return; auto trustIt = std::remove_if(PTrusts.begin(), PTrusts.end(), [PTrust](auto trust) { return PTrust == trust; }); + if (trustIt != PTrusts.end()) { PTrust->PAI->Despawn(); PTrusts.erase(trustIt); } + if (PParty != nullptr) { - PParty->ReloadParty(); + if (PTrusts.size() < 1 && PParty->members.size() == 1) + { + PParty->DisbandParty(); + } + else + { + PParty->ReloadParty(); + } } } +uint8 CCharEntity::TrustPartyPosition(CTrustEntity* PTrust) +{ + for (uint8 i = 0; i < PTrusts.size(); i++) + { + if (PTrusts.at(i)->id == PTrust->id) + { + return i; + } + } + return 0; +} + void CCharEntity::ClearTrusts() { if (PTrusts.size() == 0) diff --git a/src/map/entities/charentity.h b/src/map/entities/charentity.h index d34f93648f0..a24aac858a5 100644 --- a/src/map/entities/charentity.h +++ b/src/map/entities/charentity.h @@ -213,19 +213,20 @@ class CCharEntity : public CBattleEntity UnlockedAttachments_t m_unlockedAttachments; // Unlocked Automaton Attachments (1 bit per attachment) CAutomatonEntity* PAutomaton; // Automaton statistics + CTrustEntity* PTrust; // Trust statistics 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 + 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 - // TODO: половина этого массива должна храниться в char_vars, а не здесь, т.к. эта информация не отображается в интерфейсе клиента и сервер не проводит с ними никаких операций + // TODO: half of this array should be stored in char_vars, and not here, because this information is not displayed in the client interface and the server does not perform any operations with them //currency_t m_currency; // conquest points, imperial standing points etc Teleport_t teleport; // Outposts, Runic Portals, Homepoints, Survival Guides, Maws, etc @@ -260,10 +261,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-ю символами) @@ -328,6 +330,7 @@ class CCharEntity : public CBattleEntity bool ReloadParty(); void ClearTrusts(); void RemoveTrust(CTrustEntity*); + uint8 TrustPartyPosition(CTrustEntity* PTrust); virtual void Tick(time_point) override; void PostTick() override; diff --git a/src/map/entities/trustentity.h b/src/map/entities/trustentity.h index 543acb53c2c..45b813e2e07 100644 --- a/src/map/entities/trustentity.h +++ b/src/map/entities/trustentity.h @@ -32,8 +32,8 @@ class CTrustEntity : public CMobEntity public: CTrustEntity(CCharEntity*); ~CTrustEntity(); - uint8 m_Element; - uint32 m_PetID; + uint32 m_TrustID; + uint16 m_PartyPosition; virtual void PostTick() override; virtual void FadeOut() override; diff --git a/src/map/utils/petutils.cpp b/src/map/utils/petutils.cpp index af327476bca..d02196c20e9 100644 --- a/src/map/utils/petutils.cpp +++ b/src/map/utils/petutils.cpp @@ -59,6 +59,7 @@ This file is part of DarkStar-server source code. #include "../packets/message_standard.h" #include "../packets/pet_sync.h" #include "../packets/trust_sync.h" +#include "../ai/controllers/trust_controller.h" struct Pet_t { @@ -128,6 +129,71 @@ struct Pet_t std::vector g_PPetList; +struct Trust_t +{ + uint16 trustID; + look_t look; // appearance data + string_t name; // 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_PTrustIDList; +std::vector g_PTrustList; + namespace petutils { @@ -246,6 +312,132 @@ namespace petutils } } + 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) + { + uint32 TrustID = (uint16)Sql_GetIntData(SqlHandle, 0); + + g_PTrustIDList.push_back(TrustID); + } + } + + for each (uint32 id in g_PTrustIDList) + { + QueryTrust(id); + } + } + + void QueryTrust(uint32 TrustID) + { + const char* Query = + "SELECT \ + mob_pools.name,\ + modelid,\ + mobsize,\ + systemid,\ + mob_pools.familyid,\ + mob_pools.mJob,\ + mob_pools.sJob,\ + (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, \ + hasSpellScript, spellList, \ + Slash, Pierce, H2H, Impact, \ + Fire, Ice, Wind, Earth, Lightning, Water, Light, Dark, \ + cmbDelay, name_prefix, mob_pools.skill_list_id, \ + spell_list.spellid, mob_pools.behavior \ + 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)); + memcpy(&trust->look, Sql_GetData(SqlHandle, 1), 20); + + trust->size = Sql_GetUIntData(SqlHandle, 2); + trust->EcoSystem = (ECOSYSTEM)Sql_GetIntData(SqlHandle, 3); + trust->m_Family = (uint16)Sql_GetIntData(SqlHandle, 4); + trust->mJob = (uint8)Sql_GetIntData(SqlHandle, 5); + trust->sJob = (uint8)Sql_GetIntData(SqlHandle, 6); + trust->HPscale = Sql_GetFloatData(SqlHandle, 7); + trust->MPscale = Sql_GetFloatData(SqlHandle, 8); + trust->speed = (uint8)Sql_GetIntData(SqlHandle, 9); + trust->strRank = (uint8)Sql_GetIntData(SqlHandle, 10); + trust->dexRank = (uint8)Sql_GetIntData(SqlHandle, 11); + trust->vitRank = (uint8)Sql_GetIntData(SqlHandle, 12); + trust->agiRank = (uint8)Sql_GetIntData(SqlHandle, 13); + trust->intRank = (uint8)Sql_GetIntData(SqlHandle, 14); + trust->mndRank = (uint8)Sql_GetIntData(SqlHandle, 15); + trust->chrRank = (uint8)Sql_GetIntData(SqlHandle, 16); + trust->defRank = (uint8)Sql_GetIntData(SqlHandle, 17); + trust->attRank = (uint8)Sql_GetIntData(SqlHandle, 18); + trust->accRank = (uint8)Sql_GetIntData(SqlHandle, 19); + trust->evaRank = (uint8)Sql_GetIntData(SqlHandle, 20); + trust->hasSpellScript = (bool)Sql_GetIntData(SqlHandle, 21); + trust->spellList = (uint16)Sql_GetIntData(SqlHandle, 22); + + // resistances + trust->slashres = (uint16)(Sql_GetFloatData(SqlHandle, 23) * 1000); + trust->pierceres = (uint16)(Sql_GetFloatData(SqlHandle, 24) * 1000); + trust->hthres = (uint16)(Sql_GetFloatData(SqlHandle, 25) * 1000); + trust->impactres = (uint16)(Sql_GetFloatData(SqlHandle, 26) * 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, 27) - 1) * -100); + trust->iceres = (uint16)((Sql_GetFloatData(SqlHandle, 28) - 1) * -100); + trust->windres = (uint16)((Sql_GetFloatData(SqlHandle, 29) - 1) * -100); + trust->earthres = (uint16)((Sql_GetFloatData(SqlHandle, 30) - 1) * -100); + trust->thunderres = (uint16)((Sql_GetFloatData(SqlHandle, 31) - 1) * -100); + trust->waterres = (uint16)((Sql_GetFloatData(SqlHandle, 32) - 1) * -100); + trust->lightres = (uint16)((Sql_GetFloatData(SqlHandle, 33) - 1) * -100); + trust->darkres = (uint16)((Sql_GetFloatData(SqlHandle, 34) - 1) * -100); + + trust->cmbDelay = (uint16)Sql_GetIntData(SqlHandle, 35); + trust->name_prefix = (uint8)Sql_GetUIntData(SqlHandle, 36); + trust->m_MobSkillList = (uint16)Sql_GetUIntData(SqlHandle, 37); + + g_PTrustList.push_back(trust); + } + } + } + /************************************************************************ * * * Освобождаем список прототипов питомцев * @@ -261,6 +453,11 @@ namespace petutils } } + void FreeTrustList() + { + g_PTrustIDList.clear(); + } + void AttackTarget(CBattleEntity* PMaster, CBattleEntity* PTarget) { DSP_DEBUG_BREAK_IF(PMaster->PPet == nullptr); @@ -1075,7 +1272,7 @@ namespace petutils // 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) + if (PTrust->m_TrustID == TrustID) { PMaster->pushPacket(new CMessageStandardPacket(PMaster, 0, MsgStd::TrustSame)); return; @@ -1090,7 +1287,7 @@ namespace petutils } CTrustEntity* PTrust = LoadTrust(PMaster, TrustID); - PMaster->PTrusts.insert(PMaster->PTrusts.begin(), PTrust); + PMaster->PTrusts.insert(PMaster->PTrusts.end(), PTrust); PMaster->StatusEffectContainer->CopyConfrontationEffect(PTrust); PMaster->loc.zone->InsertPET(PTrust); PMaster->PParty->ReloadParty(); @@ -1724,27 +1921,38 @@ namespace petutils CTrustEntity* LoadTrust(CCharEntity* PMaster, uint32 TrustID) { - DSP_DEBUG_BREAK_IF(TrustID >= g_PPetList.size()); + + DSP_DEBUG_BREAK_IF(TrustID < 896 || (TrustID > 998 && TrustID < 1003) || TrustID > 1023); CTrustEntity* PTrust = new CTrustEntity(PMaster); + + auto index = 0; + for (size_t i = 0; i < g_PTrustList.size(); i++) + { + if (g_PTrustList.at(i)->trustID == TrustID) + { + index = i; + } + } + + Trust_t* trustData = g_PTrustList.at(index); + 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->loc.p = nearPosition(PMaster->loc.p, CTrustController::RoamDistance, (float)M_PI); + PTrust->look = trustData->look; + PTrust->name = trustData->name; + PTrust->m_name_prefix = trustData->name_prefix; + PTrust->m_Family = trustData->m_Family; + PTrust->m_MobSkillList = trustData->m_MobSkillList; + PTrust->SetMJob(trustData->mJob); + PTrust->SetSJob(trustData->sJob); // TODO: This may not be true for some trusts + PTrust->m_TrustID = TrustID; PTrust->status = STATUS_NORMAL; - PTrust->m_ModelSize = trust->size; - PTrust->m_EcoSystem = trust->EcoSystem; + PTrust->m_ModelSize = trustData->size; + PTrust->m_EcoSystem = trustData->EcoSystem; // assume level matches master PTrust->SetMLevel(PMaster->GetMLevel()); diff --git a/src/map/utils/petutils.h b/src/map/utils/petutils.h index d8c0f935028..0804caa173f 100644 --- a/src/map/utils/petutils.h +++ b/src/map/utils/petutils.h @@ -58,11 +58,7 @@ 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 }; @@ -74,6 +70,8 @@ namespace petutils { void LoadPetList(); void FreePetList(); + void LoadTrustList(); + void FreeTrustList(); void SpawnPet(CBattleEntity* PMaster, uint32 PetID, bool spawningFromZone); void SpawnMobPet(CBattleEntity* PMaster, uint32 PetID); @@ -88,6 +86,7 @@ namespace petutils void LoadWyvernStatistics(CBattleEntity* PMaster, CPetEntity* PPet, bool finalize); void FinalizePetStatistics(CBattleEntity* PMaster, CPetEntity* PPet); bool CheckPetModType(CBattleEntity* PPet, PetModType petmod); + void QueryTrust(uint32 TrustID); CTrustEntity* LoadTrust(CCharEntity* PMaster, uint32 TrustID); }; From e6ce35cd0c78f788aa1a3b442cdefaad30a73889 Mon Sep 17 00:00:00 2001 From: Omnione <10185476+Omnione@users.noreply.github.com> Date: Sun, 5 Jan 2020 11:38:46 +0000 Subject: [PATCH 2/7] style fixes, (not mine lol) --- src/map/utils/petutils.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/map/utils/petutils.h b/src/map/utils/petutils.h index 0804caa173f..06cd4a6a13c 100644 --- a/src/map/utils/petutils.h +++ b/src/map/utils/petutils.h @@ -68,12 +68,12 @@ class CTrustEntity; namespace petutils { - void LoadPetList(); - void FreePetList(); + void LoadPetList(); + void FreePetList(); void LoadTrustList(); void FreeTrustList(); - 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); From ed1199ab8e96cfdfef01c5b4564119850b996fef Mon Sep 17 00:00:00 2001 From: Omnione <10185476+Omnione@users.noreply.github.com> Date: Sun, 5 Jan 2020 12:29:14 +0000 Subject: [PATCH 3/7] Changed iteration method of trust id's to query trust. --- src/map/utils/petutils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/map/utils/petutils.cpp b/src/map/utils/petutils.cpp index d4126706b46..3358a255ec7 100644 --- a/src/map/utils/petutils.cpp +++ b/src/map/utils/petutils.cpp @@ -332,9 +332,9 @@ namespace petutils } } - for each (uint32 id in g_PTrustIDList) + for (size_t i = 0; i < g_PTrustIDList.size(); i++) { - QueryTrust(id); + QueryTrust(g_PTrustIDList.at(i)); } } From af7dd5540f9eb3e5fd9fe447e161af60eebd1534 Mon Sep 17 00:00:00 2001 From: Omnione <10185476+Omnione@users.noreply.github.com> Date: Sun, 5 Jan 2020 13:43:21 +0000 Subject: [PATCH 4/7] new iteration and struct for spellid + capitalised names --- sql/mob_pools.sql | 22 +++++++++++----------- src/map/utils/petutils.cpp | 18 +++++++++++++----- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/sql/mob_pools.sql b/sql/mob_pools.sql index dde71162d5b..7691ccd44fa 100644 --- a/sql/mob_pools.sql +++ b/sql/mob_pools.sql @@ -5953,16 +5953,16 @@ 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','Naji',149,0x0000B90B00000000000000000000000000000000,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 (5898,'Kupipi','Kupipi',153,0x0000BA0B00000000000000000000000000000000,3,0,11,230,100,2,0,0,0,0,0,32,0,3,0,1,3,1,0,3); -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,4,1,0,4); -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,5); -INSERT INTO `mob_pools` VALUES (5901,'NanaaMihgo','Nanaa_Mihgo',152,0x0000BD0B00000000000000000000000000000000,6,0,2,190,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,6); -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,7,1,0,7); -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,8); -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,1,9,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,10,1,0,10); +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','naji',149,0x0000B90B00000000000000000000000000000000,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 (5898,'Kupipi','kupipi',153,0x0000BA0B00000000000000000000000000000000,3,0,11,230,100,2,0,0,0,0,0,32,0,3,0,1,3,1,0,3); +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,4,1,0,4); +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,5); +INSERT INTO `mob_pools` VALUES (5901,'Nanaa Mihgo','nanaa_mihgo',152,0x0000BD0B00000000000000000000000000000000,6,0,2,190,100,0,0,0,0,0,0,32,0,3,0,0,0,1,0,6); +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,7,1,0,7); +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,8); +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,1,9,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,10,1,0,10); -- INSERT INTO `mob_pools` VALUES (5906,'zeid', -- INSERT INTO `mob_pools` VALUES (5907,'lion', -- INSERT INTO `mob_pools` VALUES (5908,'tenzen', @@ -6076,7 +6076,7 @@ INSERT INTO `mob_pools` VALUES (5905,'Trion','Trion',145,0x0000C10B0000000000000 -- 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 (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); -- Reserved for future Trust 6020 -- Reserved for future Trust 6021 -- Reserved for future Trust 6022 diff --git a/src/map/utils/petutils.cpp b/src/map/utils/petutils.cpp index 3358a255ec7..a44a2c9d93d 100644 --- a/src/map/utils/petutils.cpp +++ b/src/map/utils/petutils.cpp @@ -129,6 +129,13 @@ struct Pet_t std::vector g_PPetList; +struct TrustSpell_ID +{ + uint16 spellID; +}; + +std::vector g_PTrustIDList; + struct Trust_t { uint16 trustID; @@ -191,7 +198,6 @@ struct Trust_t int16 darkres; }; -std::vector g_PTrustIDList; std::vector g_PTrustList; namespace petutils @@ -326,15 +332,17 @@ namespace petutils { while (Sql_NextRow(SqlHandle) == SQL_SUCCESS) { - uint32 TrustID = (uint16)Sql_GetIntData(SqlHandle, 0); + TrustSpell_ID* trustID = new TrustSpell_ID(); + + trustID->spellID = (uint16)Sql_GetIntData(SqlHandle, 0); - g_PTrustIDList.push_back(TrustID); + g_PTrustIDList.push_back(trustID); } } - for (size_t i = 0; i < g_PTrustIDList.size(); i++) + for (size_t i = 0; i < g_PTrustIDList.size(); ++i) { - QueryTrust(g_PTrustIDList.at(i)); + QueryTrust(g_PTrustIDList.at(i)->spellID); } } From bff41a32c05cbdbdfa9c3b16f50f3bd2f179ca59 Mon Sep 17 00:00:00 2001 From: Omnione <10185476+Omnione@users.noreply.github.com> Date: Sun, 5 Jan 2020 14:28:43 +0000 Subject: [PATCH 5/7] try again for AppVeyor --- src/map/utils/petutils.cpp | 57 +++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/src/map/utils/petutils.cpp b/src/map/utils/petutils.cpp index a44a2c9d93d..417e3fae94a 100644 --- a/src/map/utils/petutils.cpp +++ b/src/map/utils/petutils.cpp @@ -63,25 +63,25 @@ This file is part of DarkStar-server source code. 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; @@ -131,26 +131,26 @@ std::vector g_PPetList; struct TrustSpell_ID { - uint16 spellID; + uint32 spellID; }; std::vector g_PTrustIDList; struct Trust_t { - uint16 trustID; - look_t look; // appearance data - string_t name; // name string - ECOSYSTEM EcoSystem; // ecosystem + uint32 trustID; + look_t look; // appearance data + string_t name; // name string + ECOSYSTEM EcoSystem; // ecosystem uint8 name_prefix; - uint8 size; // размер модели + uint8 size; // размер модели uint16 m_Family; uint8 mJob; uint8 sJob; - float HPscale; // HP boost percentage - float MPscale; // MP boost percentage + float HPscale; // HP boost percentage + float MPscale; // MP boost percentage uint16 cmbDelay; uint8 speed; @@ -334,15 +334,16 @@ namespace petutils { TrustSpell_ID* trustID = new TrustSpell_ID(); - trustID->spellID = (uint16)Sql_GetIntData(SqlHandle, 0); + trustID->spellID = (uint32)Sql_GetIntData(SqlHandle, 0); g_PTrustIDList.push_back(trustID); } } - for (size_t i = 0; i < g_PTrustIDList.size(); ++i) + uint32 index = 0; + for (index; index < g_PTrustIDList.size(); index++) { - QueryTrust(g_PTrustIDList.at(i)->spellID); + QueryTrust(g_PTrustIDList.at(index)->spellID); } } @@ -1932,18 +1933,18 @@ namespace petutils DSP_DEBUG_BREAK_IF(TrustID < 896 || (TrustID > 998 && TrustID < 1003) || TrustID > 1023); CTrustEntity* PTrust = new CTrustEntity(PMaster); + Trust_t* trustData = new Trust_t(); - auto index = 0; - for (size_t i = 0; i < g_PTrustList.size(); i++) + uint32 index = 0; + for (index; index < g_PTrustList.size(); index++) { - if (g_PTrustList.at(i)->trustID == TrustID) + if (g_PTrustList.at(index)->trustID == TrustID) { - index = i; + trustData = g_PTrustList.at(index); + break; } } - Trust_t* trustData = g_PTrustList.at(index); - PTrust->loc = PMaster->loc; PTrust->m_OwnerID.id = PMaster->id; PTrust->m_OwnerID.targid = PMaster->targid; From 409f64a93be59f18f2bad1a5ea0e2fa4e308a97a Mon Sep 17 00:00:00 2001 From: Omnione <10185476+Omnione@users.noreply.github.com> Date: Sun, 5 Jan 2020 22:00:27 +0000 Subject: [PATCH 6/7] Addition of global trust.lua, figured we might need it later on. --- scripts/globals/spells/trust/Shantotto_II.lua | 2 +- scripts/globals/spells/trust/kupipi.lua | 6 ++---- scripts/globals/spells/trust/naji.lua | 6 ++---- scripts/globals/spells/trust/shantotto.lua | 6 ++---- scripts/globals/spells/trust/trion.lua | 6 ++---- scripts/globals/trust.lua | 7 +++++++ src/map/entities/charentity.h | 2 -- src/map/map.cpp | 1 + 8 files changed, 17 insertions(+), 19 deletions(-) create mode 100644 scripts/globals/trust.lua diff --git a/scripts/globals/spells/trust/Shantotto_II.lua b/scripts/globals/spells/trust/Shantotto_II.lua index f6d5643754c..f6ab49f18c2 100644 --- a/scripts/globals/spells/trust/Shantotto_II.lua +++ b/scripts/globals/spells/trust/Shantotto_II.lua @@ -1,7 +1,7 @@ ----------------------------------------- -- Trust: Shantotto II ----------------------------------------- --- require("scripts/globals/trust"); +require("scripts/globals/trust") ----------------------------------------- function onMagicCastingCheck(caster,target,spell) diff --git a/scripts/globals/spells/trust/kupipi.lua b/scripts/globals/spells/trust/kupipi.lua index 7bc12778bfa..9ec714b4ca9 100644 --- a/scripts/globals/spells/trust/kupipi.lua +++ b/scripts/globals/spells/trust/kupipi.lua @@ -1,7 +1,7 @@ ----------------------------------------- --- Spell: Kupipi +-- Trust: Kupipi ----------------------------------------- -require("scripts/globals/trust"); +require("scripts/globals/trust") ----------------------------------------- function onMagicCastingCheck(caster,target,spell) @@ -9,8 +9,6 @@ function onMagicCastingCheck(caster,target,spell) 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(898) return 0 end diff --git a/scripts/globals/spells/trust/naji.lua b/scripts/globals/spells/trust/naji.lua index 0a35f4127c4..cad675aceb2 100644 --- a/scripts/globals/spells/trust/naji.lua +++ b/scripts/globals/spells/trust/naji.lua @@ -1,7 +1,7 @@ ----------------------------------------- --- Spell: Naji +-- Trust: Naji ----------------------------------------- -require("scripts/globals/trust"); +require("scripts/globals/trust") ----------------------------------------- function onMagicCastingCheck(caster,target,spell) @@ -9,8 +9,6 @@ function onMagicCastingCheck(caster,target,spell) 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(897) return 0 end diff --git a/scripts/globals/spells/trust/shantotto.lua b/scripts/globals/spells/trust/shantotto.lua index 6205f0549b1..95de65632c2 100644 --- a/scripts/globals/spells/trust/shantotto.lua +++ b/scripts/globals/spells/trust/shantotto.lua @@ -1,7 +1,7 @@ ----------------------------------------- --- Spell: Shantotto +-- Trust: Shantotto ----------------------------------------- -require("scripts/globals/trust"); +require("scripts/globals/trust") ----------------------------------------- function onMagicCastingCheck(caster,target,spell) @@ -9,8 +9,6 @@ function onMagicCastingCheck(caster,target,spell) 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(896) return 0 end diff --git a/scripts/globals/spells/trust/trion.lua b/scripts/globals/spells/trust/trion.lua index e578db446b0..270962e7dee 100644 --- a/scripts/globals/spells/trust/trion.lua +++ b/scripts/globals/spells/trust/trion.lua @@ -1,7 +1,7 @@ ----------------------------------------- --- Spell: Trion +-- Trust: Trion ----------------------------------------- -require("scripts/globals/trust"); +require("scripts/globals/trust") ----------------------------------------- function onMagicCastingCheck(caster,target,spell) @@ -9,8 +9,6 @@ function onMagicCastingCheck(caster,target,spell) 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(905) return 0 end diff --git a/scripts/globals/trust.lua b/scripts/globals/trust.lua new file mode 100644 index 00000000000..328b163e6d1 --- /dev/null +++ b/scripts/globals/trust.lua @@ -0,0 +1,7 @@ +--------------------------------------------------------- +-- Trust +--------------------------------------------------------- +require("scripts/globals/settings") +require("scripts/globals/status") +require("scripts/globals/magic") +require("scripts/globals/msg") \ No newline at end of file diff --git a/src/map/entities/charentity.h b/src/map/entities/charentity.h index a24aac858a5..539614289d3 100644 --- a/src/map/entities/charentity.h +++ b/src/map/entities/charentity.h @@ -226,8 +226,6 @@ class CCharEntity : public CBattleEntity uint16 m_mkeCurrent; // current mission of A Moogle Kupo d'Etat uint16 m_asaCurrent; // current mission of A Shantotto Ascension - // TODO: half of this array should be stored in char_vars, and not here, because this information is not displayed in the client interface and the server does not perform any operations with them - //currency_t m_currency; // conquest points, imperial standing points etc Teleport_t teleport; // Outposts, Runic Portals, Homepoints, Survival Guides, Maws, etc diff --git a/src/map/map.cpp b/src/map/map.cpp index 0bddb65c747..2daca441297 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -219,6 +219,7 @@ int32 do_init(int32 argc, char** argv) battleutils::LoadMobSkillsList(); battleutils::LoadSkillChainDamageModifiers(); petutils::LoadPetList(); + petutils::LoadTrustList(); mobutils::LoadCustomMods(); ShowStatus("do_init: loading zones"); From d624f76a93a64c79c9be8436e2955a47e6bb6e37 Mon Sep 17 00:00:00 2001 From: Omnione <10185476+Omnione@users.noreply.github.com> Date: Sun, 5 Jan 2020 22:31:11 +0000 Subject: [PATCH 7/7] removed trust.lua requirefrom trust spell scripts, added status require as might need it, removed requires from trust.lua --- scripts/globals/spells/trust/Shantotto_II.lua | 2 +- scripts/globals/spells/trust/kupipi.lua | 2 +- scripts/globals/spells/trust/naji.lua | 2 +- scripts/globals/spells/trust/shantotto.lua | 2 +- scripts/globals/spells/trust/trion.lua | 2 +- scripts/globals/trust.lua | 6 +----- 6 files changed, 6 insertions(+), 10 deletions(-) diff --git a/scripts/globals/spells/trust/Shantotto_II.lua b/scripts/globals/spells/trust/Shantotto_II.lua index f6ab49f18c2..702d2469cbb 100644 --- a/scripts/globals/spells/trust/Shantotto_II.lua +++ b/scripts/globals/spells/trust/Shantotto_II.lua @@ -1,7 +1,7 @@ ----------------------------------------- -- Trust: Shantotto II ----------------------------------------- -require("scripts/globals/trust") +require("scripts/globals/status") ----------------------------------------- function onMagicCastingCheck(caster,target,spell) diff --git a/scripts/globals/spells/trust/kupipi.lua b/scripts/globals/spells/trust/kupipi.lua index 9ec714b4ca9..018f352e7c4 100644 --- a/scripts/globals/spells/trust/kupipi.lua +++ b/scripts/globals/spells/trust/kupipi.lua @@ -1,7 +1,7 @@ ----------------------------------------- -- Trust: Kupipi ----------------------------------------- -require("scripts/globals/trust") +require("scripts/globals/status") ----------------------------------------- function onMagicCastingCheck(caster,target,spell) diff --git a/scripts/globals/spells/trust/naji.lua b/scripts/globals/spells/trust/naji.lua index cad675aceb2..91ef673ca2b 100644 --- a/scripts/globals/spells/trust/naji.lua +++ b/scripts/globals/spells/trust/naji.lua @@ -1,7 +1,7 @@ ----------------------------------------- -- Trust: Naji ----------------------------------------- -require("scripts/globals/trust") +require("scripts/globals/status") ----------------------------------------- function onMagicCastingCheck(caster,target,spell) diff --git a/scripts/globals/spells/trust/shantotto.lua b/scripts/globals/spells/trust/shantotto.lua index 95de65632c2..94cddf603e2 100644 --- a/scripts/globals/spells/trust/shantotto.lua +++ b/scripts/globals/spells/trust/shantotto.lua @@ -1,7 +1,7 @@ ----------------------------------------- -- Trust: Shantotto ----------------------------------------- -require("scripts/globals/trust") +require("scripts/globals/status") ----------------------------------------- function onMagicCastingCheck(caster,target,spell) diff --git a/scripts/globals/spells/trust/trion.lua b/scripts/globals/spells/trust/trion.lua index 270962e7dee..e7d69da7abd 100644 --- a/scripts/globals/spells/trust/trion.lua +++ b/scripts/globals/spells/trust/trion.lua @@ -1,7 +1,7 @@ ----------------------------------------- -- Trust: Trion ----------------------------------------- -require("scripts/globals/trust") +require("scripts/globals/status") ----------------------------------------- function onMagicCastingCheck(caster,target,spell) diff --git a/scripts/globals/trust.lua b/scripts/globals/trust.lua index 328b163e6d1..dd572309aa0 100644 --- a/scripts/globals/trust.lua +++ b/scripts/globals/trust.lua @@ -1,7 +1,3 @@ --------------------------------------------------------- -- Trust ---------------------------------------------------------- -require("scripts/globals/settings") -require("scripts/globals/status") -require("scripts/globals/magic") -require("scripts/globals/msg") \ No newline at end of file +--------------------------------------------------------- \ No newline at end of file