This commit is contained in:
Uleat
2014-09-02 21:20:06 -04:00
14 changed files with 156 additions and 33 deletions
+87 -6
View File
@@ -190,6 +190,7 @@ void MapOpcodes() {
ConnectedOpcodes[OP_GuildWar] = &Client::Handle_OP_GuildWar;
ConnectedOpcodes[OP_GuildLeader] = &Client::Handle_OP_GuildLeader;
ConnectedOpcodes[OP_GuildDemote] = &Client::Handle_OP_GuildDemote;
ConnectedOpcodes[OP_GuildPromote] = &Client::Handle_OP_GuildPromote;
ConnectedOpcodes[OP_GuildInvite] = &Client::Handle_OP_GuildInvite;
ConnectedOpcodes[OP_GuildRemove] = &Client::Handle_OP_GuildRemove;
ConnectedOpcodes[OP_GetGuildMOTD] = &Client::Handle_OP_GetGuildMOTD;
@@ -4088,7 +4089,7 @@ void Client::Handle_OP_GuildLeader(const EQApplicationPacket *app)
GuildMakeLeader* gml=(GuildMakeLeader*)app->pBuffer;
if (!IsInAGuild())
Message(0, "Error: You arent in a guild!");
else if (!guild_mgr.IsGuildLeader(GuildID(), CharacterID()))
else if (GuildRank() != GUILD_LEADER)
Message(0, "Error: You arent the guild leader!");
else if (!worldserver.Connected())
Message(0, "Error: World server disconnected");
@@ -4169,6 +4170,57 @@ void Client::Handle_OP_GuildDemote(const EQApplicationPacket *app)
return;
}
void Client::Handle_OP_GuildPromote(const EQApplicationPacket *app)
{
mlog(GUILDS__IN_PACKETS, "Received OP_GuildPromote");
mpkt(GUILDS__IN_PACKET_TRACE, app);
if(app->size != sizeof(GuildPromoteStruct)) {
mlog(GUILDS__ERROR, "Error: app size of %i != size of GuildDemoteStruct of %i\n",app->size,sizeof(GuildPromoteStruct));
return;
}
if (!IsInAGuild())
Message(0, "Error: You arent in a guild!");
else if (!guild_mgr.CheckPermission(GuildID(), GuildRank(), GUILD_PROMOTE))
Message(0, "You dont have permission to invite.");
else if (!worldserver.Connected())
Message(0, "Error: World server disconnected");
else {
GuildPromoteStruct* promote = (GuildPromoteStruct*)app->pBuffer;
CharGuildInfo gci;
if(!guild_mgr.GetCharInfo(promote->target, gci)) {
Message(0, "Unable to find '%s'", promote->target);
return;
}
if(gci.guild_id != GuildID()) {
Message(0, "You aren't in the same guild, what do you think you are doing?");
return;
}
uint8 rank = gci.rank + 1;
if(rank > GUILD_OFFICER)
return;
mlog(GUILDS__ACTIONS, "Promoting %s (%d) from rank %s (%d) to %s (%d) in %s (%d)",
promote->target, gci.char_id,
guild_mgr.GetRankName(GuildID(), gci.rank), gci.rank,
guild_mgr.GetRankName(GuildID(), rank), rank,
guild_mgr.GetGuildName(GuildID()), GuildID());
if(!guild_mgr.SetGuildRank(gci.char_id, rank)) {
Message(13, "Error while setting rank %d on '%s'.", rank, promote->target);
return;
}
Message(0, "Successfully promoted %s to rank %d", promote->target, rank);
}
return;
}
void Client::Handle_OP_GuildInvite(const EQApplicationPacket *app)
{
mlog(GUILDS__IN_PACKETS, "Received OP_GuildInvite");
@@ -4379,6 +4431,16 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app)
GuildInviteAccept_Struct* gj = (GuildInviteAccept_Struct*) app->pBuffer;
if(GetClientVersion() >= EQClientRoF)
{
if(gj->response > 9)
{
//dont care if the check fails (since we dont know the rank), just want to clear the entry.
guild_mgr.VerifyAndClearInvite(CharacterID(), gj->guildeqid, gj->response);
worldserver.SendEmoteMessage(gj->inviter, 0, 0, "%s has declined to join the guild.", this->GetName());
return;
}
}
if (gj->response == 5 || gj->response == 4) {
//dont care if the check fails (since we dont know the rank), just want to clear the entry.
guild_mgr.VerifyAndClearInvite(CharacterID(), gj->guildeqid, gj->response);
@@ -4424,15 +4486,24 @@ void Client::Handle_OP_GuildInviteAccept(const EQApplicationPacket *app)
guild_mgr.GetGuildName(gj->guildeqid), gj->guildeqid,
gj->response);
//change guild and rank.
if(!guild_mgr.SetGuild(CharacterID(), gj->guildeqid, gj->response)) {
//change guild and rank
uint32 guildrank = gj->response;
if(GetClientVersion() == EQClientRoF)
{
if(gj->response == 8)
{
guildrank = 0;
}
}
if(!guild_mgr.SetGuild(CharacterID(), gj->guildeqid, guildrank)) {
Message(13, "There was an error during the invite, DB may now be inconsistent.");
return;
}
if(zone->GetZoneID() == RuleI(World, GuildBankZoneID) && GuildBanks)
GuildBanks->SendGuildBank(this);
SendGuildRanks();
}
}
}
@@ -9301,8 +9372,18 @@ void Client::CompleteConnect() {
UpdateAdmin(false);
if (IsInAGuild()){
uint8 rank = GuildRank();
if(GetClientVersion() >= EQClientRoF)
{
switch (rank) {
case 0: { rank = 5; break; } // GUILD_MEMBER 0
case 1: { rank = 3; break; } // GUILD_OFFICER 1
case 2: { rank = 1; break; } // GUILD_LEADER 2
default: { break; } // GUILD_NONE
}
}
SendAppearancePacket(AT_GuildID, GuildID(), false);
SendAppearancePacket(AT_GuildRank, GuildRank(), false);
SendAppearancePacket(AT_GuildRank, rank, false);
}
for (uint32 spellInt = 0; spellInt < MAX_PP_SPELLBOOK; spellInt++)
{
+1
View File
@@ -90,6 +90,7 @@
void Handle_OP_GuildWar(const EQApplicationPacket *app);
void Handle_OP_GuildLeader(const EQApplicationPacket *app);
void Handle_OP_GuildDemote(const EQApplicationPacket *app);
void Handle_OP_GuildPromote(const EQApplicationPacket *app);
void Handle_OP_GuildInvite(const EQApplicationPacket *app);
void Handle_OP_GuildRemove(const EQApplicationPacket *app);
void Handle_OP_GetGuildMOTD(const EQApplicationPacket *app);
+6 -20
View File
@@ -175,8 +175,8 @@ int32 Client::GetActSpellDamage(uint16 spell_id, int32 value, Mob* target) {
value -= GetFocusEffect(focusFcDamageAmt, spell_id);
if(itembonuses.SpellDmg && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5)
value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value);
if(itembonuses.SpellDmg)
value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value);
return value;
}
@@ -245,29 +245,15 @@ int32 Client::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target) {
value -= extra_dmg;
if(itembonuses.SpellDmg)
value -= GetExtraSpellAmt(spell_id, itembonuses.SpellDmg, value) / 6;
return value;
}
int32 Mob::GetExtraSpellAmt(uint16 spell_id, int32 extra_spell_amt, int32 base_spell_dmg)
{
int total_cast_time = 0;
if (spells[spell_id].recast_time >= spells[spell_id].recovery_time)
total_cast_time = spells[spell_id].recast_time + spells[spell_id].cast_time;
else
total_cast_time = spells[spell_id].recovery_time + spells[spell_id].cast_time;
if (total_cast_time > 0 && total_cast_time <= 2500)
extra_spell_amt = extra_spell_amt*25/100;
else if (total_cast_time > 2500 && total_cast_time < 7000)
extra_spell_amt = extra_spell_amt*(0.167*((total_cast_time - 1000)/1000));
else
extra_spell_amt = extra_spell_amt * total_cast_time / 7000;
if(extra_spell_amt*2 < base_spell_dmg)
return 0;
return extra_spell_amt;
return extra_spell_amt;
}
+9 -1
View File
@@ -160,9 +160,17 @@ void Client::SendGuildSpawnAppearance() {
uint8 rank = guild_mgr.GetDisplayedRank(GuildID(), GuildRank(), CharacterID());
mlog(GUILDS__OUT_PACKETS, "Sending spawn appearance for guild %d at rank %d", GuildID(), rank);
SendAppearancePacket(AT_GuildID, GuildID());
if(GetClientVersion() >= EQClientRoF)
{
switch (rank) {
case 0: { rank = 5; break; } // GUILD_MEMBER 0
case 1: { rank = 3; break; } // GUILD_OFFICER 1
case 2: { rank = 1; break; } // GUILD_LEADER 2
default: { break; } // GUILD_NONE
}
}
SendAppearancePacket(AT_GuildRank, rank);
}
UpdateWho();
}
+4
View File
@@ -374,6 +374,10 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
else if(c != nullptr && s->guild_id != GUILD_NONE) {
//char is in zone, and has changed into a new guild, send MOTD.
c->SendGuildMOTD();
if(c->GetClientVersion() >= EQClientRoF)
{
c->SendGuildRanks();
}
}