diff --git a/common/emu_oplist.h b/common/emu_oplist.h index 4aef3b27f..b5e56422f 100644 --- a/common/emu_oplist.h +++ b/common/emu_oplist.h @@ -71,6 +71,7 @@ N(OP_Camp), N(OP_CancelSneakHide), N(OP_CancelTask), N(OP_CancelTrade), +N(OP_CashReward), N(OP_CastSpell), N(OP_ChangeSize), N(OP_ChannelMessage), diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 47bfabb23..55ff0d2c3 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -2192,6 +2192,14 @@ struct QuestReward_Struct /*068*/ }; +struct CashReward_Struct +{ + /*000*/ uint32 copper; + /*004*/ uint32 silver; + /*008*/ uint32 gold; + /*012*/ uint32 platinum; +}; + // Size: 8 struct Camera_Struct { diff --git a/utils/patches/patch_RoF.conf b/utils/patches/patch_RoF.conf index 8065ca53c..f961afadf 100644 --- a/utils/patches/patch_RoF.conf +++ b/utils/patches/patch_RoF.conf @@ -311,6 +311,7 @@ OP_SendFindableNPCs=0x34c3 OP_FindPersonRequest=0x2f3b OP_FindPersonReply=0x44f7 OP_Sound=0x3cec +OP_CashReward=0x17a5 OP_PetBuffWindow=0x7197 OP_LevelAppearance=0x7c4d OP_Translocate=0x6f01 diff --git a/utils/patches/patch_RoF2.conf b/utils/patches/patch_RoF2.conf index 8f7d63b39..08e02b93c 100644 --- a/utils/patches/patch_RoF2.conf +++ b/utils/patches/patch_RoF2.conf @@ -312,6 +312,7 @@ OP_SendFindableNPCs=0x4613 OP_FindPersonRequest=0x5cea OP_FindPersonReply=0x7e58 OP_Sound=0x1a30 +OP_CashReward=0x5f7a OP_PetBuffWindow=0x5882 OP_LevelAppearance=0x3bc9 OP_Translocate=0x6580 diff --git a/utils/patches/patch_SoD.conf b/utils/patches/patch_SoD.conf index 5cb5d2a30..e0c4752d0 100644 --- a/utils/patches/patch_SoD.conf +++ b/utils/patches/patch_SoD.conf @@ -307,6 +307,7 @@ OP_SendFindableNPCs=0x5360 OP_FindPersonRequest=0x3168 # C OP_FindPersonReply=0x1ac8 # C OP_Sound=0x303e # C +OP_CashReward=0x3703 OP_PetBuffWindow=0x2dd3 # C OP_LevelAppearance=0x6dc3 # C OP_Translocate=0x2042 # C diff --git a/utils/patches/patch_SoF.conf b/utils/patches/patch_SoF.conf index 874c91cc3..a7640ec08 100644 --- a/utils/patches/patch_SoF.conf +++ b/utils/patches/patch_SoF.conf @@ -299,6 +299,7 @@ OP_Stun=0x55BF #Derision 2009 OP_FindPersonRequest=0x07F0 #Derision 2009 OP_FindPersonReply=0x7770 #Derision 2009 OP_Sound=0x2B02 #Derision 2009 +OP_CashReward=0x5e80 OP_PetBuffWindow=0x124A #Derision 2009 OP_LevelAppearance=0x3EC8 #Derision 2009 OP_Translocate=0x1F0F #Derision 2009 diff --git a/utils/patches/patch_Titanium.conf b/utils/patches/patch_Titanium.conf index 28074dcf9..e1f017c8a 100644 --- a/utils/patches/patch_Titanium.conf +++ b/utils/patches/patch_Titanium.conf @@ -437,6 +437,7 @@ OP_FindPersonReply=0x5711 # ShowEQ 10/27/05 OP_ForceFindPerson=0x0000 OP_LoginComplete=0x0000 OP_Sound=0x541e +OP_CashReward=0x4c8c #maybe #OP_Zone_MissingName01=0x0000 #remove on recompile OP_MobRename=0x0498 # ShowEQ 10/27/05 OP_BankerChange=0x6a5b diff --git a/utils/patches/patch_UF.conf b/utils/patches/patch_UF.conf index 8c95cbe67..9e78cf140 100644 --- a/utils/patches/patch_UF.conf +++ b/utils/patches/patch_UF.conf @@ -316,6 +316,7 @@ OP_SendFindableNPCs=0x6193 # C OP_FindPersonRequest=0x1e04 # C OP_FindPersonReply=0x7cae # C OP_Sound=0x737a # C +OP_CashReward=0x039d OP_PetBuffWindow=0x7b87 # C OP_LevelAppearance=0x1bd4 # C OP_Translocate=0x3d9c # C diff --git a/zone/client.cpp b/zone/client.cpp index 16fcc0365..1c4e1bb21 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -8798,6 +8798,20 @@ void Client::QuestReward(Mob* target, const QuestReward_Struct &reward, bool fac safe_delete(outapp); } +void Client::CashReward(uint32 copper, uint32 silver, uint32 gold, uint32 platinum) +{ + auto outapp = std::make_unique(OP_CashReward, sizeof(CashReward_Struct)); + auto outbuf = reinterpret_cast(outapp->pBuffer); + outbuf->copper = copper; + outbuf->silver = silver; + outbuf->gold = gold; + outbuf->platinum = platinum; + + AddMoneyToPP(copper, silver, gold, platinum); + + QueuePacket(outapp.get()); +} + void Client::SendHPUpdateMarquee(){ if (!this || !IsClient() || !current_hp || !max_hp) return; diff --git a/zone/client.h b/zone/client.h index b73ae9a02..bb7bbd54b 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1632,6 +1632,7 @@ public: void QuestReward(Mob* target, uint32 copper = 0, uint32 silver = 0, uint32 gold = 0, uint32 platinum = 0, uint32 itemid = 0, uint32 exp = 0, bool faction = false); void QuestReward(Mob* target, const QuestReward_Struct &reward, bool faction); // TODO: Fix faction processing + void CashReward(uint32 copper, uint32 silver, uint32 gold, uint32 platinum); void ResetHPUpdateTimer() { hpupdate_timer.Start(); } diff --git a/zone/lua_client.cpp b/zone/lua_client.cpp index 69d5c2c25..46cceb8c4 100644 --- a/zone/lua_client.cpp +++ b/zone/lua_client.cpp @@ -1765,6 +1765,11 @@ void Lua_Client::QuestReward(Lua_Mob target, luabind::adl::object reward) { self->QuestReward(target, quest_reward, faction); } +void Lua_Client::CashReward(uint32 copper, uint32 silver, uint32 gold, uint32 platinum) { + Lua_Safe_Call_Void(); + self->CashReward(copper, silver, gold, platinum); +} + bool Lua_Client::IsDead() { Lua_Safe_Call_Bool(); return self->IsDead(); @@ -2568,6 +2573,7 @@ luabind::scope lua_register_client() { .def("CalcCurrentWeight", &Lua_Client::CalcCurrentWeight) .def("CalcPriceMod", (float(Lua_Client::*)(Lua_Mob,bool))&Lua_Client::CalcPriceMod) .def("CanHaveSkill", (bool(Lua_Client::*)(int))&Lua_Client::CanHaveSkill) + .def("CashReward", &Lua_Client::CashReward) .def("ChangeLastName", (void(Lua_Client::*)(std::string))&Lua_Client::ChangeLastName) .def("CharacterID", (uint32(Lua_Client::*)(void))&Lua_Client::CharacterID) .def("CheckIncreaseSkill", (void(Lua_Client::*)(int,Lua_Mob))&Lua_Client::CheckIncreaseSkill) diff --git a/zone/lua_client.h b/zone/lua_client.h index 86a1ea552..2a47da7fc 100644 --- a/zone/lua_client.h +++ b/zone/lua_client.h @@ -382,6 +382,7 @@ public: void QuestReward(Lua_Mob target, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 itemid, uint32 exp); void QuestReward(Lua_Mob target, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 itemid, uint32 exp, bool faction); void QuestReward(Lua_Mob target, luabind::adl::object reward); + void CashReward(uint32 copper, uint32 silver, uint32 gold, uint32 platinum); bool IsDead(); int CalcCurrentWeight(); int CalcATK(); diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 62435e248..1775b2dc9 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -1653,6 +1653,11 @@ void Perl_Client_QuestReward(Client* self, Mob* mob, uint32 copper, uint32 silve self->QuestReward(mob, copper, silver, gold, platinum, item_id, exp, faction); } +void Perl_Client_CashReward(Client* self, uint32 copper, uint32 silver, uint32 gold, uint32 platinum) +{ + self->CashReward(copper, silver, gold, platinum); +} + uint32_t Perl_Client_GetMoney(Client* self, int8 type, int8 subtype) { return self->GetMoney(type, subtype); @@ -2416,6 +2421,7 @@ void perl_register_client() package.add("CalcPriceMod", (float(*)(Client*, Mob*))&Perl_Client_CalcPriceMod); package.add("CalcPriceMod", (float(*)(Client*, Mob*, bool))&Perl_Client_CalcPriceMod); package.add("CanHaveSkill", &Perl_Client_CanHaveSkill); + package.add("CashReward", &Perl_Client_CashReward); package.add("ChangeLastName", &Perl_Client_ChangeLastName); package.add("CharacterID", &Perl_Client_CharacterID); package.add("CheckIncreaseSkill", (bool(*)(Client*, int))&Perl_Client_CheckIncreaseSkill); diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 149192cff..d6e0f417a 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -1183,26 +1183,12 @@ void QuestManager::givecash(uint32 copper, uint32 silver, uint32 gold, uint32 pl platinum ) ) { - initiator->AddMoneyToPP( + initiator->CashReward( copper, silver, gold, - platinum, - true + platinum ); - - if (initiator) { - initiator->MessageString( - Chat::MoneySplit, - YOU_RECEIVE, - Strings::Money( - platinum, - gold, - silver, - copper - ).c_str() - ); - } } }