diff --git a/dScripts/CppScripts.cpp b/dScripts/CppScripts.cpp index 24b30dee..6b57b0f9 100644 --- a/dScripts/CppScripts.cpp +++ b/dScripts/CppScripts.cpp @@ -160,7 +160,6 @@ #include "AgSalutingNpcs.h" #include "BossSpiderQueenEnemyServer.h" #include "RockHydrantSmashable.h" -#include "SpecialImaginePowerupSpawner.h" // Misc Scripts #include "ExplodingAsset.h" @@ -295,6 +294,21 @@ // WBL scripts #include "WblGenericZone.h" +// pickups +#include "Special1BronzeCoinSpawner.h" +#include "Special1SilverCoinSpawner.h" +#include "Special10BronzeCoinSpawner.h" +#include "Special25BronzeCoinSpawner.h" +#include "Special10SilverCoinSpawner.h" +#include "Special25SilverCoinSpawner.h" +#include "Special1GoldCoinSpawner.h" +#include "Special10GoldCoinSpawner.h" +#include "Special25GoldCoinSpawner.h" +#include "SpecialImaginePowerupSpawner.h" +#include "SpecialImaginePowerupSpawner2pt.h" +#include "SpecialLifePowerupSpawner.h" +#include "SpecialArmorPowerupSpawner.h" + //Big bad global bc this is a namespace and not a class: InvalidScript* invalidToReturn = new InvalidScript(); std::map m_Scripts; @@ -371,8 +385,6 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr script = new RemoveRentalGear(); else if (scriptName == "scripts\\02_server\\Map\\AG\\L_NPC_NJ_ASSISTANT_SERVER.lua") script = new NpcNjAssistantServer(); - else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_IMAGINE-POWERUP-SPAWNER.lua") - script = new SpecialImaginePowerupSpawner(); else if (scriptName == "scripts\\ai\\AG\\L_AG_SALUTING_NPCS.lua") script = new AgSalutingNpcs(); else if (scriptName == "scripts\\ai\\AG\\L_AG_JET_EFFECT_SERVER.lua") @@ -860,6 +872,34 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr else if (scriptName == "scripts\\zone\\LUPs\\WBL_generic_zone.lua") script = new WblGenericZone(); + // pickups + if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_1_BRONZE-COIN-SPAWNER.lua") + script = new Special1BronzeCoinSpawner(); + else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_1_SILVER-COIN-SPAWNER.lua") + script = new Special1SilverCoinSpawner(); + else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_10_BRONZE-COIN-SPAWNER.lua") + script = new Special10BronzeCoinSpawner(); + else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_25_BRONZE-COIN-SPAWNER.lua") + script = new Special25BronzeCoinSpawner(); + else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_10_SILVER-COIN-SPAWNER.lua") + script = new Special10SilverCoinSpawner(); + else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_25_SILVER-COIN-SPAWNER.lua") + script = new Special25SilverCoinSpawner(); + else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_1_GOLD-COIN-SPAWNER.lua") + script = new Special1GoldCoinSpawner(); + else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_10_GOLD-COIN-SPAWNER.lua") + script = new Special10GoldCoinSpawner(); + else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_25_GOLD-COIN-SPAWNER.lua") + script = new Special25GoldCoinSpawner(); + else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_IMAGINE-POWERUP-SPAWNER.lua") + script = new SpecialImaginePowerupSpawner(); + else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_IMAGINE-POWERUP-SPAWNER-2PT.lua") + script = new SpecialImaginePowerupSpawner2pt(); + else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_LIFE-POWERUP-SPAWNER.lua") + script = new SpecialLifePowerupSpawner(); + else if (scriptName == "scripts\\ai\\SPEC\\L_SPECIAL_ARMOR-POWERUP-SPAWNER.lua") + script = new SpecialArmorPowerupSpawner(); + // handle invalid script reporting if the path is greater than zero and it's not an ignored script // information not really needed for sys admins but is for developers else if (script == invalidToReturn) { diff --git a/dScripts/ai/SPEC/CMakeLists.txt b/dScripts/ai/SPEC/CMakeLists.txt index c4c5b809..d7496e9f 100644 --- a/dScripts/ai/SPEC/CMakeLists.txt +++ b/dScripts/ai/SPEC/CMakeLists.txt @@ -1,3 +1,4 @@ -set(DSCRIPTS_SOURCES_AI_SPEC - "SpecialImaginePowerupSpawner.cpp" +set(DSCRIPTS_SOURCES_AI_SPEC + "SpecialCoinSpawner.cpp" + "SpecialPowerupSpawner.cpp" PARENT_SCOPE) diff --git a/dScripts/ai/SPEC/Special10BronzeCoinSpawner.h b/dScripts/ai/SPEC/Special10BronzeCoinSpawner.h new file mode 100644 index 00000000..bbc4ecbe --- /dev/null +++ b/dScripts/ai/SPEC/Special10BronzeCoinSpawner.h @@ -0,0 +1,13 @@ +#ifndef __SPECIAL10BRONZECOINSPAWNER__H__ +#define __SPECIAL10BRONZECOINSPAWNER__H__ + +#include "SpecialCoinSpawner.h" + +class Special10BronzeCoinSpawner : public SpecialCoinSpawner { +public: + Special10BronzeCoinSpawner() : SpecialCoinSpawner(m_currencyDenomination) {}; +private: + static const uint32_t m_currencyDenomination = 10; +}; + +#endif //!__SPECIAL10BRONZECOINSPAWNER__H__ diff --git a/dScripts/ai/SPEC/Special10GoldCoinSpawner.h b/dScripts/ai/SPEC/Special10GoldCoinSpawner.h new file mode 100644 index 00000000..0f45832b --- /dev/null +++ b/dScripts/ai/SPEC/Special10GoldCoinSpawner.h @@ -0,0 +1,13 @@ +#ifndef __SPECIAL10GOLDCOINSPAWNER__H__ +#define __SPECIAL10GOLDCOINSPAWNER__H__ + +#include "SpecialCoinSpawner.h" + +class Special10GoldCoinSpawner : public SpecialCoinSpawner { +public: + Special10GoldCoinSpawner() : SpecialCoinSpawner(m_currencyDenomination) {}; +private: + static const uint32_t m_currencyDenomination = 100000; +}; + +#endif //!__SPECIAL10GOLDCOINSPAWNER__H__ diff --git a/dScripts/ai/SPEC/Special10SilverCoinSpawner.h b/dScripts/ai/SPEC/Special10SilverCoinSpawner.h new file mode 100644 index 00000000..55aa8c2b --- /dev/null +++ b/dScripts/ai/SPEC/Special10SilverCoinSpawner.h @@ -0,0 +1,13 @@ +#ifndef __SPECIAL10SILVERCOINSPAWNER__H__ +#define __SPECIAL10SILVERCOINSPAWNER__H__ + +#include "SpecialCoinSpawner.h" + +class Special10SilverCoinSpawner : public SpecialCoinSpawner { +public: + Special10SilverCoinSpawner() : SpecialCoinSpawner(m_currencyDenomination) {}; +private: + static const uint32_t m_currencyDenomination = 1000; +}; + +#endif //!__SPECIAL10SILVERCOINSPAWNER__H__ diff --git a/dScripts/ai/SPEC/Special1BronzeCoinSpawner.h b/dScripts/ai/SPEC/Special1BronzeCoinSpawner.h new file mode 100644 index 00000000..1577b95c --- /dev/null +++ b/dScripts/ai/SPEC/Special1BronzeCoinSpawner.h @@ -0,0 +1,15 @@ +#ifndef __SPECIAL1BRONZECOINSPAWNER__H__ +#define __SPECIAL1BRONZECOINSPAWNER__H__ + +#include "SpecialCoinSpawner.h" + +class Special1BronzeCoinSpawner : public SpecialCoinSpawner { +public: + Special1BronzeCoinSpawner() : SpecialCoinSpawner(m_currencyDenomination) {}; +private: + static const uint32_t m_currencyDenomination = 1; +}; + +#endif //!__SPECIAL1BRONZECOINSPAWNER__H__ + + diff --git a/dScripts/ai/SPEC/Special1GoldCoinSpawner.h b/dScripts/ai/SPEC/Special1GoldCoinSpawner.h new file mode 100644 index 00000000..a1fd2737 --- /dev/null +++ b/dScripts/ai/SPEC/Special1GoldCoinSpawner.h @@ -0,0 +1,13 @@ +#ifndef __SPECIAL1GOLDCOINSPAWNER__H__ +#define __SPECIAL1GOLDCOINSPAWNER__H__ + +#include "SpecialCoinSpawner.h" + +class Special1GoldCoinSpawner : public SpecialCoinSpawner { +public: + Special1GoldCoinSpawner() : SpecialCoinSpawner(m_currencyDenomination) {}; +private: + static const uint32_t m_currencyDenomination = 10000; +}; + +#endif //!__SPECIAL1GOLDCOINSPAWNER__H__ diff --git a/dScripts/ai/SPEC/Special1SilverCoinSpawner.h b/dScripts/ai/SPEC/Special1SilverCoinSpawner.h new file mode 100644 index 00000000..558f9a63 --- /dev/null +++ b/dScripts/ai/SPEC/Special1SilverCoinSpawner.h @@ -0,0 +1,13 @@ +#ifndef __SPECIAL1SILVERCOINSPAWNER__H__ +#define __SPECIAL1SILVERCOINSPAWNER__H__ + +#include "SpecialCoinSpawner.h" + +class Special1SilverCoinSpawner : public SpecialCoinSpawner { +public: + Special1SilverCoinSpawner() : SpecialCoinSpawner(m_currencyDenomination) {}; +private: + static const uint32_t m_currencyDenomination = 100; +}; + +#endif //!__SPECIAL1SILVERCOINSPAWNER__H__ diff --git a/dScripts/ai/SPEC/Special25BronzeCoinSpawner.h b/dScripts/ai/SPEC/Special25BronzeCoinSpawner.h new file mode 100644 index 00000000..6be32fb1 --- /dev/null +++ b/dScripts/ai/SPEC/Special25BronzeCoinSpawner.h @@ -0,0 +1,13 @@ +#ifndef __SPECIAL25BRONZECOINSPAWNER__H__ +#define __SPECIAL25BRONZECOINSPAWNER__H__ + +#include "SpecialCoinSpawner.h" + +class Special25BronzeCoinSpawner : public SpecialCoinSpawner { +public: + Special25BronzeCoinSpawner() : SpecialCoinSpawner(m_currencyDenomination) {}; +private: + static const uint32_t m_currencyDenomination = 25; +}; + +#endif //!__SPECIAL25BRONZECOINSPAWNER__H__ diff --git a/dScripts/ai/SPEC/Special25GoldCoinSpawner.h b/dScripts/ai/SPEC/Special25GoldCoinSpawner.h new file mode 100644 index 00000000..30eb8688 --- /dev/null +++ b/dScripts/ai/SPEC/Special25GoldCoinSpawner.h @@ -0,0 +1,13 @@ +#ifndef __SPECIAL25GOLDCOINSPAWNER__H__ +#define __SPECIAL25GOLDCOINSPAWNER__H__ + +#include "SpecialCoinSpawner.h" + +class Special25GoldCoinSpawner : public SpecialCoinSpawner { +public: + Special25GoldCoinSpawner() : SpecialCoinSpawner(m_currencyDenomination) {}; +private: + static const uint32_t m_currencyDenomination = 250000; +}; + +#endif //!__SPECIAL25GOLDCOINSPAWNER__H__ diff --git a/dScripts/ai/SPEC/Special25SilverCoinSpawner.h b/dScripts/ai/SPEC/Special25SilverCoinSpawner.h new file mode 100644 index 00000000..c07ae2d6 --- /dev/null +++ b/dScripts/ai/SPEC/Special25SilverCoinSpawner.h @@ -0,0 +1,13 @@ +#ifndef __SPECIAL25SILVERCOINSPAWNER__H__ +#define __SPECIAL25SILVERCOINSPAWNER__H__ + +#include "SpecialCoinSpawner.h" + +class Special25SilverCoinSpawner : public SpecialCoinSpawner { +public: + Special25SilverCoinSpawner() : SpecialCoinSpawner(m_currencyDenomination) {}; +private: + static const uint32_t m_currencyDenomination = 2500; +}; + +#endif //!__SPECIAL25SILVERCOINSPAWNER__H__ diff --git a/dScripts/ai/SPEC/SpecialArmorPowerupSpawner.h b/dScripts/ai/SPEC/SpecialArmorPowerupSpawner.h new file mode 100644 index 00000000..d6599c7f --- /dev/null +++ b/dScripts/ai/SPEC/SpecialArmorPowerupSpawner.h @@ -0,0 +1,14 @@ +#ifndef __SPECIALARMORPOWERUPSPAWNER__H__ +#define __SPECIALARMORPOWERUPSPAWNER__H__ + +#include "SpecialPowerupSpawner.h" + +class SpecialArmorPowerupSpawner : public SpecialPowerupSpawner { +public: + SpecialArmorPowerupSpawner() : SpecialPowerupSpawner(m_SkillId) {}; +private: + uint32_t m_SkillId = 80; +}; + + +#endif //!__SPECIALARMORPOWERUPSPAWNER__H__ diff --git a/dScripts/ai/SPEC/SpecialCoinSpawner.cpp b/dScripts/ai/SPEC/SpecialCoinSpawner.cpp new file mode 100644 index 00000000..447230de --- /dev/null +++ b/dScripts/ai/SPEC/SpecialCoinSpawner.cpp @@ -0,0 +1,16 @@ +#include "SpecialCoinSpawner.h" +#include "CharacterComponent.h" + +void SpecialCoinSpawner::OnStartup(Entity* self) { + self->SetProximityRadius(1.5f, "powerupEnter"); +} + +void SpecialCoinSpawner::OnProximityUpdate(Entity* self, Entity* entering, const std::string name, const std::string status) { + if (name != "powerupEnter" && status != "ENTER") return; + if (!entering->IsPlayer()) return; + auto character = entering->GetCharacter(); + if (!character) return; + GameMessages::SendPlayFXEffect(self, -1, u"pickup", "", LWOOBJID_EMPTY, 1, 1, true); + character->SetCoins(character->GetCoins() + this->m_currencyDenomination, eLootSourceType::LOOT_SOURCE_CURRENCY); + self->Smash(entering->GetObjectID(), eKillType::SILENT); +} diff --git a/dScripts/ai/SPEC/SpecialCoinSpawner.h b/dScripts/ai/SPEC/SpecialCoinSpawner.h new file mode 100644 index 00000000..6d73f6f0 --- /dev/null +++ b/dScripts/ai/SPEC/SpecialCoinSpawner.h @@ -0,0 +1,13 @@ +#pragma once +#include "CppScripts.h" + +class SpecialCoinSpawner : public CppScripts::Script { +public: + SpecialCoinSpawner(uint32_t CurrencyDenomination) { + m_currencyDenomination = CurrencyDenomination; + }; + void OnStartup(Entity* self) override; + void OnProximityUpdate(Entity* self, Entity* entering, const std::string name, const std::string status) override; +private: + int32_t m_currencyDenomination = 0; +}; diff --git a/dScripts/ai/SPEC/SpecialImaginePowerupSpawner.h b/dScripts/ai/SPEC/SpecialImaginePowerupSpawner.h index eb628951..ec13e253 100644 --- a/dScripts/ai/SPEC/SpecialImaginePowerupSpawner.h +++ b/dScripts/ai/SPEC/SpecialImaginePowerupSpawner.h @@ -1,9 +1,13 @@ -#pragma once -#include "CppScripts.h" +#ifndef __SPECIALIMAGINEPOWERUPSPAWNER__H__ +#define __SPECIALIMAGINEPOWERUPSPAWNER__H__ -class SpecialImaginePowerupSpawner final : public CppScripts::Script -{ +#include "SpecialPowerupSpawner.h" + +class SpecialImaginePowerupSpawner : public SpecialPowerupSpawner { public: - void OnStartup(Entity* self) override; - void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override; + SpecialImaginePowerupSpawner() : SpecialPowerupSpawner(m_SkillId) {}; +private: + uint32_t m_SkillId = 13; }; + +#endif //!__SPECIALIMAGINEPOWERUPSPAWNER__H__ diff --git a/dScripts/ai/SPEC/SpecialImaginePowerupSpawner2pt.h b/dScripts/ai/SPEC/SpecialImaginePowerupSpawner2pt.h new file mode 100644 index 00000000..d7e4428c --- /dev/null +++ b/dScripts/ai/SPEC/SpecialImaginePowerupSpawner2pt.h @@ -0,0 +1,13 @@ +#ifndef __SPECIALIMAGINEPOWERUPSPAWNER2PT__H__ +#define __SPECIALIMAGINEPOWERUPSPAWNER2PT__H__ + +#include "SpecialPowerupSpawner.h" + +class SpecialImaginePowerupSpawner2pt : public SpecialPowerupSpawner { +public: + SpecialImaginePowerupSpawner2pt() : SpecialPowerupSpawner(m_SkillId) {}; +private: + uint32_t m_SkillId = 129; +}; + +#endif //!__SPECIALIMAGINEPOWERUPSPAWNER2PT__H__ diff --git a/dScripts/ai/SPEC/SpecialLifePowerupSpawner.h b/dScripts/ai/SPEC/SpecialLifePowerupSpawner.h new file mode 100644 index 00000000..2b5ce687 --- /dev/null +++ b/dScripts/ai/SPEC/SpecialLifePowerupSpawner.h @@ -0,0 +1,13 @@ +#ifndef __SPECIALLIFEPOWERUPSPAWNER__H__ +#define __SPECIALLIFEPOWERUPSPAWNER__H__ + +#include "SpecialPowerupSpawner.h" + +class SpecialLifePowerupSpawner : public SpecialPowerupSpawner { +public: + SpecialLifePowerupSpawner() : SpecialPowerupSpawner(m_SkillId) {}; +private: + uint32_t m_SkillId = 5; +}; + +#endif //!__SPECIALLIFEPOWERUPSPAWNER__H__ diff --git a/dScripts/ai/SPEC/SpecialImaginePowerupSpawner.cpp b/dScripts/ai/SPEC/SpecialPowerupSpawner.cpp similarity index 53% rename from dScripts/ai/SPEC/SpecialImaginePowerupSpawner.cpp rename to dScripts/ai/SPEC/SpecialPowerupSpawner.cpp index 43ae9e89..43834943 100644 --- a/dScripts/ai/SPEC/SpecialImaginePowerupSpawner.cpp +++ b/dScripts/ai/SPEC/SpecialPowerupSpawner.cpp @@ -2,7 +2,6 @@ #include "GameMessages.h" #include "SkillComponent.h" -#include "DestroyableComponent.h" #include "EntityManager.h" #include "eReplicaComponentType.h" @@ -12,37 +11,16 @@ void SpecialImaginePowerupSpawner::OnStartup(Entity* self) { } void SpecialImaginePowerupSpawner::OnProximityUpdate(Entity* self, Entity* entering, const std::string name, const std::string status) { - if (name != "powerupEnter" && status != "ENTER") { - return; - } - - if (entering->GetLOT() != 1) { - return; - } - - if (self->GetVar(u"bIsDead")) { - return; - } + if (name != "powerupEnter" && status != "ENTER") return; + if (!entering->IsPlayer()) return; + if (self->GetVar(u"bIsDead")) return; GameMessages::SendPlayFXEffect(self, -1, u"pickup", "", LWOOBJID_EMPTY, 1, 1, true); SkillComponent* skillComponent; - if (!self->TryGetComponent(eReplicaComponentType::SKILL, skillComponent)) { - return; - } - - const auto source = entering->GetObjectID(); - - skillComponent->CalculateBehavior(13, 20, source); - - DestroyableComponent* destroyableComponent; - if (!self->TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent)) { - return; - } + if (!self->TryGetComponent(eReplicaComponentType::SKILL, skillComponent)) return; + skillComponent->CastSkill(13, entering->GetObjectID()); self->SetVar(u"bIsDead", true); - - self->AddCallbackTimer(1.0f, [self]() { - EntityManager::Instance()->ScheduleForKill(self); - }); + self->Smash(entering->GetObjectID(), eKillType::SILENT); } diff --git a/dScripts/ai/SPEC/SpecialPowerupSpawner.h b/dScripts/ai/SPEC/SpecialPowerupSpawner.h new file mode 100644 index 00000000..b27e9789 --- /dev/null +++ b/dScripts/ai/SPEC/SpecialPowerupSpawner.h @@ -0,0 +1,13 @@ +#pragma once +#include "CppScripts.h" + +class SpecialPowerupSpawner : public CppScripts::Script { +public: + SpecialPowerupSpawner(uint32_t skillId) { + m_SkillId = skillId; + }; + void OnStartup(Entity* self) override; + void OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) override; +private: + uint32_t m_SkillId = 0; +};