mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-29 00:18:18 +00:00
Fixed merchantlist probability.
NPCs were setting a singular chance value and each item was checking based on this value, making the probability field not a random chance per item. This removes the probability field from NPCs, SetMerchantProbability() and GetMerchantProbability() and makes the probability field truly random chance. Special thanks to ChaosSlayerZ for noticing the issue here: http://www.eqemulator.org/forums/showthread.php?t=41731
This commit is contained in:
@@ -2304,54 +2304,6 @@ XS(XS_NPC_GetScore)
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_NPC_SetMerchantProbability);
|
||||
XS(XS_NPC_SetMerchantProbability) {
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: NPC::SetMerchantProbability(THIS, Probability)");
|
||||
{
|
||||
NPC *THIS;
|
||||
uint8 Probability = (uint8)SvIV(ST(1));
|
||||
|
||||
if (sv_derived_from(ST(0), "NPC")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(NPC *,tmp);
|
||||
}
|
||||
else
|
||||
Perl_croak(aTHX_ "THIS is not of type NPC");
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
THIS->SetMerchantProbability(Probability);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_NPC_GetMerchantProbability);
|
||||
XS(XS_NPC_GetMerchantProbability) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: NPC::GetMerchantProbability(THIS)");
|
||||
{
|
||||
NPC *THIS;
|
||||
uint8 RETVAL;
|
||||
dXSTARG;
|
||||
|
||||
if (sv_derived_from(ST(0), "NPC")) {
|
||||
IV tmp = SvIV((SV*)SvRV(ST(0)));
|
||||
THIS = INT2PTR(NPC *,tmp);
|
||||
}
|
||||
else
|
||||
Perl_croak(aTHX_ "THIS is not of type NPC");
|
||||
if(THIS == NULL)
|
||||
Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->GetMerchantProbability();
|
||||
XSprePUSH; PUSHu((UV)RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_NPC_AddMeleeProc);
|
||||
XS(XS_NPC_AddMeleeProc) {
|
||||
dXSARGS;
|
||||
@@ -2677,8 +2629,6 @@ XS(boot_NPC)
|
||||
newXSproto(strcpy(buf, "GetAvoidanceRating"), XS_NPC_GetAvoidanceRating, file, "$");
|
||||
newXSproto(strcpy(buf, "GetSpawnKillCount"), XS_NPC_GetSpawnKillCount, file, "$");
|
||||
newXSproto(strcpy(buf, "GetScore"), XS_NPC_GetScore, file, "$");
|
||||
newXSproto(strcpy(buf, "SetMerchantProbability"), XS_NPC_SetMerchantProbability, file, "$$");
|
||||
newXSproto(strcpy(buf, "GetMerchantProbability"), XS_NPC_GetMerchantProbability, file, "$");
|
||||
newXSproto(strcpy(buf, "AddMeleeProc"), XS_NPC_AddMeleeProc, file, "$$$");
|
||||
newXSproto(strcpy(buf, "AddRangedProc"), XS_NPC_AddRangedProc, file, "$$$");
|
||||
newXSproto(strcpy(buf, "AddDefensiveProc"), XS_NPC_AddDefensiveProc, file, "$$$");
|
||||
|
||||
Reference in New Issue
Block a user