mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
[Feature] Implement OP_CashReward (#2307)
* Implement OP_CashReward Tit opcode needs verifying still, I think it's correct. Added Perl and lua client CashReward functions * Forgot AddMoneyToPP call somehow * Switch QuestManager::givecash to CashReward packet * Fix extra comma
This commit is contained in:
committed by
GitHub
parent
ce74ac9913
commit
139845f971
@@ -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<EQApplicationPacket>(OP_CashReward, sizeof(CashReward_Struct));
|
||||
auto outbuf = reinterpret_cast<CashReward_Struct *>(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;
|
||||
|
||||
@@ -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(); }
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
+2
-16
@@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user