Core/Guild: Implemented guild master dethrone
This commit is contained in:
@@ -45,6 +45,8 @@ namespace Framework.Constants
|
|||||||
public static uint MinNewsItemLevel = 353;
|
public static uint MinNewsItemLevel = 353;
|
||||||
|
|
||||||
public static byte OldMaxLevel = 25;
|
public static byte OldMaxLevel = 25;
|
||||||
|
|
||||||
|
public static uint MasterDethroneInactiveDays = 90;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum GuildRankRights
|
public enum GuildRankRights
|
||||||
|
|||||||
@@ -504,7 +504,7 @@ namespace Framework.GameMath
|
|||||||
/// <returns>A new <see cref="Matrix2"/> instance containing the sum.</returns>
|
/// <returns>A new <see cref="Matrix2"/> instance containing the sum.</returns>
|
||||||
public static Matrix2 operator +(Matrix2 left, Matrix2 right)
|
public static Matrix2 operator +(Matrix2 left, Matrix2 right)
|
||||||
{
|
{
|
||||||
return Matrix2.Add(left, right); ;
|
return Matrix2.Add(left, right);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a matrix and a scalar.
|
/// Adds a matrix and a scalar.
|
||||||
@@ -534,7 +534,7 @@ namespace Framework.GameMath
|
|||||||
/// <returns>A new <see cref="Matrix2"/> instance containing the difference.</returns>
|
/// <returns>A new <see cref="Matrix2"/> instance containing the difference.</returns>
|
||||||
public static Matrix2 operator -(Matrix2 left, Matrix2 right)
|
public static Matrix2 operator -(Matrix2 left, Matrix2 right)
|
||||||
{
|
{
|
||||||
return Matrix2.Subtract(left, right); ;
|
return Matrix2.Subtract(left, right);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Subtracts a scalar from a matrix.
|
/// Subtracts a scalar from a matrix.
|
||||||
@@ -554,7 +554,7 @@ namespace Framework.GameMath
|
|||||||
/// <returns>A new <see cref="Matrix2"/> instance containing the result.</returns>
|
/// <returns>A new <see cref="Matrix2"/> instance containing the result.</returns>
|
||||||
public static Matrix2 operator *(Matrix2 left, Matrix2 right)
|
public static Matrix2 operator *(Matrix2 left, Matrix2 right)
|
||||||
{
|
{
|
||||||
return Matrix2.Multiply(left, right); ;
|
return Matrix2.Multiply(left, right);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Transforms a given vector by a matrix.
|
/// Transforms a given vector by a matrix.
|
||||||
|
|||||||
@@ -693,7 +693,7 @@ namespace Framework.GameMath
|
|||||||
/// <returns>A new <see cref="Matrix3"/> instance containing the sum.</returns>
|
/// <returns>A new <see cref="Matrix3"/> instance containing the sum.</returns>
|
||||||
public static Matrix3 operator +(Matrix3 left, Matrix3 right)
|
public static Matrix3 operator +(Matrix3 left, Matrix3 right)
|
||||||
{
|
{
|
||||||
return Matrix3.Add(left, right); ;
|
return Matrix3.Add(left, right);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a matrix and a scalar.
|
/// Adds a matrix and a scalar.
|
||||||
@@ -723,7 +723,7 @@ namespace Framework.GameMath
|
|||||||
/// <returns>A new <see cref="Matrix3"/> instance containing the difference.</returns>
|
/// <returns>A new <see cref="Matrix3"/> instance containing the difference.</returns>
|
||||||
public static Matrix3 operator -(Matrix3 left, Matrix3 right)
|
public static Matrix3 operator -(Matrix3 left, Matrix3 right)
|
||||||
{
|
{
|
||||||
return Matrix3.Subtract(left, right); ;
|
return Matrix3.Subtract(left, right);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Subtracts a scalar from a matrix.
|
/// Subtracts a scalar from a matrix.
|
||||||
@@ -743,7 +743,7 @@ namespace Framework.GameMath
|
|||||||
/// <returns>A new <see cref="Matrix3"/> instance containing the result.</returns>
|
/// <returns>A new <see cref="Matrix3"/> instance containing the result.</returns>
|
||||||
public static Matrix3 operator *(Matrix3 left, Matrix3 right)
|
public static Matrix3 operator *(Matrix3 left, Matrix3 right)
|
||||||
{
|
{
|
||||||
return Matrix3.Multiply(left, right); ;
|
return Matrix3.Multiply(left, right);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Transforms a given vector by a matrix.
|
/// Transforms a given vector by a matrix.
|
||||||
|
|||||||
@@ -780,7 +780,7 @@ namespace Framework.GameMath
|
|||||||
/// <returns>A new <see cref="Matrix4"/> instance containing the sum.</returns>
|
/// <returns>A new <see cref="Matrix4"/> instance containing the sum.</returns>
|
||||||
public static Matrix4 operator +(Matrix4 left, Matrix4 right)
|
public static Matrix4 operator +(Matrix4 left, Matrix4 right)
|
||||||
{
|
{
|
||||||
return Matrix4.Add(left, right); ;
|
return Matrix4.Add(left, right);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a matrix and a scalar.
|
/// Adds a matrix and a scalar.
|
||||||
@@ -810,7 +810,7 @@ namespace Framework.GameMath
|
|||||||
/// <returns>A new <see cref="Matrix4"/> instance containing the difference.</returns>
|
/// <returns>A new <see cref="Matrix4"/> instance containing the difference.</returns>
|
||||||
public static Matrix4 operator -(Matrix4 left, Matrix4 right)
|
public static Matrix4 operator -(Matrix4 left, Matrix4 right)
|
||||||
{
|
{
|
||||||
return Matrix4.Subtract(left, right); ;
|
return Matrix4.Subtract(left, right);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Subtracts a scalar from a matrix.
|
/// Subtracts a scalar from a matrix.
|
||||||
@@ -830,7 +830,7 @@ namespace Framework.GameMath
|
|||||||
/// <returns>A new <see cref="Matrix4"/> instance containing the result.</returns>
|
/// <returns>A new <see cref="Matrix4"/> instance containing the result.</returns>
|
||||||
public static Matrix4 operator *(Matrix4 left, Matrix4 right)
|
public static Matrix4 operator *(Matrix4 left, Matrix4 right)
|
||||||
{
|
{
|
||||||
return Matrix4.Multiply(left, right); ;
|
return Matrix4.Multiply(left, right);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Transforms a given vector by a matrix.
|
/// Transforms a given vector by a matrix.
|
||||||
|
|||||||
@@ -834,7 +834,7 @@ public static partial class Detour
|
|||||||
vArrays[k] = tile.detailVerts;
|
vArrays[k] = tile.detailVerts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float h = .0f; ;
|
float h = .0f;
|
||||||
if (dtClosestHeightPointTriangle(pos, posStart, vArrays[0], vIndices[0], vArrays[1], vIndices[1], vArrays[2], vIndices[2], ref h))
|
if (dtClosestHeightPointTriangle(pos, posStart, vArrays[0], vIndices[0], vArrays[1], vIndices[1], vArrays[2], vIndices[2], ref h))
|
||||||
{
|
{
|
||||||
closest[1] = h;
|
closest[1] = h;
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ namespace Game.DungeonFinding
|
|||||||
foreach (var guid in check)
|
foreach (var guid in check)
|
||||||
{
|
{
|
||||||
if (!(numLfgGroups < 2) && !(numPlayers <= MapConst.MaxGroupSize))
|
if (!(numLfgGroups < 2) && !(numPlayers <= MapConst.MaxGroupSize))
|
||||||
break; ;
|
break;
|
||||||
|
|
||||||
var itQueue = QueueDataStore.LookupByKey(guid);
|
var itQueue = QueueDataStore.LookupByKey(guid);
|
||||||
if (itQueue == null)
|
if (itQueue == null)
|
||||||
|
|||||||
@@ -2448,7 +2448,7 @@ namespace Game.Entities
|
|||||||
if (vItem.maxcount == 0)
|
if (vItem.maxcount == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
VendorItemCount vCount = null; ;
|
VendorItemCount vCount = null;
|
||||||
for (var i = 0; i < m_vendorItemCounts.Count; i++)
|
for (var i = 0; i < m_vendorItemCounts.Count; i++)
|
||||||
{
|
{
|
||||||
vCount = m_vendorItemCounts[i];
|
vCount = m_vendorItemCounts[i];
|
||||||
|
|||||||
@@ -4759,7 +4759,7 @@ namespace Game.Entities
|
|||||||
if ((pvp && WorldConfig.GetBoolValue(WorldCfg.DeathCorpseReclaimDelayPvp)) ||
|
if ((pvp && WorldConfig.GetBoolValue(WorldCfg.DeathCorpseReclaimDelayPvp)) ||
|
||||||
(!pvp && WorldConfig.GetBoolValue(WorldCfg.DeathCorpseReclaimDelayPve)))
|
(!pvp && WorldConfig.GetBoolValue(WorldCfg.DeathCorpseReclaimDelayPve)))
|
||||||
{
|
{
|
||||||
count = (ulong)(m_deathExpireTime - corpse.GetGhostTime()) / PlayerConst.DeathExpireStep; ;
|
count = (ulong)(m_deathExpireTime - corpse.GetGhostTime()) / PlayerConst.DeathExpireStep;
|
||||||
|
|
||||||
if (count >= PlayerConst.MaxDeathCount)
|
if (count >= PlayerConst.MaxDeathCount)
|
||||||
count = PlayerConst.MaxDeathCount - 1;
|
count = PlayerConst.MaxDeathCount - 1;
|
||||||
|
|||||||
+41
-19
@@ -228,7 +228,7 @@ namespace Game.Guilds
|
|||||||
memberData.AreaID = (int)member.GetZoneId();
|
memberData.AreaID = (int)member.GetZoneId();
|
||||||
memberData.PersonalAchievementPoints = (int)member.GetAchievementPoints();
|
memberData.PersonalAchievementPoints = (int)member.GetAchievementPoints();
|
||||||
memberData.GuildReputation = (int)member.GetTotalReputation();
|
memberData.GuildReputation = (int)member.GetTotalReputation();
|
||||||
memberData.LastSave = (member.IsOnline() ? 0.0f : ((ulong)Time.UnixTime - member.GetLogoutTime()) / Time.Day);
|
memberData.LastSave = member.GetInactiveDays();
|
||||||
|
|
||||||
//GuildRosterProfessionData
|
//GuildRosterProfessionData
|
||||||
|
|
||||||
@@ -405,30 +405,45 @@ namespace Game.Guilds
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleSetNewGuildMaster(WorldSession session, string name)
|
public void HandleSetNewGuildMaster(WorldSession session, string name, bool isSelfPromote)
|
||||||
{
|
{
|
||||||
Player player = session.GetPlayer();
|
Player player = session.GetPlayer();
|
||||||
// Only the guild master can throne a new guild master
|
Member oldGuildMaster = GetMember(GetLeaderGUID());
|
||||||
if (!_IsLeader(player))
|
|
||||||
SendCommandResult(session, GuildCommandType.ChangeLeader, GuildCommandError.Permissions);
|
Member newGuildMaster;
|
||||||
// Old GM must be a guild member
|
if (isSelfPromote)
|
||||||
Member oldGuildMaster = GetMember(player.GetGUID());
|
|
||||||
if (oldGuildMaster != null)
|
|
||||||
{
|
{
|
||||||
// Same for the new one
|
newGuildMaster = GetMember(player.GetGUID());
|
||||||
Member newGuildMaster = GetMember(name);
|
if (newGuildMaster == null)
|
||||||
if (newGuildMaster != null)
|
return;
|
||||||
|
|
||||||
|
if (!newGuildMaster.IsRankNotLower(GuildDefaultRanks.Member) || oldGuildMaster.GetInactiveDays() < GuildConst.MasterDethroneInactiveDays)
|
||||||
{
|
{
|
||||||
SQLTransaction trans = new SQLTransaction();
|
SendCommandResult(session, GuildCommandType.ChangeLeader, GuildCommandError.Permissions);
|
||||||
|
return;
|
||||||
_SetLeader(trans, newGuildMaster);
|
|
||||||
oldGuildMaster.ChangeRank(trans, GuildDefaultRanks.Initiate);
|
|
||||||
|
|
||||||
SendEventNewLeader(newGuildMaster, oldGuildMaster);
|
|
||||||
|
|
||||||
DB.Characters.CommitTransaction(trans);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!_IsLeader(player))
|
||||||
|
{
|
||||||
|
SendCommandResult(session, GuildCommandType.ChangeLeader, GuildCommandError.Permissions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
newGuildMaster = GetMember(name);
|
||||||
|
if (newGuildMaster == null)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SQLTransaction trans = new SQLTransaction();
|
||||||
|
|
||||||
|
_SetLeader(trans, newGuildMaster);
|
||||||
|
oldGuildMaster.ChangeRank(trans, GuildDefaultRanks.Initiate);
|
||||||
|
|
||||||
|
SendEventNewLeader(newGuildMaster, oldGuildMaster, isSelfPromote);
|
||||||
|
|
||||||
|
DB.Characters.CommitTransaction(trans);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleSetBankTabInfo(WorldSession session, byte tabId, string name, string icon)
|
public void HandleSetBankTabInfo(WorldSession session, byte tabId, string name, string icon)
|
||||||
@@ -2581,6 +2596,13 @@ namespace Game.Guilds
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float GetInactiveDays()
|
||||||
|
{
|
||||||
|
if (IsOnline())
|
||||||
|
return 0.0f;
|
||||||
|
return (float)((Time.UnixTime - (long)GetLogoutTime()) / (float)Time.Day);
|
||||||
|
}
|
||||||
|
|
||||||
// Decreases amount of slots left for today.
|
// Decreases amount of slots left for today.
|
||||||
public void UpdateBankTabWithdrawValue(SQLTransaction trans, byte tabId, uint amount)
|
public void UpdateBankTabWithdrawValue(SQLTransaction trans, byte tabId, uint amount)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -440,12 +440,20 @@ namespace Game
|
|||||||
guild.HandleNewsSetSticky(this, (uint)packet.NewsID, packet.Sticky);
|
guild.HandleNewsSetSticky(this, (uint)packet.NewsID, packet.Sticky);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[WorldPacketHandler(ClientOpcodes.GuildReplaceGuildMaster)]
|
||||||
|
void HandleGuildReplaceGuildMaster(GuildReplaceGuildMaster replaceGuildMaster)
|
||||||
|
{
|
||||||
|
Guild guild = GetPlayer().GetGuild();
|
||||||
|
if (guild)
|
||||||
|
guild.HandleSetNewGuildMaster(this, "", true);
|
||||||
|
}
|
||||||
|
|
||||||
[WorldPacketHandler(ClientOpcodes.GuildSetGuildMaster)]
|
[WorldPacketHandler(ClientOpcodes.GuildSetGuildMaster)]
|
||||||
void HandleGuildSetGuildMaster(GuildSetGuildMaster packet)
|
void HandleGuildSetGuildMaster(GuildSetGuildMaster packet)
|
||||||
{
|
{
|
||||||
Guild guild = GetPlayer().GetGuild();
|
Guild guild = GetPlayer().GetGuild();
|
||||||
if (guild)
|
if (guild)
|
||||||
guild.HandleSetNewGuildMaster(this, packet.NewMasterName);
|
guild.HandleSetNewGuildMaster(this, packet.NewMasterName, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[WorldPacketHandler(ClientOpcodes.GuildSetAchievementTracking)]
|
[WorldPacketHandler(ClientOpcodes.GuildSetAchievementTracking)]
|
||||||
|
|||||||
@@ -534,7 +534,7 @@ namespace Game
|
|||||||
|
|
||||||
LootItem item = slotid >= loot.items.Count ? loot.quest_items[slotid - loot.items.Count] : loot.items[slotid];
|
LootItem item = slotid >= loot.items.Count ? loot.quest_items[slotid - loot.items.Count] : loot.items[slotid];
|
||||||
|
|
||||||
List<ItemPosCount> dest = new List<ItemPosCount>(); ;
|
List<ItemPosCount> dest = new List<ItemPosCount>();
|
||||||
InventoryResult msg = target.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, item.itemid, item.count);
|
InventoryResult msg = target.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, item.itemid, item.count);
|
||||||
if (item.follow_loot_rules && !item.AllowedForPlayer(target))
|
if (item.follow_loot_rules && !item.AllowedForPlayer(target))
|
||||||
msg = InventoryResult.CantEquipEver;
|
msg = InventoryResult.CantEquipEver;
|
||||||
|
|||||||
@@ -1000,7 +1000,7 @@ namespace Game.Network.Packets
|
|||||||
|
|
||||||
public override void Read()
|
public override void Read()
|
||||||
{
|
{
|
||||||
Player = _worldPacket.ReadPackedGuid(); ;
|
Player = _worldPacket.ReadPackedGuid();
|
||||||
|
|
||||||
byte[] stringLengths = new byte[SharedConst.MaxDeclinedNameCases];
|
byte[] stringLengths = new byte[SharedConst.MaxDeclinedNameCases];
|
||||||
|
|
||||||
|
|||||||
@@ -438,16 +438,16 @@ namespace Game.Network.Packets
|
|||||||
public override void Write()
|
public override void Write()
|
||||||
{
|
{
|
||||||
_worldPacket.WriteBit(SelfPromoted);
|
_worldPacket.WriteBit(SelfPromoted);
|
||||||
_worldPacket.WriteBits(NewLeaderName.GetByteCount(), 6);
|
|
||||||
_worldPacket.WriteBits(OldLeaderName.GetByteCount(), 6);
|
_worldPacket.WriteBits(OldLeaderName.GetByteCount(), 6);
|
||||||
|
_worldPacket.WriteBits(NewLeaderName.GetByteCount(), 6);
|
||||||
|
|
||||||
_worldPacket.WritePackedGuid(OldLeaderGUID);
|
_worldPacket.WritePackedGuid(OldLeaderGUID);
|
||||||
_worldPacket.WriteUInt32(OldLeaderVirtualRealmAddress);
|
_worldPacket.WriteUInt32(OldLeaderVirtualRealmAddress);
|
||||||
_worldPacket.WritePackedGuid(NewLeaderGUID);
|
_worldPacket.WritePackedGuid(NewLeaderGUID);
|
||||||
_worldPacket.WriteUInt32(NewLeaderVirtualRealmAddress);
|
_worldPacket.WriteUInt32(NewLeaderVirtualRealmAddress);
|
||||||
|
|
||||||
_worldPacket.WriteString(NewLeaderName);
|
|
||||||
_worldPacket.WriteString(OldLeaderName);
|
_worldPacket.WriteString(OldLeaderName);
|
||||||
|
_worldPacket.WriteString(NewLeaderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObjectGuid NewLeaderGUID;
|
public ObjectGuid NewLeaderGUID;
|
||||||
@@ -981,7 +981,7 @@ namespace Game.Network.Packets
|
|||||||
|
|
||||||
public override void Write()
|
public override void Write()
|
||||||
{
|
{
|
||||||
_worldPacket .WriteInt64( RemainingWithdrawMoney);
|
_worldPacket.WriteInt64(RemainingWithdrawMoney);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long RemainingWithdrawMoney;
|
public long RemainingWithdrawMoney;
|
||||||
@@ -1023,7 +1023,7 @@ namespace Game.Network.Packets
|
|||||||
{
|
{
|
||||||
_worldPacket.WriteUInt32(tab.TabIndex);
|
_worldPacket.WriteUInt32(tab.TabIndex);
|
||||||
_worldPacket.WriteBits(tab.Name.GetByteCount(), 7);
|
_worldPacket.WriteBits(tab.Name.GetByteCount(), 7);
|
||||||
_worldPacket.WriteBits(tab.Icon.GetByteCount(), 9);;
|
_worldPacket.WriteBits(tab.Icon.GetByteCount(), 9);
|
||||||
|
|
||||||
_worldPacket.WriteString(tab.Name);
|
_worldPacket.WriteString(tab.Name);
|
||||||
_worldPacket.WriteString(tab.Icon);
|
_worldPacket.WriteString(tab.Icon);
|
||||||
@@ -1245,6 +1245,13 @@ namespace Game.Network.Packets
|
|||||||
public bool Sticky;
|
public bool Sticky;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class GuildReplaceGuildMaster : ClientPacket
|
||||||
|
{
|
||||||
|
public GuildReplaceGuildMaster(WorldPacket packet) : base(packet) { }
|
||||||
|
|
||||||
|
public override void Read() { }
|
||||||
|
}
|
||||||
|
|
||||||
public class GuildSetGuildMaster : ClientPacket
|
public class GuildSetGuildMaster : ClientPacket
|
||||||
{
|
{
|
||||||
public GuildSetGuildMaster(WorldPacket packet) : base(packet) { }
|
public GuildSetGuildMaster(WorldPacket packet) : base(packet) { }
|
||||||
|
|||||||
@@ -724,7 +724,7 @@ namespace Game.Network.Packets
|
|||||||
public void Read(WorldPacket data)
|
public void Read(WorldPacket data)
|
||||||
{
|
{
|
||||||
Context = data.ReadUInt8();
|
Context = data.ReadUInt8();
|
||||||
uint bonusListIdSize = data.ReadUInt32(); ;
|
uint bonusListIdSize = data.ReadUInt32();
|
||||||
|
|
||||||
BonusListIDs = new List<uint>();
|
BonusListIDs = new List<uint>();
|
||||||
for (uint i = 0u; i < bonusListIdSize; ++i)
|
for (uint i = 0u; i < bonusListIdSize; ++i)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace Game.Network.Packets
|
|||||||
public override void Read()
|
public override void Read()
|
||||||
{
|
{
|
||||||
Data.Read(_worldPacket);
|
Data.Read(_worldPacket);
|
||||||
VehicleRecID = _worldPacket.ReadInt32(); ;
|
VehicleRecID = _worldPacket.ReadInt32();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MovementAck Data;
|
public MovementAck Data;
|
||||||
|
|||||||
Reference in New Issue
Block a user