From cc2a60feb226a1c29eb3b2d7bdebab95268e0c5b Mon Sep 17 00:00:00 2001 From: regneq Date: Mon, 11 May 2015 16:34:46 -0700 Subject: [PATCH] * change the kill faction hits display before the xp message not after. * removed the double level gain messages to display once either the level gained or the level. * implement the message "You will now lose experience when you die" and "Your items will no longer stay with you..." when reach a certain level already sets in the rule table. --- zone/attack.cpp | 8 ++++---- zone/exp.cpp | 28 +++++++++++++++++++--------- zone/string_ids.h | 2 ++ 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index 256eefe0f..49b5df187 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -2144,6 +2144,10 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack if(give_exp && give_exp->IsClient()) give_exp_client = give_exp->CastToClient(); + //do faction hits even if we are a merchant, so long as a player killed us + if (give_exp_client && !RuleB(NPC, EnableMeritBasedFaction)) + hate_list.DoFactionHits(GetNPCFactionID()); + bool IsLdonTreasure = (this->GetClass() == LDON_TREASURE); if (give_exp_client && !IsCorpse()) { @@ -2287,10 +2291,6 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack } } - //do faction hits even if we are a merchant, so long as a player killed us - if(give_exp_client && !RuleB(NPC, EnableMeritBasedFaction)) - hate_list.DoFactionHits(GetNPCFactionID()); - if (!HasOwner() && !IsMerc() && class_ != MERCHANT && class_ != ADVENTUREMERCHANT && !GetSwarmInfo() && MerchantType == 0 && killer && (killer->IsClient() || (killer->HasOwner() && killer->GetUltimateOwner()->IsClient()) || (killer->IsNPC() && killer->CastToNPC()->GetSwarmInfo() && killer->CastToNPC()->GetSwarmInfo()->GetOwner() && killer->CastToNPC()->GetSwarmInfo()->GetOwner()->IsClient()))) diff --git a/zone/exp.cpp b/zone/exp.cpp index 7e878206a..3a77f30dc 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -268,12 +268,17 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { //this ammount of exp (once these loops complete) uint16 check_level = GetLevel()+1; //see if we gained any levels + bool level_increase = true; + int8 level_count = 0; + while (set_exp >= GetEXPForLevel(check_level)) { check_level++; if (check_level > 127) { //hard level cap check_level = 127; break; } + level_count++; + if(GetMercID()) UpdateMercLevel(); } @@ -284,6 +289,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { check_level = 2; break; } + level_increase = false; if(GetMercID()) UpdateMercLevel(); } @@ -364,17 +370,21 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { if ((GetLevel() != check_level) && !(check_level >= maxlevel)) { char val1[20]={0}; - if (GetLevel() == check_level-1){ - Message_StringID(MT_Experience, GAIN_LEVEL,ConvertArray(check_level,val1)); - SendLevelAppearance(); - /* Message(15, "You have gained a level! Welcome to level %i!", check_level); */ - } - if (GetLevel() == check_level){ - Message_StringID(MT_Experience, LOSE_LEVEL,ConvertArray(check_level,val1)); - /* Message(15, "You lost a level! You are now level %i!", check_level); */ + if (level_increase) + { + if (level_count == 1) + Message_StringID(MT_Experience, GAIN_LEVEL, ConvertArray(check_level, val1)); + else + Message(15, "Welcome to level %i!", check_level); + + if (check_level == RuleI(Character, DeathItemLossLevel)) + Message_StringID(15, CORPSE_ITEM_LOST); + + if (check_level == RuleI(Character, DeathExpLossLevel)) + Message_StringID(15, CORPSE_EXP_LOST); } else - Message(15, "Welcome to level %i!", check_level); + Message_StringID(MT_Experience, LOSE_LEVEL, ConvertArray(check_level, val1)); #ifdef BOTS uint8 myoldlevel = GetLevel(); diff --git a/zone/string_ids.h b/zone/string_ids.h index ef758dba6..2db4e34e8 100644 --- a/zone/string_ids.h +++ b/zone/string_ids.h @@ -231,6 +231,8 @@ #define MISSED_NOTE_OTHER 1219 //A missed note brings %1's song to a close! #define SPELL_LEVEL_REQ 1226 //This spell only works on people who are level %1 and under. #define CORPSE_DECAY_NOW 1227 //This corpse is waiting to expire. +#define CORPSE_ITEM_LOST 1228 //Your items will no longer stay with you when you respawn on death. You will now need to return to your corpse for your items. +#define CORPSE_EXP_LOST 1229 //You will now lose experience when you die. #define SURNAME_REJECTED 1374 //Your new surname was rejected. Please try a different name. #define DUEL_DECLINE 1383 //%1 has declined your challenge to duel to the death. #define DUEL_ACCEPTED 1384 //%1 has already accepted a duel with someone else.