From ff7c3aff92e34fec3064f5337a973368238a8b61 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 3 Aug 2020 23:14:39 -0400 Subject: [PATCH] Custom changes. --- common/classes.cpp | 14 ++++++++++++++ common/classes.h | 1 + common/ruletypes.h | 6 ++++++ world/clientlist.cpp | 34 ++++++++++++++++++---------------- zone/attack.cpp | 12 ++++++++++-- zone/client.cpp | 16 +++++++++++++++- zone/effects.cpp | 32 ++++++++++++++++++++++++++++++++ zone/embparser_api.cpp | 18 ++++++++++++++++++ zone/lua_general.cpp | 10 ++++++++++ zone/mob.cpp | 8 ++++++++ zone/questmgr.cpp | 34 ++++++++++++++++++++++++++++++++++ zone/questmgr.h | 1 + zone/special_attacks.cpp | 8 ++++++++ zone/spell_effects.cpp | 16 +++++++++++++++- 14 files changed, 190 insertions(+), 20 deletions(-) diff --git a/common/classes.cpp b/common/classes.cpp index 3aaeeded3..61a379cb7 100644 --- a/common/classes.cpp +++ b/common/classes.cpp @@ -378,6 +378,8 @@ const char *GetClassIDName(uint8 class_id, uint8 level) return "Berserker Guildmaster"; case MERCHANT: return "Merchant"; + case DISCORD_MERCHANT: + return "Discord Merchant"; case ADVENTURERECRUITER: return "Adventure Recruiter"; case ADVENTUREMERCHANT: @@ -388,6 +390,18 @@ const char *GetClassIDName(uint8 class_id, uint8 level) return "Tribute Master"; case GUILD_TRIBUTE_MASTER: return "Guild Tribute Master"; + case GUILD_BANKER: + return "Guild Banker"; + case NORRATHS_KEEPERS_MERCHANT: + return "Radiant Crystal Merchant"; + case DARK_REIGN_MERCHANT: + return "Radiant Crystal Merchant"; + case FELLOWSHIP_MASTER: + return "Fellowship Master"; + case ALT_CURRENCY_MERCHANT: + return "Alternate Currency Merchant"; + case MERCERNARY_MASTER: + return "Mercenary Liaison"; default: return "Unknown"; } diff --git a/common/classes.h b/common/classes.h index f63758937..a35014d94 100644 --- a/common/classes.h +++ b/common/classes.h @@ -61,6 +61,7 @@ #define CORPSE_CLASS 62 // only seen on Danvi's Corpse in Akheva so far.. #define TRIBUTE_MASTER 63 #define GUILD_TRIBUTE_MASTER 64 // not sure +#define GUILD_BANKER 66 #define NORRATHS_KEEPERS_MERCHANT 67 #define DARK_REIGN_MERCHANT 68 #define FELLOWSHIP_MASTER 69 diff --git a/common/ruletypes.h b/common/ruletypes.h index bf61585f7..31944b77c 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -497,6 +497,12 @@ RULE_INT(Combat, LevelToStopACTwinkControl, 50, "Level to stop armorclass twink RULE_BOOL(Combat, ClassicNPCBackstab, false, "True disables npc facestab - NPCget normal attack if not behind") RULE_BOOL(Combat, UseNPCDamageClassLevelMods, true, "Uses GetClassLevelDamageMod calc in npc_scale_manager") RULE_BOOL(Combat, UseExtendedPoisonProcs, false, "Allow old school poisons to last until characrer zones, at a lower proc rate") +RULE_BOOL(Combat, CustomScaling, false, "Use Custom Scaling.") +RULE_REAL(Combat, CustomScalingMeleeMitigation, 2500.0, "Custom Melee Mitigation Scaling (AGI / VALUE)") +RULE_REAL(Combat, CustomScalingMeleeDamage, 100.0, "Custom Melee Damage Scaling (STR / VALUE)") +RULE_REAL(Combat, CustomScalingSkillDamage, 100.0, "Custom Skill Damage Scaling (DEX / VALUE)") +RULE_REAL(Combat, CustomScalingSpellDamage, 100.0, "Custom Spell Damage Scaling (INT / VALUE)") +RULE_REAL(Combat, CustomScalingSpellHealing, 100.0, "Custom Spell Healing Scaling (WIS / VALUE)") RULE_CATEGORY_END() RULE_CATEGORY(NPC) diff --git a/world/clientlist.cpp b/world/clientlist.cpp index 92a02b6ec..941e810f9 100644 --- a/world/clientlist.cpp +++ b/world/clientlist.cpp @@ -605,35 +605,37 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S continue; } else if (cle->GetGM()) { if (cle->Admin() >=250) - rankstring=5021; + rankstring = 5021; else if (cle->Admin() >= 200) - rankstring=5020; + rankstring = 5020; else if (cle->Admin() >= 180) - rankstring=5019; + rankstring = 5019; else if (cle->Admin() >= 170) - rankstring=5018; + rankstring = 5018; else if (cle->Admin() >= 160) - rankstring=5017; + rankstring = 5017; else if (cle->Admin() >= 150) - rankstring=5016; + rankstring = 5016; else if (cle->Admin() >= 100) - rankstring=5015; + rankstring = 5015; else if (cle->Admin() >= 95) - rankstring=5014; + rankstring = 5014; else if (cle->Admin() >= 90) - rankstring=5013; + rankstring = 5013; else if (cle->Admin() >= 85) - rankstring=5012; + rankstring = 5012; else if (cle->Admin() >= 81) - rankstring=5011; + rankstring = 5011; else if (cle->Admin() >= 80) - rankstring=5010; + rankstring = 5010; else if (cle->Admin() >= 50) - rankstring=5009; + rankstring = 5009; else if (cle->Admin() >= 20) - rankstring=5008; - else if (cle->Admin() >= 10) - rankstring=5007; + rankstring = 5008; + } + + if (cle->Admin() == 1) { + rankstring = 5007; } idx++; char guildbuffer[67]={0}; diff --git a/zone/attack.cpp b/zone/attack.cpp index 39fceb568..e9aad208b 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -87,7 +87,7 @@ EQ::skills::SkillType Mob::AttackAnimation(int Hand, const EQ::ItemInstance* wea break; case EQ::item::ItemType2HBlunt: // 2H Blunt skillinuse = EQ::skills::Skill2HBlunt; - type = anim2HSlashing; //anim2HWeapon + type = anim2HWeapon; //anim2HWeapon break; case EQ::item::ItemType2HPiercing: // 2H Piercing if (IsClient() && CastToClient()->ClientVersion() < EQ::versions::ClientVersion::RoF2) @@ -121,7 +121,7 @@ EQ::skills::SkillType Mob::AttackAnimation(int Hand, const EQ::ItemInstance* wea type = anim1HWeapon; break; case EQ::skills::Skill2HBlunt: // 2H Blunt - type = anim2HSlashing; //anim2HWeapon + type = anim2HWeapon; //anim2HWeapon break; case EQ::skills::Skill2HPiercing: // 2H Piercing type = anim2HWeapon; @@ -1531,6 +1531,14 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b SpellFinished(aabonuses.SkillAttackProc[2], other, EQ::spells::CastingSlot::Item, 0, -1, spells[aabonuses.SkillAttackProc[2]].ResistDiff); } + + if (RuleB(Combat, CustomScaling) && IsClient()) { + int scale_value = itembonuses.STR; + float melee_damage_scale = RuleR(Combat, CustomScalingMeleeDamage); + if (scale_value > int(melee_damage_scale)) { + my_hit.damage_done = int(static_cast(my_hit.damage_done) * static_cast(scale_value / melee_damage_scale)); + } + } other->Damage(this, my_hit.damage_done, SPELL_UNKNOWN, my_hit.skill, true, -1, false, m_specialattacks); if (IsDead()) return false; diff --git a/zone/client.cpp b/zone/client.cpp index 7b03fa4cb..89cad3c92 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1034,7 +1034,21 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s return; } } - + uint8 admin_level = Admin(); + char *custom_rank = ( + admin_level ? + ( + admin_level == 1 ? + "[Donator] " : + ( + admin_level == 255 ? + "[Admin] " : + "" + ) + ) : + "" + ); + strn0cpy(message, strcat(custom_rank, message), 4096); if (!worldserver.SendChannelMessage(this, 0, chan_num, 0, language, lang_skill, message)) { Message(0, "Error: World server disconnected"); diff --git a/zone/effects.cpp b/zone/effects.cpp index 67ad52314..beedcd647 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -159,6 +159,14 @@ int32 Mob::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) { if (IsNPC() && CastToNPC()->GetSpellScale()) value = int(static_cast(value) * CastToNPC()->GetSpellScale() / 100.0f); + if (RuleB(Combat, CustomScaling) && IsClient()) { + int scale_value = itembonuses.INT; + float spell_damage_scale = RuleR(Combat, CustomScalingSpellDamage); + if (scale_value > int(spell_damage_scale)) { + value = int(static_cast(value) * static_cast(scale_value / spell_damage_scale)); + } + } + return value; } @@ -228,6 +236,14 @@ int32 Mob::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target) { if (IsNPC() && CastToNPC()->GetSpellScale()) value = int(static_cast(value) * CastToNPC()->GetSpellScale() / 100.0f); + if (RuleB(Combat, CustomScaling) && IsClient()) { + int scale_value = itembonuses.INT; + float spell_damage_scale = RuleR(Combat, CustomScalingSpellDamage); + if (scale_value > spell_damage_scale) { + value = int(static_cast(value) * static_cast(scale_value / spell_damage_scale)); + } + } + return value; } @@ -315,6 +331,14 @@ int32 Mob::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { MessageString(Chat::SpellCrit, YOU_CRIT_HEAL, itoa(value)); } + if (RuleB(Combat, CustomScaling) && IsClient()) { + int scale_value = itembonuses.WIS; + float spell_damage_scale = RuleR(Combat, CustomScalingSpellDamage); + if (scale_value > int(spell_damage_scale)) { + value = int(static_cast(value) * static_cast(scale_value / spell_damage_scale)); + } + } + return value; } @@ -335,6 +359,14 @@ int32 Mob::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) { if (IsNPC() && CastToNPC()->GetHealScale()) value = int(static_cast(value) * CastToNPC()->GetHealScale() / 100.0f); + if (RuleB(Combat, CustomScaling) && IsClient()) { + int scale_value = itembonuses.WIS; + float spell_healing_scale = RuleR(Combat, CustomScalingSpellHealing); + if (scale_value > int(spell_healing_scale)) { + value = int(static_cast(value) * static_cast(scale_value / spell_healing_scale)); + } + } + return value; } diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index ae5a79f10..bcf503aac 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -2912,6 +2912,23 @@ XS(XS__countitem) { XSRETURN_IV(quantity); } +XS(XS__removeitem); +XS(XS__removeitem) { + dXSARGS; + if (items < 1 || items > 2) + Perl_croak(aTHX_ "Usage: quest::removeitem(int item_id, [int quantity = 1])"); + + uint32 item_id = (int) SvIV(ST(0)); + uint32 quantity = 1; + if (items > 1) { + quantity = (int) SvIV(ST(1)); + } + + quest_manager.removeitem(item_id, quantity); + + XSRETURN_EMPTY; +} + XS(XS__getitemname); XS(XS__getitemname) { dXSARGS; @@ -5620,6 +5637,7 @@ EXTERN_C XS(boot_quest) { newXS(strcpy(buf, "rain"), XS__rain, file); newXS(strcpy(buf, "rebind"), XS__rebind, file); newXS(strcpy(buf, "reloadzonestaticdata"), XS__reloadzonestaticdata, file); + newXS(strcpy(buf, "removeitem"), XS__removeitem, file); newXS(strcpy(buf, "removetitle"), XS__removetitle, file); newXS(strcpy(buf, "repopzone"), XS__repopzone, file); newXS(strcpy(buf, "resettaskactivity"), XS__resettaskactivity, file); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 5ad1b2266..564f14df3 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -801,6 +801,14 @@ int lua_count_item(uint32 item_id) { return quest_manager.countitem(item_id); } +void lua_remove_item(uint32 item_id) { + quest_manager.removeitem(item_id); +} + +void lua_remove_item(uint32 item_id, uint32 quantity) { + quest_manager.removeitem(item_id, quantity); +} + void lua_update_spawn_timer(uint32 id, uint32 new_time) { quest_manager.UpdateSpawnTimer(id, new_time); } @@ -2253,6 +2261,8 @@ luabind::scope lua_register_general() { luabind::def("modify_npc_stat", &lua_modify_npc_stat), luabind::def("collect_items", &lua_collect_items), luabind::def("count_item", &lua_count_item), + luabind::def("remove_item", (void(*)(uint32))&lua_remove_item), + luabind::def("remove_item", (void(*)(uint32,uint32))&lua_remove_item), luabind::def("update_spawn_timer", &lua_update_spawn_timer), luabind::def("merchant_set_item", (void(*)(uint32,uint32))&lua_merchant_set_item), luabind::def("merchant_set_item", (void(*)(uint32,uint32,uint32))&lua_merchant_set_item), diff --git a/zone/mob.cpp b/zone/mob.cpp index 63eb351cb..73890b17f 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -5677,6 +5677,14 @@ int32 Mob::GetMeleeMitigation() { mitigation += spellbonuses.MeleeMitigationEffect; mitigation += itembonuses.MeleeMitigationEffect; mitigation += aabonuses.MeleeMitigationEffect; + + if (RuleB(Combat, CustomScaling) && IsClient()) { + int scale_value = itembonuses.AGI; + float melee_mitigation_scale = RuleR(Combat, CustomScalingMeleeMitigation); + if (scale_value > int(melee_mitigation_scale)) { + mitigation = int(static_cast(mitigation) + static_cast(scale_value / melee_mitigation_scale)); + } + } return mitigation; } diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index 9daf2d351..0475b0b45 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2719,6 +2719,40 @@ int QuestManager::countitem(uint32 item_id) { return quantity; } +void QuestManager::removeitem(uint32 item_id, uint32 quantity) { + QuestManagerCurrentQuestVars(); + EQ::ItemInstance *item = nullptr; + static const int16 slots[][2] = { + { EQ::invslot::POSSESSIONS_BEGIN, EQ::invslot::POSSESSIONS_END }, + { EQ::invbag::GENERAL_BAGS_BEGIN, EQ::invbag::GENERAL_BAGS_END }, + { EQ::invbag::CURSOR_BAG_BEGIN, EQ::invbag::CURSOR_BAG_END}, + { EQ::invslot::BANK_BEGIN, EQ::invslot::BANK_END }, + { EQ::invbag::BANK_BAGS_BEGIN, EQ::invbag::BANK_BAGS_END }, + { EQ::invslot::SHARED_BANK_BEGIN, EQ::invslot::SHARED_BANK_END }, + { EQ::invbag::SHARED_BANK_BAGS_BEGIN, EQ::invbag::SHARED_BANK_BAGS_END }, + }; + int removed_count = 0; + const size_t size = sizeof(slots) / sizeof(slots[0]); + for (int slot_index = 0; slot_index < size; ++slot_index) { + for (int slot_id = slots[slot_index][0]; slot_id <= slots[slot_index][1]; ++slot_id) { + item = initiator->GetInv().GetItem(slot_id); + if (item && item->GetID() == item_id) { + int stack_size = item->IsStackable() ? item->GetCharges() : 1; + if ((removed_count + stack_size) <= quantity) { + removed_count += stack_size; + initiator->DeleteItemInInventory(slot_id, stack_size, true); + } else { + int amount_left = (quantity - removed_count); + if (amount_left > 0 && stack_size >= amount_left) { + removed_count += amount_left; + initiator->DeleteItemInInventory(slot_id, amount_left, true); + } + } + } + } + } +} + void QuestManager::UpdateSpawnTimer(uint32 id, uint32 newTime) { bool found = false; diff --git a/zone/questmgr.h b/zone/questmgr.h index 8e9d84cf9..e9ca67b17 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -226,6 +226,7 @@ public: int collectitems(uint32 item_id, bool remove); int collectitems_processSlot(int16 slot_id, uint32 item_id, bool remove); int countitem(uint32 item_id); + void removeitem(uint32 item_id, uint32 quantity = 1); std::string getitemname(uint32 item_id); void enabletitle(int titleset); bool checktitle(int titlecheck); diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 717bc4fbf..6aa740f3a 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -200,6 +200,14 @@ void Mob::DoSpecialAttackDamage(Mob *who, EQ::skills::SkillType skill, int32 bas SpellFinished(aabonuses.SkillAttackProc[2], who, EQ::spells::CastingSlot::Item, 0, -1, spells[aabonuses.SkillAttackProc[2]].ResistDiff); } + + if (RuleB(Combat, CustomScaling) && IsClient()) { + int scale_value = itembonuses.DEX; + float skill_damage_scale = RuleR(Combat, CustomScalingSkillDamage); + if (scale_value > int(skill_damage_scale)) { + my_hit.damage_done = int(static_cast(my_hit.damage_done) * static_cast(scale_value / skill_damage_scale)); + } + } who->Damage(this, my_hit.damage_done, SPELL_UNKNOWN, skill, false); diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 2eb17eb29..20ba55770 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -2408,7 +2408,13 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove //need a bard version of this prolly... //if(caster) // dmg = caster->GetActSpellDamage(spell_id, dmg); - + if (RuleB(Combat, CustomScaling) && caster && caster->IsClient()) { + int scale_value = caster->GetItemBonuses().INT; + float spell_damage_scale = RuleR(Combat, CustomScalingSpellDamage); + if (scale_value > int(spell_damage_scale)) { + dmg = int(static_cast(dmg) * static_cast(scale_value / spell_damage_scale)); + } + } dmg = -dmg; Damage(caster, dmg, spell_id, spell.skill, false, buffslot, false); } else if(dmg > 0) { @@ -3575,6 +3581,14 @@ void Mob::DoBuffTic(const Buffs_Struct &buff, int slot, Mob *caster) if ((!RuleB(Spells, PreNerfBardAEDoT) && IsMoving()) || invulnerable || /*effect_value > 0 ||*/ DivineAura()) break; + + if (RuleB(Combat, CustomScaling) && caster && caster->IsClient()) { + int scale_value = caster->GetItemBonuses().INT; + float spell_damage_scale = RuleR(Combat, CustomScalingSpellDamage); + if (scale_value > int(spell_damage_scale)) { + effect_value = int(static_cast(effect_value) * static_cast(scale_value / spell_damage_scale)); + } + } if (effect_value < 0) { effect_value = -effect_value;