mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-06 13:33:52 +00:00
QuestReward now accepts a single bool (true or false) for faction instead of 2 int32s. If true, it will pull the faction hits assigned to the NPC in the DB (reversed, of course) and give you that as part of the reward.
Example usage: e.other:QuestReward(e.self,copper,silver,gold,platinum,itemid,exp,faction) (Credit to Cavedude)
This commit is contained in:
parent
d1fbd086d7
commit
6fad93aeee
@ -7588,7 +7588,7 @@ FACTION_VALUE Client::GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_ra
|
||||
}
|
||||
|
||||
//Sets the characters faction standing with the specified NPC.
|
||||
void Client::SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity)
|
||||
void Client::SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity, bool quest)
|
||||
{
|
||||
int32 faction_id[MAX_NPC_FACTIONS] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
int32 npc_value[MAX_NPC_FACTIONS] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
@ -7615,6 +7615,15 @@ void Client::SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, ui
|
||||
database.GetFactionData(&fm, GetClass(), GetRace(), GetDeity(),
|
||||
faction_id[i]);
|
||||
|
||||
if (quest)
|
||||
{
|
||||
//The ole switcheroo
|
||||
if (npc_value[i] > 0)
|
||||
npc_value[i] = -abs(npc_value[i]);
|
||||
else if (npc_value[i] < 0)
|
||||
npc_value[i] = abs(npc_value[i]);
|
||||
}
|
||||
|
||||
// Adjust the amount you can go up or down so the resulting range
|
||||
// is PERSONAL_MAX - PERSONAL_MIN
|
||||
//
|
||||
@ -8585,7 +8594,7 @@ bool Client::TextLink::GenerateLinkBody(std::string& textLinkBody, const TextLin
|
||||
return true;
|
||||
}
|
||||
|
||||
void Client::QuestReward(Mob* target, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 itemid, uint32 exp, uint32 factionid, int32 faction) {
|
||||
void Client::QuestReward(Mob* target, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 itemid, uint32 exp, bool faction) {
|
||||
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_Sound, sizeof(QuestReward_Struct));
|
||||
memset(outapp->pBuffer, 0, sizeof(outapp->pBuffer));
|
||||
@ -8599,8 +8608,6 @@ void Client::QuestReward(Mob* target, uint32 copper, uint32 silver, uint32 gold,
|
||||
qr->platinum = platinum;
|
||||
qr->item_id = itemid;
|
||||
qr->exp_reward = exp;
|
||||
qr->faction = factionid;
|
||||
qr->faction_mod = faction;
|
||||
|
||||
if (copper > 0 || silver > 0 || gold > 0 || platinum > 0)
|
||||
AddMoneyToPP(copper, silver, gold, platinum, false);
|
||||
@ -8608,12 +8615,20 @@ void Client::QuestReward(Mob* target, uint32 copper, uint32 silver, uint32 gold,
|
||||
if (itemid > 0)
|
||||
SummonItem(itemid, 0, 0, 0, 0, 0, 0, false, MainPowerSource);
|
||||
|
||||
if (faction)
|
||||
{
|
||||
if (target->IsNPC())
|
||||
{
|
||||
int32 nfl_id = target->CastToNPC()->GetNPCFactionID();
|
||||
SetFactionLevel(CharacterID(), nfl_id, GetBaseClass(), GetBaseRace(), GetDeity(), true);
|
||||
qr->faction = target->CastToNPC()->GetPrimaryFaction();
|
||||
qr->faction_mod = 1; // Too lazy to get real value, not sure if this is even used by client anyhow.
|
||||
}
|
||||
}
|
||||
|
||||
if (exp > 0)
|
||||
AddEXP(exp);
|
||||
|
||||
if (factionid > 0)
|
||||
SetFactionLevel2(CharacterID(), factionid, GetClass(), GetBaseRace(), GetDeity(), faction, 0);
|
||||
|
||||
QueuePacket(outapp, false, Client::CLIENT_CONNECTED);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
@ -611,7 +611,7 @@ public:
|
||||
void SendFactionMessage(int32 tmpvalue, int32 faction_id, int32 faction_before_hit, int32 totalvalue, uint8 temp, int32 this_faction_min, int32 this_faction_max);
|
||||
|
||||
void UpdatePersonalFaction(int32 char_id, int32 npc_value, int32 faction_id, int32 *current_value, int32 temp, int32 this_faction_min, int32 this_faction_max);
|
||||
void SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity);
|
||||
void SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity, bool quest = false);
|
||||
void SetFactionLevel2(uint32 char_id, int32 faction_id, uint8 char_class, uint8 char_race, uint8 char_deity, int32 value, uint8 temp);
|
||||
int32 GetRawItemAC();
|
||||
uint16 GetCombinedAC_TEST();
|
||||
@ -1254,7 +1254,7 @@ public:
|
||||
virtual int32 Tune_GetMeleeMitDmg(Mob* GM, Mob *attacker, int32 damage, int32 minhit, float mit_rating, float atk_rating);
|
||||
int32 GetMeleeDamage(Mob* other, bool GetMinDamage = false);
|
||||
|
||||
void QuestReward(Mob* target, uint32 copper = 0, uint32 silver = 0, uint32 gold = 0, uint32 platinum = 0, uint32 itemid = 0, uint32 exp = 0, uint32 factionid = 0, int32 faction = 0);
|
||||
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);
|
||||
protected:
|
||||
friend class Mob;
|
||||
void CalcItemBonuses(StatBonuses* newbon);
|
||||
|
||||
@ -1290,9 +1290,9 @@ void Lua_Client::QuestReward(Lua_Mob target, uint32 copper, uint32 silver, uint3
|
||||
self->QuestReward(target, copper, silver, gold, platinum, itemid, exp);
|
||||
}
|
||||
|
||||
void Lua_Client::QuestReward(Lua_Mob target, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 itemid, uint32 exp, uint32 factionid, int32 faction) {
|
||||
void Lua_Client::QuestReward(Lua_Mob target, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 itemid, uint32 exp, bool faction) {
|
||||
Lua_Safe_Call_Void();
|
||||
self->QuestReward(target, copper, silver, gold, platinum, itemid, exp, factionid, faction);
|
||||
self->QuestReward(target, copper, silver, gold, platinum, itemid, exp, faction);
|
||||
}
|
||||
|
||||
luabind::scope lua_register_client() {
|
||||
@ -1552,7 +1552,7 @@ luabind::scope lua_register_client() {
|
||||
.def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32))&Lua_Client::QuestReward)
|
||||
.def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32, uint32))&Lua_Client::QuestReward)
|
||||
.def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32, uint32, uint32))&Lua_Client::QuestReward)
|
||||
.def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32, uint32, uint32, uint32, int32))&Lua_Client::QuestReward);
|
||||
.def("QuestReward", (void(Lua_Client::*)(Lua_Mob, uint32, uint32, uint32, uint32, uint32, uint32, bool))&Lua_Client::QuestReward);
|
||||
}
|
||||
|
||||
luabind::scope lua_register_inventory_where() {
|
||||
|
||||
@ -285,7 +285,7 @@ public:
|
||||
void QuestReward(Lua_Mob target, uint32 copper, uint32 silver, uint32 gold, uint32 platinum);
|
||||
void QuestReward(Lua_Mob target, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 itemid);
|
||||
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, uint32 factionid, int32 faction);
|
||||
void QuestReward(Lua_Mob target, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, uint32 itemid, uint32 exp, bool faction);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -6193,7 +6193,7 @@ XS(XS_Client_QuestReward)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items < 1 || items > 9)
|
||||
Perl_croak(aTHX_ "Usage: Client::QuestReward(THIS, mob, copper, silver, gold, platinum, itemid, exp, factionid, faction)");
|
||||
Perl_croak(aTHX_ "Usage: Client::QuestReward(THIS, mob, copper, silver, gold, platinum, itemid, exp, faction)");
|
||||
{
|
||||
Client* THIS;
|
||||
Mob * mob = nullptr;
|
||||
@ -6203,8 +6203,7 @@ XS(XS_Client_QuestReward)
|
||||
int32 platinum = 0;
|
||||
int32 itemid = 0;
|
||||
int32 exp = 0;
|
||||
int32 factionid = 0;
|
||||
int32 faction = 0;
|
||||
bool faction = false;
|
||||
|
||||
if (sv_derived_from(ST(0), "THIS")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
@ -6231,10 +6230,9 @@ XS(XS_Client_QuestReward)
|
||||
if (items > 5) { platinum = (int32)SvIV(ST(5)); }
|
||||
if (items > 6) { itemid = (int32)SvIV(ST(6)); }
|
||||
if (items > 7) { exp = (int32)SvIV(ST(7)); }
|
||||
if (items > 8) { factionid = (int32)SvIV(ST(8)); }
|
||||
if (items > 9) { faction = (int32)SvIV(ST(9)); }
|
||||
if (items > 8) { faction = (bool)SvIV(ST(8)); }
|
||||
|
||||
THIS->QuestReward(mob, copper, silver, gold, platinum, itemid, exp, factionid, faction);
|
||||
THIS->QuestReward(mob, copper, silver, gold, platinum, itemid, exp, faction);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
@ -6483,7 +6481,7 @@ XS(boot_Client)
|
||||
newXSproto(strcpy(buf, "GetTargetRingX"), XS_Client_GetTargetRingX, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetTargetRingY"), XS_Client_GetTargetRingY, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetTargetRingZ"), XS_Client_GetTargetRingZ, file, "$$");
|
||||
newXSproto(strcpy(buf, "QuestReward"), XS_Client_QuestReward, file, "$$;$$$$$$$$");
|
||||
newXSproto(strcpy(buf, "QuestReward"), XS_Client_QuestReward, file, "$$;$$$$$$$");
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user