(noudess) Merchants are more descriptive in their rejections

This commit is contained in:
Michael Cook (mackal) 2014-08-30 01:38:49 -04:00
parent ca84040a39
commit 11ed698642
5 changed files with 85 additions and 47 deletions

View File

@ -1,5 +1,8 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 08/30/2014 ==
demonstar55: (noudess) Merchants should be more descriptive of why they don't sell to you
== 08/26/2014 ==
Uleat: Implemented 'Smart' Player Trade transfers. Trades are processed by containers, stackables and then all remaining. QueryServ logs have been updated to match these transactions.
Note: QueryServ logs previously listed 'Items' on the main entry table. This indicated the number of slots affected and not the actual number of items.

View File

@ -7773,29 +7773,67 @@ int32 Client::GetModCharacterFactionLevel(int32 faction_id) {
return Modded;
}
bool Client::HatedByClass(uint32 p_race, uint32 p_class, uint32 p_deity, int32 pFaction)
void Client::MerchantRejectMessage(Mob *merchant, int primaryfaction)
{
int messageid = 0;
int32 tmpFactionValue = 0;
int32 lowestvalue = 0;
FactionMods fmod;
bool Result = false;
int32 tmpFactionValue;
FactionMods fmods;
//First get the NPC's Primary faction
if(pFaction > 0)
{
//Get the faction data from the database
if(database.GetFactionData(&fmods, p_class, p_race, p_deity, pFaction))
{
tmpFactionValue = GetCharacterFactionLevel(pFaction);
tmpFactionValue += GetFactionBonus(pFaction);
tmpFactionValue += GetItemFactionBonus(pFaction);
CalculateFaction(&fmods, tmpFactionValue);
if(fmods.class_mod < fmods.race_mod)
Result = true;
// If a faction is involved, get the data.
if (primaryfaction > 0) {
if (database.GetFactionData(&fmod, GetClass(), GetRace(), GetDeity(), primaryfaction)) {
tmpFactionValue = GetCharacterFactionLevel(primaryfaction);
lowestvalue = std::min(tmpFactionValue, std::min(fmod.class_mod, fmod.race_mod));
}
}
return Result;
// If no primary faction or biggest influence is your faction hit
if (primaryfaction <= 0 || lowestvalue == tmpFactionValue) {
merchant->Say_StringID(MakeRandomInt(WONT_SELL_DEEDS1, WONT_SELL_DEEDS6));
} else if (lowestvalue == fmod.race_mod) { // race biggest
// Non-standard race (ex. illusioned to wolf)
if (GetRace() > PLAYER_RACE_COUNT) {
messageid = MakeRandomInt(1, 3); // these aren't sequential StringIDs :(
switch (messageid) {
case 1:
messageid = WONT_SELL_NONSTDRACE1;
break;
case 2:
messageid = WONT_SELL_NONSTDRACE2;
break;
case 3:
messageid = WONT_SELL_NONSTDRACE3;
break;
default: // w/e should never happen
messageid = WONT_SELL_NONSTDRACE1;
break;
}
merchant->Say_StringID(messageid);
} else { // normal player races
messageid = MakeRandomInt(1, 4);
switch (messageid) {
case 1:
messageid = WONT_SELL_RACE1;
break;
case 2:
messageid = WONT_SELL_RACE2;
break;
case 3:
messageid = WONT_SELL_RACE3;
break;
case 4:
messageid = WONT_SELL_RACE4;
break;
default: // w/e should never happen
messageid = WONT_SELL_RACE1;
break;
}
merchant->Say_StringID(messageid, itoa(GetRace()));
}
} else if (lowestvalue == fmod.class_mod) {
merchant->Say_StringID(MakeRandomInt(WONT_SELL_CLASS1, WONT_SELL_CLASS5), itoa(GetClass()));
}
return;
}
//o--------------------------------------------------------------

View File

@ -594,7 +594,7 @@ public:
FACTION_VALUE GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_race, uint32 p_class, uint32 p_deity, int32 pFaction, Mob* tnpc);
int32 GetCharacterFactionLevel(int32 faction_id);
int32 GetModCharacterFactionLevel(int32 faction_id);
bool HatedByClass(uint32 p_race, uint32 p_class, uint32 p_deity, int32 pFaction);
void MerchantRejectMessage(Mob *merchant, int primaryfaction);
void SendFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalvalue, uint8 temp);
void SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity);

View File

@ -5426,36 +5426,15 @@ void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app)
Message(0,"You cannot use a merchant right now.");
action = 0;
}
int factionlvl = GetFactionLevel(CharacterID(), tmp->CastToNPC()->GetNPCTypeID(), GetRace(), GetClass(), GetDeity(), tmp->CastToNPC()->GetPrimaryFaction(), tmp);
if(factionlvl >= 7)
{
char playerp[16] = "players";
if(HatedByClass(GetRace(), GetClass(), GetDeity(), tmp->CastToNPC()->GetPrimaryFaction()))
strcpy(playerp,GetClassPlural(this));
else
strcpy(playerp,GetRacePlural(this));
int primaryfaction = tmp->CastToNPC()->GetPrimaryFaction();
int factionlvl = GetFactionLevel(CharacterID(), tmp->CastToNPC()->GetNPCTypeID(), GetRace(), GetClass(), GetDeity(), primaryfaction, tmp);
if (factionlvl >= 7) {
MerchantRejectMessage(tmp, primaryfaction);
action = 0;
}
uint8 rand_ = rand() % 4;
switch(rand_){
case 1:
Message(0,"%s says 'It's not enough that you %s have ruined your own lands. Now get lost!'", tmp->GetCleanName(), playerp);
break;
case 2:
Message(0,"%s says 'I have something here that %s use... let me see... it's the EXIT, now get LOST!'", tmp->GetCleanName(), playerp);
break;
case 3:
Message(0,"%s says 'Don't you %s have your own merchants? Whatever, I'm not selling anything to you!'", tmp->GetCleanName(), playerp);
break;
default:
Message(0,"%s says 'I don't like to speak to %s much less sell to them!'", tmp->GetCleanName(), playerp);
break;
}
action = 0;
}
if (tmp->Charmed())
{
action = 0;
}
// 1199 I don't have time for that now. etc
if (!tmp->CastToNPC()->IsMerchantOpen()) {

View File

@ -205,6 +205,24 @@
#define MERCHANT_HANDY_ITEM2 1146 //Greetings, %3. You look like you could use a %4.
#define MERCHANT_HANDY_ITEM3 1147 //Hi there %3, just browsing? Have you seen the %4 I just got in?
#define MERCHANT_HANDY_ITEM4 1148 //Welcome to my shop, %3. You would probably find a %4 handy.
#define WONT_SELL_RACE1 1154 //I don't like to speak to %B3(12) much less sell to them!
#define WONT_SELL_CLASS1 1155 //It's %B3(13) like you that are ruining the continent...get OUT!
#define WONT_SELL_CLASS2 1156 //Isn't there some kind of ordinance against %B3(13) crawling out from under their rocks?
#define WONT_SELL_CLASS3 1157 //%B3(13) like you don't have any place in my shop..now make way for welcome customers.
#define WONT_SELL_CLASS4 1158 //I thought scumbag %B3(13) like you just stole whatever they need. Now GET OUT!
#define WONT_SELL_CLASS5 1159 //I don't have anything to do with %B3(13)..move along.
#define WONT_SELL_NONSTDRACE1 1160 //I don't have anything to do with your little gang..move along.
#define WONT_SELL_RACE2 1161 //It's not enough that you %B3(12) have ruined your own land. Now get lost!
#define WONT_SELL_RACE3 1162 //I have something here that %B3(12) use..let me see...it's the EXIT, now get LOST!
#define WONT_SELL_RACE4 1163 //Don't you %B3(12) have your own merchants? Whatever, I'm not selling anything to you!
#define WONT_SELL_NONSTDRACE2 1164 //Members of your little "club" have ruined things around here..get lost!
#define WONT_SELL_NONSTDRACE3 1165 //I don't have anything to do with your damned club..move along.
#define WONT_SELL_DEEDS1 1166 //Creatures like you make me sick..the things you do..get out of here Pagan!
#define WONT_SELL_DEEDS2 1167 //After all the things you've done..the things you believe in..leave my shop!
#define WONT_SELL_DEEDS3 1168 //Actions speak louder than beliefs, and I despise both your actions and all you believe in.
#define WONT_SELL_DEEDS4 1169 //Get out of here now!
#define WONT_SELL_DEEDS5 1170 //I am tolerant by nature..but infidels like you push me past my limit..get out!
#define WONT_SELL_DEEDS6 1171 //I cannot abide you or your actions against all that is right..BE GONE!
#define AA_POINT 1197 //point
#define AA_POINTS 1215 //points
#define SPELL_FIZZLE_OTHER 1218 //%1's spell fizzles!