[Experience] Add exp mod to npc types to let a server op change the exp modifier (#1252)

* Add exp mod to npc types to let a server op change the exp modifier a npc gives (useful for custom content)

* Updated version.h
This commit is contained in:
Alex 2021-02-23 09:50:38 -08:00 committed by GitHub
parent 65704274cb
commit bf3593a60d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 6 deletions

View File

@ -34,7 +34,7 @@
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/
#define CURRENT_BINARY_DATABASE_VERSION 9159
#define CURRENT_BINARY_DATABASE_VERSION 9160
#ifdef BOTS
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9027

View File

@ -413,6 +413,7 @@
9157|2020_09_02_pet_taunting.sql|SHOW COLUMNS from `character_pet_info` LIKE 'taunting'|empty|
9158|2020_12_09_underworld.sql|SHOW COLUMNS from `zone` LIKE 'underworld_teleport_index'|empty|
9159|2020_12_22_expedition_system.sql|SELECT * FROM db_version WHERE version >= 9159|empty|
9160|2021_02_14_npc_exp_mod.sql|SHOW COLUMNS from `npc_types` LIKE 'exp_mod'|empty|
# Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not

View File

@ -0,0 +1 @@
ALTER TABLE `npc_types` ADD COLUMN `exp_mod` INT NOT NULL DEFAULT '100' AFTER `always_aggro`;

View File

@ -215,7 +215,15 @@ uint32 Client::GetExperienceForKill(Mob *against)
if (against && against->IsNPC()) {
uint32 level = (uint32)against->GetLevel();
return EXP_FORMULA;
uint32 ret = EXP_FORMULA;
auto mod = against->GetKillExpMod();
if(mod >= 0) {
ret *= mod;
ret /= 100;
}
return ret;
}
return 0;

View File

@ -695,6 +695,7 @@ public:
bool PlotPositionOnArcInFrontOfTarget(Mob *target, float &x_dest, float &y_dest, float &z_dest, float distance, float min_deg = 5.0f, float max_deg = 150.0f);
bool PlotPositionOnArcBehindTarget(Mob *target, float &x_dest, float &y_dest, float &z_dest, float distance);
bool PlotPositionBehindMeFacingTarget(Mob *target, float &x_dest, float &y_dest, float &z_dest, float min_dist = 1.0f, float max_dist = 5.0f);
virtual int GetKillExpMod() const { return 100; }
// aura functions
void MakeAura(uint16 spell_id);

View File

@ -422,10 +422,12 @@ public:
void SetCombatEvent(bool b) { combat_event = b; }
/* Only allows players that killed corpse to loot */
const bool HasPrivateCorpse() const { return NPCTypedata->private_corpse; }
const bool HasPrivateCorpse() const { return NPCTypedata_ours ? NPCTypedata_ours->private_corpse : NPCTypedata->private_corpse; }
virtual const bool IsUnderwaterOnly() const { return NPCTypedata->underwater; }
const char* GetRawNPCTypeName() const { return NPCTypedata->name; }
virtual const bool IsUnderwaterOnly() const { return NPCTypedata_ours ? NPCTypedata_ours->underwater : NPCTypedata->underwater; }
const char* GetRawNPCTypeName() const { return NPCTypedata_ours ? NPCTypedata_ours->name : NPCTypedata->name; }
virtual int GetKillExpMod() const { return NPCTypedata_ours ? NPCTypedata_ours->exp_mod : NPCTypedata->exp_mod; }
void ChangeLastName(const char* in_lastname);
void ClearLastName();

View File

@ -2525,7 +2525,8 @@ const NPCType *ZoneDatabase::LoadNPCTypesData(uint32 npc_type_id, bool bulk_load
"npc_types.stuck_behavior, "
"npc_types.model, "
"npc_types.flymode, "
"npc_types.always_aggro "
"npc_types.always_aggro, "
"npc_types.exp_mod "
"FROM npc_types %s",
where_condition.c_str()
);
@ -2728,6 +2729,7 @@ const NPCType *ZoneDatabase::LoadNPCTypesData(uint32 npc_type_id, bool bulk_load
temp_npctype_data->use_model = atoi(row[110]);
temp_npctype_data->flymode = atoi(row[111]);
temp_npctype_data->always_aggro = atoi(row[112]);
temp_npctype_data->exp_mod = atoi(row[113]);
temp_npctype_data->skip_auto_scale = false; // hardcoded here for now

View File

@ -148,6 +148,7 @@ struct NPCType
uint16 use_model;
int8 flymode;
bool always_aggro;
int exp_mod;
};
namespace player_lootitem {