From 7d8f1bef877729e3ffa3df82278f5599dda90ed3 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Wed, 14 May 2014 07:59:12 -0400 Subject: [PATCH 1/4] Missing rule SQL from prior update. --- utils/sql/git/optional/2014_04_23_FocusComabtProcs.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 utils/sql/git/optional/2014_04_23_FocusComabtProcs.sql diff --git a/utils/sql/git/optional/2014_04_23_FocusComabtProcs.sql b/utils/sql/git/optional/2014_04_23_FocusComabtProcs.sql new file mode 100644 index 000000000..76f9c157a --- /dev/null +++ b/utils/sql/git/optional/2014_04_23_FocusComabtProcs.sql @@ -0,0 +1 @@ +INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Spells:FocusCombatProcs', 'false', 'Allow all combat procs to receive focus (ignores focus limit).'); From fc79521dd3cfd85ad6be29a865c8105c98f666ac Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Wed, 14 May 2014 08:40:18 -0400 Subject: [PATCH 2/4] Rooted NPC's will no longer target players with Divine Aura effect if they are the closest target and other targets exist on the hate list. --- changelog.txt | 3 +++ zone/hate_list.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index fde7ca6b2..8cc495aad 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 05/14/2014 == +Kayen: Rooted NPC's will no longer target players with Divine Aura effect if they are the closest target and other targets exist on the hate list. + == 05/12/2014 == Uleat: Re-arranged functions in Item.cpp to somewhat match the order they are declared in Item.h. Should make finding their location a little easier when using declarations as a guide. (This will facilitate readability of an upcoming change...) diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index d83ed4d12..538abac61 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -163,7 +163,7 @@ Mob* HateList::GetClosest(Mob *hater) { ++iterator; } - if (close == 0 && hater->IsNPC()) + if (close == 0 && hater->IsNPC() || close->DivineAura()) close = hater->CastToNPC()->GetHateTop(); return close; From 87ecdd38e58c3b3bed5fdfff044b939c1a304702 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Wed, 14 May 2014 09:27:47 -0400 Subject: [PATCH 3/4] Update for spell effect SE_LimitHPPercent, SE_LimitManaPercent, SE_LimitEndPercent to utilize limit values. These effects cap your hp/end/mana at a set percent (base) OR flat value (limit) which is ever is lower. --- zone/bonuses.cpp | 38 +++++++++++++++++++++++++------------- zone/bot.cpp | 8 ++++---- zone/client_mods.cpp | 12 ++++++------ zone/common.h | 6 +++--- zone/merc.cpp | 12 ++++++------ 5 files changed, 44 insertions(+), 32 deletions(-) diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index db0f81115..4699bfef1 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -2151,28 +2151,40 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses* ne case SE_LimitHPPercent: { - if(newbon->HPPercCap != 0 && newbon->HPPercCap > effect_value) - newbon->HPPercCap = effect_value; - else if(newbon->HPPercCap == 0) - newbon->HPPercCap = effect_value; - + if(newbon->HPPercCap[0] != 0 && newbon->HPPercCap[0] > effect_value){ + newbon->HPPercCap[0] = effect_value; + newbon->HPPercCap[1] = base2; + } + else if(newbon->HPPercCap[0] == 0){ + newbon->HPPercCap[0] = effect_value; + newbon->HPPercCap[1] = base2; + } break; } case SE_LimitManaPercent: { - if(newbon->ManaPercCap != 0 && newbon->ManaPercCap > effect_value) - newbon->ManaPercCap = effect_value; - else if(newbon->ManaPercCap == 0) - newbon->ManaPercCap = effect_value; + if(newbon->ManaPercCap[0] != 0 && newbon->ManaPercCap[0] > effect_value){ + newbon->ManaPercCap[0] = effect_value; + newbon->ManaPercCap[1] = base2; + } + else if(newbon->ManaPercCap[0] == 0) { + newbon->ManaPercCap[0] = effect_value; + newbon->ManaPercCap[1] = base2; + } break; } case SE_LimitEndPercent: { - if(newbon->EndPercCap != 0 && newbon->EndPercCap > effect_value) - newbon->EndPercCap = effect_value; - else if(newbon->EndPercCap == 0) - newbon->EndPercCap = effect_value; + if(newbon->EndPercCap[0] != 0 && newbon->EndPercCap[0] > effect_value) { + newbon->EndPercCap[0] = effect_value; + newbon->EndPercCap[1] = base2; + } + + else if(newbon->EndPercCap[0] == 0){ + newbon->EndPercCap[0] = effect_value; + newbon->EndPercCap[1] = base2; + } break; } diff --git a/zone/bot.cpp b/zone/bot.cpp index 1526beddc..3b996e7a8 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -10649,10 +10649,10 @@ int32 Bot::CalcMaxHP() { if (cur_hp > max_hp) cur_hp = max_hp; - int hp_perc_cap = spellbonuses.HPPercCap; + int hp_perc_cap = spellbonuses.HPPercCap[0]; if(hp_perc_cap) { int curHP_cap = (max_hp * hp_perc_cap) / 100; - if (cur_hp > curHP_cap) + if (cur_hp > curHP_cap || (spellbonuses.HPPercCap[1] && cur_hp > spellbonuses.HPPercCap[1])) cur_hp = curHP_cap; } @@ -10671,10 +10671,10 @@ int32 Bot::CalcMaxEndurance() cur_end = max_end; } - int end_perc_cap = spellbonuses.EndPercCap; + int end_perc_cap = spellbonuses.EndPercCap[0]; if(end_perc_cap) { int curEnd_cap = (max_end * end_perc_cap) / 100; - if (cur_end > curEnd_cap) + if (cur_end > curEnd_cap || (spellbonuses.EndPercCap[1] && cur_end > spellbonuses.EndPercCap[1])) cur_end = curEnd_cap; } diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 8c29f05eb..955a29d38 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -255,10 +255,10 @@ int32 Client::CalcMaxHP() { if (cur_hp > max_hp) cur_hp = max_hp; - int hp_perc_cap = spellbonuses.HPPercCap; + int hp_perc_cap = spellbonuses.HPPercCap[0]; if(hp_perc_cap) { int curHP_cap = (max_hp * hp_perc_cap) / 100; - if (cur_hp > curHP_cap) + if (cur_hp > curHP_cap || (spellbonuses.HPPercCap[1] && cur_hp > spellbonuses.HPPercCap[1])) cur_hp = curHP_cap; } @@ -950,10 +950,10 @@ int32 Client::CalcMaxMana() cur_mana = max_mana; } - int mana_perc_cap = spellbonuses.ManaPercCap; + int mana_perc_cap = spellbonuses.ManaPercCap[0]; if(mana_perc_cap) { int curMana_cap = (max_mana * mana_perc_cap) / 100; - if (cur_mana > curMana_cap) + if (cur_mana > curMana_cap || (spellbonuses.ManaPercCap[1] && cur_mana > spellbonuses.ManaPercCap[1])) cur_mana = curMana_cap; } @@ -1890,10 +1890,10 @@ void Client::CalcMaxEndurance() cur_end = max_end; } - int end_perc_cap = spellbonuses.EndPercCap; + int end_perc_cap = spellbonuses.EndPercCap[0]; if(end_perc_cap) { int curEnd_cap = (max_end * end_perc_cap) / 100; - if (cur_end > curEnd_cap) + if (cur_end > curEnd_cap || (spellbonuses.EndPercCap[1] && cur_end > spellbonuses.EndPercCap[1])) cur_end = curEnd_cap; } } diff --git a/zone/common.h b/zone/common.h index d720f3d43..d2737e4a5 100644 --- a/zone/common.h +++ b/zone/common.h @@ -310,9 +310,9 @@ struct StatBonuses { int16 IncreaseBlockChance; // overall block chance modifier uint16 PersistantCasting; // chance to continue casting through a stun int XPRateMod; //i - int HPPercCap; //Spell effect that limits you to being healed/regening beyond a % of your max - int ManaPercCap; // ^^ - int EndPercCap; // ^^ + int HPPercCap[2]; //Spell effect that limits you to being healed/regening beyond a % of your max + int ManaPercCap[2]; // ^^ 0 = % Cap 1 = Flat Amount Cap + int EndPercCap[2]; // ^^ bool BlockNextSpell; // Indicates whether the client can block a spell or not //uint16 BlockSpellEffect[EFFECT_COUNT]; // Prevents spells with certain effects from landing on you *no longer used bool ImmuneToFlee; // Bypass the fleeing flag diff --git a/zone/merc.cpp b/zone/merc.cpp index c8c8da6fa..8b2f9ce90 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -917,10 +917,10 @@ int32 Merc::CalcMaxHP() { if (cur_hp > max_hp) cur_hp = max_hp; - int hp_perc_cap = spellbonuses.HPPercCap; + int hp_perc_cap = spellbonuses.HPPercCap[0]; if(hp_perc_cap) { int curHP_cap = (max_hp * hp_perc_cap) / 100; - if (cur_hp > curHP_cap) + if (cur_hp > curHP_cap || (spellbonuses.HPPercCap[1] && cur_hp > spellbonuses.HPPercCap[1])) cur_hp = curHP_cap; } @@ -959,10 +959,10 @@ int32 Merc::CalcMaxMana() cur_mana = max_mana; } - int mana_perc_cap = spellbonuses.ManaPercCap; + int mana_perc_cap = spellbonuses.ManaPercCap[0]; if(mana_perc_cap) { int curMana_cap = (max_mana * mana_perc_cap) / 100; - if (cur_mana > curMana_cap) + if (cur_mana > curMana_cap || (spellbonuses.ManaPercCap[1] && cur_mana > spellbonuses.ManaPercCap[1])) cur_mana = curMana_cap; } @@ -1054,10 +1054,10 @@ void Merc::CalcMaxEndurance() cur_end = max_end; } - int end_perc_cap = spellbonuses.EndPercCap; + int end_perc_cap = spellbonuses.EndPercCap[0]; if(end_perc_cap) { int curEnd_cap = (max_end * end_perc_cap) / 100; - if (cur_end > curEnd_cap) + if (cur_end > curEnd_cap || (spellbonuses.EndPercCap[1] && cur_end > spellbonuses.EndPercCap[1])) cur_end = curEnd_cap; } } From cc6dce25ad3c7eb768f816651bbe0db2f90a843d Mon Sep 17 00:00:00 2001 From: SecretsOTheP Date: Sat, 17 May 2014 23:33:35 -0400 Subject: [PATCH 4/4] Identified the opcode/struct for guild ranks in Rain of Fear+ clients and created a temporary workaround for permissions until full DB support is added for the new permissions system. --- changelog.txt | 4 ++++ common/eq_packet_structs.h | 20 ++++++++++++++++++++ zone/client.h | 1 + zone/client_packet.cpp | 6 ++++++ zone/guild.cpp | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 67 insertions(+) diff --git a/changelog.txt b/changelog.txt index fde7ca6b2..9d66bcfd8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 05/17/2014 == +Secrets: Identified the opcode/struct for guild ranks in Rain of Fear+ clients. +Secrets: Implemented a work-around for Rain of Fear clients to have all guild permissions until proper database support is added for newer ranks. + == 05/12/2014 == Uleat: Re-arranged functions in Item.cpp to somewhat match the order they are declared in Item.h. Should make finding their location a little easier when using declarations as a guide. (This will facilitate readability of an upcoming change...) diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index e0c4a1563..674ed15b7 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -3163,6 +3163,26 @@ struct GuildUpdateURLAndChannel_Struct /*4176*/ }; +//Case 5 in Rain of Fear and higher clients for guild permissions. +//RankID is the internal guild rank. There are 8 in Rain of Fear as opposed to the 3 in Titanium. +//PermissionID is the type of permission. There are 32 total, with some unused. Live May 2014 sends and uses 26 of them. Varies through client version. +//Permission value is a char that is either 0 or 1. Enabled for that rank/disabled for that rank. +//The client sends this struct on changing a guild rank. The server sends each rank in 32 or less packets upon zonein if you are in a guild. +struct GuildUpdateRanks_Struct +{ +/*0000*/ uint32 Action; // 0 = Update URL, 1 = Update Channel, 5 = RoF Ranks +/*0004*/ uint32 Unknown0004; //Seen 00 00 00 00 +/*0008*/ uint32 Unknown0008; //Seen 96 29 00 00 +/*0008*/ char Unknown0012[64]; //Seen "CharacterName" +/*0076*/ uint32 GuildID; //Guild ID of "CharacterName" +/*0080*/ uint32 RankID; +/*0084*/ uint32 PermissionID; +/*0088*/ char PermissionVal; +/*0089*/ char Unknown0089[3]; //Seen 2c 01 00 ? +/*0092*/ +}; + + struct GuildStatus_Struct { /*000*/ char Name[64]; diff --git a/zone/client.h b/zone/client.h index a97671c20..9e2503df2 100644 --- a/zone/client.h +++ b/zone/client.h @@ -621,6 +621,7 @@ public: void SendGuildURL(); void SendGuildChannel(); void SendGuildSpawnAppearance(); + void SendGuildRanks(); void SendGuildMembers(); void SendGuildList(); void SendGuildJoin(GuildJoin_Struct* gj); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index cc5414ac4..ff79fd317 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4431,6 +4431,7 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app) } if(zone->GetZoneID() == RuleI(World, GuildBankZoneID) && GuildBanks) GuildBanks->SendGuildBank(this); + SendGuildRanks(); } } @@ -8128,7 +8129,10 @@ void Client::Handle_OP_ClientError(const EQApplicationPacket *app) void Client::Handle_OP_ReloadUI(const EQApplicationPacket *app) { if(IsInAGuild()) + { + SendGuildRanks(); SendGuildMembers(); + } return; } @@ -9603,6 +9607,7 @@ void Client::CompleteConnect() if(IsInAGuild()) { + SendGuildRanks(); guild_mgr.SendGuildMemberUpdateToWorld(GetName(), GuildID(), zone->GetZoneID(), time(nullptr)); guild_mgr.RequestOnlineGuildMembers(this->CharacterID(), this->GuildID()); } @@ -12528,6 +12533,7 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) if(zone->GetZoneID() == RuleI(World, GuildBankZoneID) && GuildBanks) GuildBanks->SendGuildBank(this); + SendGuildRanks(); } } } diff --git a/zone/guild.cpp b/zone/guild.cpp index 66ff4946c..21e350cdf 100644 --- a/zone/guild.cpp +++ b/zone/guild.cpp @@ -115,6 +115,42 @@ void Client::SendGuildChannel() } } +void Client::SendGuildRanks() +{ + if(GetClientVersion() < EQClientRoF) + return; + + int permissions = 30 + 1; //Static number of permissions in all EQ clients as of May 2014 + int ranks = 8 + 1; // Static number of RoF+ ranks as of May 2014 + int j = 1; + int i = 1; + if(IsInAGuild()) + { + while(j < ranks) + { + while(i < permissions) + { + EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildUpdateURLAndChannel, sizeof(GuildUpdateRanks_Struct)); + GuildUpdateRanks_Struct *guuacs = (GuildUpdateRanks_Struct*) outapp->pBuffer; + //guuacs->Unknown0008 = this->GuildID(); + strncpy(guuacs->Unknown0012, this->GetCleanName(), 64); + guuacs->Action = 5; + guuacs->RankID = j; + guuacs->GuildID = this->GuildID(); + guuacs->PermissionID = i; + guuacs->PermissionVal = 1; + guuacs->Unknown0089[0] = 0x2c; + guuacs->Unknown0089[1] = 0x01; + guuacs->Unknown0089[2] = 0x00; + FastQueuePacket(&outapp); + i++; + } + j++; + i = 1; + } + } +} + void Client::SendGuildSpawnAppearance() { if (!IsInAGuild()) { // clear guildtag