Some refactoring of code. and some cleanups

This commit is contained in:
hondacrx
2019-09-21 12:11:16 -04:00
parent 7c405230cc
commit 35c06c09fd
214 changed files with 1235 additions and 1341 deletions
+12 -12
View File
@@ -25,6 +25,17 @@ namespace Game.Entities
{
public class CinematicManager : IDisposable
{
// Remote location information
Player player;
public uint m_cinematicDiff;
public uint m_lastCinematicCheck;
public uint m_activeCinematicCameraId;
public uint m_cinematicLength;
List<FlyByCamera> m_cinematicCamera;
Position m_remoteSightPosition;
TempSummon m_CinematicObject;
public CinematicManager(Player playerref)
{
player = playerref;
@@ -67,7 +78,7 @@ namespace Game.Entities
m_CinematicObject = player.SummonCreature(1, pos.posX, pos.posY, pos.posZ, 0.0f, TempSummonType.TimedDespawn, 5 * Time.Minute * Time.InMilliseconds);
if (m_CinematicObject)
{
m_CinematicObject.setActive(true);
m_CinematicObject.SetActive(true);
player.SetViewpoint(m_CinematicObject, true);
}
@@ -177,16 +188,5 @@ namespace Game.Entities
uint GetActiveCinematicCamera() { return m_activeCinematicCameraId; }
public void SetActiveCinematicCamera(uint cinematicCameraId = 0) { m_activeCinematicCameraId = cinematicCameraId; }
public bool IsOnCinematic() { return (m_cinematicCamera != null); }
// Remote location information
Player player;
public uint m_cinematicDiff;
public uint m_lastCinematicCheck;
public uint m_activeCinematicCameraId;
public uint m_cinematicLength;
List<FlyByCamera> m_cinematicCamera;
Position m_remoteSightPosition;
TempSummon m_CinematicObject;
}
}
@@ -22,11 +22,22 @@ using Game.Network.Packets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections;
namespace Game.Entities
{
public class CollectionMgr
{
static Dictionary<uint, uint> FactionSpecificMounts = new Dictionary<uint, uint>();
WorldSession _owner;
Dictionary<uint, ToyFlags> _toys = new Dictionary<uint, ToyFlags>();
Dictionary<uint, HeirloomData> _heirlooms = new Dictionary<uint, HeirloomData>();
Dictionary<uint, MountStatusFlags> _mounts = new Dictionary<uint, MountStatusFlags>();
BitSet _appearances;
MultiMap<uint, ObjectGuid> _temporaryAppearances = new MultiMap<uint, ObjectGuid>();
Dictionary<uint, FavoriteAppearanceState> _favoriteAppearances = new Dictionary<uint, FavoriteAppearanceState>();
public static void LoadMountDefinitions()
{
uint oldMSTime = Time.GetMSTime();
@@ -64,7 +75,7 @@ namespace Game.Entities
public CollectionMgr(WorldSession owner)
{
_owner = owner;
_appearances = new System.Collections.BitSet(0);
_appearances = new BitSet(0);
}
public void LoadToys()
@@ -483,7 +494,7 @@ namespace Game.Entities
} while (knownAppearances.NextRow());
_appearances = new System.Collections.BitSet(blocks);
_appearances = new BitSet(blocks);
}
if (!favoriteAppearances.IsEmpty())
@@ -664,7 +675,7 @@ namespace Game.Entities
return false;
}
if (itemTemplate.GetInventoryType() != InventoryType.Cloak)
if (!Convert.ToBoolean(PlayerClassByArmorSubclass[itemTemplate.GetSubClass()] & _owner.GetPlayer().getClassMask()))
if (!Convert.ToBoolean(PlayerClassByArmorSubclass[itemTemplate.GetSubClass()] & _owner.GetPlayer().GetClassMask()))
return false;
break;
}
@@ -857,17 +868,6 @@ namespace Game.Entities
public Dictionary<uint, ToyFlags> GetAccountToys() { return _toys; }
public Dictionary<uint, HeirloomData> GetAccountHeirlooms() { return _heirlooms; }
public Dictionary<uint, MountStatusFlags> GetAccountMounts() { return _mounts; }
WorldSession _owner;
Dictionary<uint, ToyFlags> _toys = new Dictionary<uint, ToyFlags>();
Dictionary<uint, HeirloomData> _heirlooms = new Dictionary<uint, HeirloomData>();
Dictionary<uint, MountStatusFlags> _mounts = new Dictionary<uint, MountStatusFlags>();
System.Collections.BitSet _appearances;
MultiMap<uint, ObjectGuid> _temporaryAppearances = new MultiMap<uint, ObjectGuid>();
Dictionary<uint, FavoriteAppearanceState> _favoriteAppearances = new Dictionary<uint, FavoriteAppearanceState>();
static Dictionary<uint, uint> FactionSpecificMounts = new Dictionary<uint, uint>();
}
enum FavoriteAppearanceState
@@ -879,13 +879,13 @@ namespace Game.Entities
public class HeirloomData
{
public HeirloomPlayerFlags flags;
public uint bonusId;
public HeirloomData(HeirloomPlayerFlags _flags = 0, uint _bonusId = 0)
{
flags = _flags;
bonusId = _bonusId;
}
public HeirloomPlayerFlags flags;
public uint bonusId;
}
}
+18 -18
View File
@@ -26,6 +26,19 @@ namespace Game.Entities
{
public class KillRewarder
{
Player _killer;
Unit _victim;
Group _group;
float _groupRate;
Player _maxNotGrayMember;
uint _count;
uint _sumLevel;
uint _xp;
bool _isFullXP;
byte _maxLevel;
bool _isBattleground;
bool _isPvP;
public KillRewarder(Player killer, Unit victim, bool isBattleground)
{
_killer = killer;
@@ -106,7 +119,7 @@ namespace Game.Entities
{
if (_killer == member || (member.IsAtGroupRewardDistance(_victim) && member.IsAlive()))
{
uint lvl = member.getLevel();
uint lvl = member.GetLevel();
// 2.1. _count - number of alive group members within reward distance;
++_count;
// 2.2. _sumLevel - sum of levels of alive group members within reward distance;
@@ -117,14 +130,14 @@ namespace Game.Entities
// 2.4. _maxNotGrayMember - maximum level of alive group member within reward distance,
// for whom victim is not gray;
uint grayLevel = Formulas.GetGrayLevel(lvl);
if (_victim.GetLevelForTarget(member) > grayLevel && (!_maxNotGrayMember || _maxNotGrayMember.getLevel() < lvl))
if (_victim.GetLevelForTarget(member) > grayLevel && (!_maxNotGrayMember || _maxNotGrayMember.GetLevel() < lvl))
_maxNotGrayMember = member;
}
}
}
// 2.5. _isFullXP - flag identifying that for all group members victim is not gray,
// so 100% XP will be rewarded (50% otherwise).
_isFullXP = _maxNotGrayMember && (_maxLevel == _maxNotGrayMember.getLevel());
_isFullXP = _maxNotGrayMember && (_maxLevel == _maxNotGrayMember.GetLevel());
}
else
_count = 1;
@@ -157,7 +170,7 @@ namespace Game.Entities
// * set to 0 if player's level is more than maximum level of not gray member;
// * cut XP in half if _isFullXP is false.
if (_maxNotGrayMember != null && player.IsAlive() &&
_maxNotGrayMember.getLevel() >= player.getLevel())
_maxNotGrayMember.GetLevel() >= player.GetLevel())
xp = _isFullXP ?
(uint)(xp * rate) : // Reward FULL XP if all group members are not gray.
(uint)(xp * rate / 2) + 1; // Reward only HALF of XP if some of group members are gray.
@@ -215,7 +228,7 @@ namespace Game.Entities
// Give reputation and kill credit only in PvE.
if (!_isPvP || _isBattleground)
{
float rate = _group ? _groupRate * player.getLevel() / _sumLevel : 1.0f;
float rate = _group ? _groupRate * player.GetLevel() / _sumLevel : 1.0f;
if (_xp != 0)
// 4.2. Give XP.
_RewardXP(player, rate);
@@ -265,18 +278,5 @@ namespace Game.Entities
}
}
}
Player _killer;
Unit _victim;
Group _group;
float _groupRate;
Player _maxNotGrayMember;
uint _count;
uint _sumLevel;
uint _xp;
bool _isFullXP;
byte _maxLevel;
bool _isBattleground;
bool _isPvP;
}
}
+1 -1
View File
@@ -94,7 +94,7 @@ namespace Game.Entities
float GetRatingMultiplier(CombatRating cr)
{
GtCombatRatingsRecord Rating = CliDB.CombatRatingsGameTable.GetRow(getLevel());
GtCombatRatingsRecord Rating = CliDB.CombatRatingsGameTable.GetRow(GetLevel());
if (Rating == null)
return 1.0f;
+5 -5
View File
@@ -813,7 +813,7 @@ namespace Game.Entities
{
ItemTemplate rewardProto = Global.ObjectMgr.GetItemTemplate(questPackageItem.ItemID);
if (rewardProto != null)
if (rewardProto.ItemSpecClassMask.HasAnyFlag(getClassMask()))
if (rewardProto.ItemSpecClassMask.HasAnyFlag(GetClassMask()))
GetSession().GetCollectionMgr().AddItemAppearance(questPackageItem.ItemID);
}
}
@@ -2085,7 +2085,7 @@ namespace Game.Entities
void _SaveStats(SQLTransaction trans)
{
// check if stat saving is enabled and if char level is high enough
if (WorldConfig.GetIntValue(WorldCfg.MinLevelStatSave) == 0 || getLevel() < WorldConfig.GetIntValue(WorldCfg.MinLevelStatSave))
if (WorldConfig.GetIntValue(WorldCfg.MinLevelStatSave) == 0 || GetLevel() < WorldConfig.GetIntValue(WorldCfg.MinLevelStatSave))
return;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_STATS);
@@ -2886,7 +2886,7 @@ namespace Game.Entities
InitTalentForLevel();
LearnDefaultSkills();
LearnCustomSpells();
if (getLevel() < PlayerConst.LevelMinHonor)
if (GetLevel() < PlayerConst.LevelMinHonor)
ResetPvpTalents();
// must be before inventory (some items required reputation check)
@@ -3107,7 +3107,7 @@ namespace Game.Entities
stmt.AddValue(index++, (byte)GetRace());
stmt.AddValue(index++, (byte)GetClass());
stmt.AddValue(index++, (byte)m_playerData.NativeSex); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect
stmt.AddValue(index++, getLevel());
stmt.AddValue(index++, GetLevel());
stmt.AddValue(index++, (uint)m_activePlayerData.XP);
stmt.AddValue(index++, GetMoney());
stmt.AddValue(index++, (byte)m_playerData.SkinID);
@@ -3238,7 +3238,7 @@ namespace Game.Entities
stmt.AddValue(index++, (byte)GetRace());
stmt.AddValue(index++, (byte)GetClass());
stmt.AddValue(index++, (byte)m_playerData.NativeSex); // save gender from PLAYER_BYTES_3, UNIT_BYTES_0 changes with every transform effect
stmt.AddValue(index++, getLevel());
stmt.AddValue(index++, GetLevel());
stmt.AddValue(index++, (uint)m_activePlayerData.XP);
stmt.AddValue(index++, GetMoney());
stmt.AddValue(index++, (byte)m_playerData.SkinID);
+1 -1
View File
@@ -212,7 +212,7 @@ namespace Game.Entities
PlayerExtraFlags m_ExtraFlags;
public bool isDebugAreaTriggers { get; set; }
public bool IsDebugAreaTriggers { get; set; }
uint m_zoneUpdateId;
uint m_areaUpdateId;
uint m_zoneUpdateTimer;
+4 -4
View File
@@ -49,7 +49,7 @@ namespace Game.Entities
return nearMembers[randTarget];
}
public PartyResult CanUninviteFromGroup(ObjectGuid guidMember = default(ObjectGuid))
public PartyResult CanUninviteFromGroup(ObjectGuid guidMember = default)
{
Group grp = GetGroup();
if (!grp)
@@ -99,12 +99,12 @@ namespace Game.Entities
return PartyResult.Ok;
}
public bool isUsingLfg()
public bool IsUsingLfg()
{
return Global.LFGMgr.GetState(GetGUID()) != LfgState.None;
}
bool inRandomLfgDungeon()
bool InRandomLfgDungeon()
{
if (Global.LFGMgr.selectedRandomLfgDungeon(GetGUID()))
{
@@ -263,7 +263,7 @@ namespace Game.Entities
}
public void RemoveFromGroup(RemoveMethod method = RemoveMethod.Default) { RemoveFromGroup(GetGroup(), GetGUID(), method); }
public static void RemoveFromGroup(Group group, ObjectGuid guid, RemoveMethod method = RemoveMethod.Default, ObjectGuid kicker = default(ObjectGuid), string reason = null)
public static void RemoveFromGroup(Group group, ObjectGuid guid, RemoveMethod method = RemoveMethod.Default, ObjectGuid kicker = default, string reason = null)
{
if (!group)
return;
+22 -22
View File
@@ -1284,7 +1284,7 @@ namespace Game.Entities
item = StoreItem(pos, item, update);
item.SetFixedLevel(getLevel());
item.SetFixedLevel(GetLevel());
item.SetItemRandomBonusList(randomPropertyId);
if (allowedLooters != null && allowedLooters.Count > 1 && item.GetTemplate().GetMaxStackSize() == 1 && item.IsSoulBound())
@@ -1412,7 +1412,7 @@ namespace Game.Entities
if (pItem.IsBindedNotWith(this))
return InventoryResult.NotOwner;
if (getLevel() < pItem.GetRequiredLevel())
if (GetLevel() < pItem.GetRequiredLevel())
return InventoryResult.CantEquipLevelI;
InventoryResult res = CanUseItem(pProto);
@@ -1468,7 +1468,7 @@ namespace Game.Entities
if (Convert.ToBoolean(proto.GetFlags2() & ItemFlags2.FactionAlliance) && GetTeam() != Team.Alliance)
return InventoryResult.CantEquipEver;
if ((proto.GetAllowableClass() & getClassMask()) == 0 || (proto.GetAllowableRace() & (long)getRaceMask()) == 0)
if ((proto.GetAllowableClass() & GetClassMask()) == 0 || (proto.GetAllowableRace() & (long)GetRaceMask()) == 0)
return InventoryResult.CantEquipEver;
if (proto.GetRequiredSkill() != 0)
@@ -1482,7 +1482,7 @@ namespace Game.Entities
if (proto.GetRequiredSpell() != 0 && !HasSpell(proto.GetRequiredSpell()))
return InventoryResult.ProficiencyNeeded;
if (getLevel() < proto.GetBaseRequiredLevel())
if (GetLevel() < proto.GetBaseRequiredLevel())
return InventoryResult.CantEquipLevelI;
// If World Event is not active, prevent using event dependant items
@@ -3321,7 +3321,7 @@ namespace Game.Entities
return InventoryResult.ItemNotFound;
// Used by group, function GroupLoot, to know if a prototype can be used by a player
if ((proto.GetAllowableClass() & getClassMask()) == 0 || (proto.GetAllowableRace() & (long)getRaceMask()) == 0)
if ((proto.GetAllowableClass() & GetClassMask()) == 0 || (proto.GetAllowableRace() & (long)GetRaceMask()) == 0)
return InventoryResult.CantEquipEver;
if (proto.GetRequiredSpell() != 0 && !HasSpell(proto.GetRequiredSpell()))
@@ -3344,7 +3344,7 @@ namespace Game.Entities
{
if (_class == Class.Warrior || _class == Class.Paladin || _class == Class.Deathknight)
{
if (getLevel() < 40)
if (GetLevel() < 40)
{
if (proto.GetSubClass() != (uint)ItemSubClassArmor.Mail)
return InventoryResult.ClientLockedOut;
@@ -3354,7 +3354,7 @@ namespace Game.Entities
}
else if (_class == Class.Hunter || _class == Class.Shaman)
{
if (getLevel() < 40)
if (GetLevel() < 40)
{
if (proto.GetSubClass() != (uint)ItemSubClassArmor.Leather)
return InventoryResult.ClientLockedOut;
@@ -3605,7 +3605,7 @@ namespace Game.Entities
return false;
}
if (!Convert.ToBoolean(pProto.GetAllowableClass() & getClassMask()) && pProto.GetBonding() == ItemBondingType.OnAcquire && !IsGameMaster())
if (!Convert.ToBoolean(pProto.GetAllowableClass() & GetClassMask()) && pProto.GetBonding() == ItemBondingType.OnAcquire && !IsGameMaster())
{
SendBuyError(BuyResult.CantFindItem, null, item);
return false;
@@ -4251,7 +4251,7 @@ namespace Game.Entities
if (spellproto == null)
continue;
if (spellproto.HasAura(GetMap().GetDifficultyID(), AuraType.ModXpPct) && !GetSession().GetCollectionMgr().CanApplyHeirloomXpBonus(item.GetEntry(), getLevel())
if (spellproto.HasAura(GetMap().GetDifficultyID(), AuraType.ModXpPct) && !GetSession().GetCollectionMgr().CanApplyHeirloomXpBonus(item.GetEntry(), GetLevel())
&& Global.DB2Mgr.GetHeirloomByItemId(item.GetEntry()) != null)
continue;
@@ -4520,7 +4520,7 @@ namespace Game.Entities
need_space = count;
ItemPosCount newPosition = new ItemPosCount((ushort)(InventorySlots.Bag0 << 8 | j), need_space);
if (!newPosition.isContainedIn(dest))
if (!newPosition.IsContainedIn(dest))
{
dest.Add(newPosition);
count -= need_space;
@@ -4598,7 +4598,7 @@ namespace Game.Entities
need_space = count;
ItemPosCount newPosition = new ItemPosCount((ushort)(bag << 8 | slot), need_space);
if (!newPosition.isContainedIn(dest))
if (!newPosition.IsContainedIn(dest))
{
dest.Add(newPosition);
count -= need_space;
@@ -4938,7 +4938,7 @@ namespace Game.Entities
need_space = count;
ItemPosCount newPosition = new ItemPosCount((ushort)(bag << 8 | j), need_space);
if (!newPosition.isContainedIn(dest))
if (!newPosition.IsContainedIn(dest))
{
dest.Add(newPosition);
count -= need_space;
@@ -5151,7 +5151,7 @@ namespace Game.Entities
ScalingStatDistributionRecord ssd = CliDB.ScalingStatDistributionStorage.LookupByKey(pItem.GetScalingStatDistribution());
// check allowed level (extend range to upper values if MaxLevel more or equal max player level, this let GM set high level with 1...max range items)
if (ssd != null && ssd.MaxLevel < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel) && ssd.MaxLevel < getLevel() && Global.DB2Mgr.GetHeirloomByItemId(pProto.GetId()) == null)
if (ssd != null && ssd.MaxLevel < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel) && ssd.MaxLevel < GetLevel() && Global.DB2Mgr.GetHeirloomByItemId(pProto.GetId()) == null)
return InventoryResult.NotEquippable;
byte eslot = FindEquipSlot(pProto, slot, swap);
@@ -6190,7 +6190,7 @@ namespace Game.Entities
// We store the level of our player in the gold field
// We retrieve this information at Player.SendLoot()
bones.loot.gold = getLevel();
bones.loot.gold = GetLevel();
bones.lootRecipient = looterPlr;
looterPlr.SendLoot(bones.GetGUID(), LootType.Insignia);
}
@@ -6225,7 +6225,7 @@ namespace Game.Entities
// not check distance for GO in case owned GO (fishing bobber case, for example)
// And permit out of range GO with no owner in case fishing hole
if (!go || (loot_type != LootType.Fishinghole && ((loot_type != LootType.Fishing && loot_type != LootType.FishingJunk) || go.GetOwnerGUID() != GetGUID())
&& !go.IsWithinDistInMap(this, SharedConst.InteractionDistance)) || (loot_type == LootType.Corpse && go.GetRespawnTime() != 0 && go.isSpawnedByDefault()))
&& !go.IsWithinDistInMap(this, SharedConst.InteractionDistance)) || (loot_type == LootType.Corpse && go.GetRespawnTime() != 0 && go.IsSpawnedByDefault()))
{
SendLootRelease(guid);
return;
@@ -6235,10 +6235,10 @@ namespace Game.Entities
// loot was generated and respawntime has passed since then, allow to recreate loot
// to avoid bugs, this rule covers spawned gameobjects only
if (go.isSpawnedByDefault() && go.getLootState() == LootState.Activated && !go.loot.isLooted() && go.GetLootGenerationTime() + go.GetRespawnDelay() < Time.UnixTime)
if (go.IsSpawnedByDefault() && go.GetLootState() == LootState.Activated && !go.loot.isLooted() && go.GetLootGenerationTime() + go.GetRespawnDelay() < Time.UnixTime)
go.SetLootState(LootState.Ready);
if (go.getLootState() == LootState.Ready)
if (go.GetLootState() == LootState.Ready)
{
uint lootid = go.GetGoInfo().GetLootId();
Battleground bg = GetBattleground();
@@ -6278,9 +6278,9 @@ namespace Game.Entities
}
if (loot_type == LootType.Fishing)
go.getFishLoot(loot, this);
go.GetFishLoot(loot, this);
else if (loot_type == LootType.FishingJunk)
go.getFishLootJunk(loot, this);
go.GetFishLootJunk(loot, this);
if (go.GetGoInfo().type == GameObjectTypes.Chest && go.GetGoInfo().Chest.usegrouplootrules != 0)
{
@@ -6305,7 +6305,7 @@ namespace Game.Entities
go.SetLootState(LootState.Activated, this);
}
if (go.getLootState() == LootState.Activated)
if (go.GetLootState() == LootState.Activated)
{
Group group = GetGroup();
if (group)
@@ -6442,8 +6442,8 @@ namespace Game.Entities
loot.FillLoot(lootid, LootStorage.Pickpocketing, this, true);
// Generate extra money for pick pocket loot
uint a = RandomHelper.URand(0, creature.getLevel() / 2);
uint b = RandomHelper.URand(0, getLevel() / 2);
uint a = RandomHelper.URand(0, creature.GetLevel() / 2);
uint b = RandomHelper.URand(0, GetLevel() / 2);
loot.gold = (uint)(10 * (a + b) * WorldConfig.GetFloatValue(WorldCfg.RateDropMoney));
permission = PermissionTypes.Owner;
}
+2 -2
View File
@@ -456,9 +456,9 @@ namespace Game.Entities
if (!WorldConfig.GetBoolValue(WorldCfg.InstanceIgnoreLevel))
{
if (ar.levelMin != 0 && getLevel() < ar.levelMin)
if (ar.levelMin != 0 && GetLevel() < ar.levelMin)
LevelMin = ar.levelMin;
if (ar.levelMax != 0 && getLevel() > ar.levelMax)
if (ar.levelMax != 0 && GetLevel() > ar.levelMax)
LevelMax = ar.levelMax;
}
+7 -7
View File
@@ -103,7 +103,7 @@ namespace Game.Entities
if (GetTeam() == plrVictim.GetTeam() && !Global.WorldMgr.IsFFAPvPRealm())
return false;
byte k_level = (byte)getLevel();
byte k_level = (byte)GetLevel();
byte k_grey = (byte)Formulas.GetGrayLevel(k_level);
byte v_level = (byte)victim.GetLevelForTarget(this);
@@ -263,7 +263,7 @@ namespace Game.Entities
uint newHonorXP = currentHonorXP + xp;
uint honorLevel = GetHonorLevel();
if (xp < 1 || getLevel() < PlayerConst.LevelMinHonor || IsMaxHonorLevel())
if (xp < 1 || GetLevel() < PlayerConst.LevelMinHonor || IsMaxHonorLevel())
return;
while (newHonorXP >= nextHonorLevelXP)
@@ -340,10 +340,10 @@ namespace Game.Entities
if (talentInfo.SpecID != GetPrimarySpecialization())
return TalentLearnResult.FailedUnknown;
if (talentInfo.LevelRequired > getLevel())
if (talentInfo.LevelRequired > GetLevel())
return TalentLearnResult.FailedUnknown;
if (Global.DB2Mgr.GetRequiredLevelForPvpTalentSlot(slot, GetClass()) > getLevel())
if (Global.DB2Mgr.GetRequiredLevelForPvpTalentSlot(slot, GetClass()) > GetLevel())
return TalentLearnResult.FailedUnknown;
PvpTalentCategoryRecord talentCategory = CliDB.PvpTalentCategoryStorage.LookupByKey(talentInfo.PvpTalentCategoryID);
@@ -654,7 +654,7 @@ namespace Game.Entities
// BUG: sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet
// Note: Mount, stealth and invisibility will be removed when used
return (!isTotalImmune() && // Damage immune
return (!IsTotalImmune() && // Damage immune
!HasAura(BattlegroundConst.SpellRecentlyDroppedFlag) && // Still has recently held flag debuff
IsAlive()); // Alive
}
@@ -669,7 +669,7 @@ namespace Game.Entities
public void SetBattlegroundEntryPoint()
{
// Taxi path store
if (!m_taxi.empty())
if (!m_taxi.Empty())
{
m_bgData.mountSpell = 0;
m_bgData.taxiPath[0] = m_taxi.GetTaxiSource();
@@ -830,7 +830,7 @@ namespace Game.Entities
return false;
// limit check leel to dbc compatible level range
uint level = getLevel();
uint level = GetLevel();
if (level > WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
level = WorldConfig.GetUIntValue(WorldCfg.MaxPlayerLevel);
+19 -19
View File
@@ -41,8 +41,8 @@ namespace Game.Entities
void AddTimedQuest(uint questId) { m_timedquests.Add(questId); }
public void RemoveTimedQuest(uint questId) { m_timedquests.Remove(questId); }
public List<uint> getRewardedQuests() { return m_RewardedQuests; }
Dictionary<uint, QuestStatusData> getQuestStatusMap() { return m_QuestStatus; }
public List<uint> GetRewardedQuests() { return m_RewardedQuests; }
Dictionary<uint, QuestStatusData> GetQuestStatusMap() { return m_QuestStatus; }
public int GetQuestMinLevel(Quest quest)
{
@@ -65,7 +65,7 @@ namespace Game.Entities
{
int minLevel = GetQuestMinLevel(quest);
int maxLevel = quest.MaxScalingLevel;
int level = (int)getLevel();
int level = (int)GetLevel();
if (level >= minLevel)
return Math.Min(level, maxLevel);
return minLevel;
@@ -325,7 +325,7 @@ namespace Game.Entities
// @todo verify if check for !quest.IsDaily() is really correct (possibly not)
else
{
if (!source.hasQuest(questId) && !source.hasInvolvedQuest(questId))
if (!source.HasQuest(questId) && !source.HasInvolvedQuest(questId))
{
PlayerTalkClass.SendCloseGossip();
return;
@@ -410,7 +410,7 @@ namespace Game.Entities
SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) &&
SatisfyQuestMonth(quest, false) && SatisfyQuestSeasonal(quest, false))
{
return getLevel() + WorldConfig.GetIntValue(WorldCfg.QuestHighLevelHideDiff) >= GetQuestMinLevel(quest);
return GetLevel() + WorldConfig.GetIntValue(WorldCfg.QuestHighLevelHideDiff) >= GetQuestMinLevel(quest);
}
return false;
@@ -778,7 +778,7 @@ namespace Game.Entities
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.SourceSpellID);
Unit caster = this;
if (questGiver != null && questGiver.isTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnAccept) && !spellInfo.HasTargetType(Targets.UnitCaster) && !spellInfo.HasTargetType(Targets.DestCasterSummon))
if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnAccept) && !spellInfo.HasTargetType(Targets.UnitCaster) && !spellInfo.HasTargetType(Targets.DestCasterSummon))
{
Unit unit = questGiver.ToUnit();
if (unit != null)
@@ -867,7 +867,7 @@ namespace Game.Entities
case QuestPackageFilter.LootSpecialization:
return rewardProto.IsUsableByLootSpecialization(this, true);
case QuestPackageFilter.Class:
return rewardProto.ItemSpecClassMask == 0 || (rewardProto.ItemSpecClassMask & getClassMask()) != 0;
return rewardProto.ItemSpecClassMask == 0 || (rewardProto.ItemSpecClassMask & GetClassMask()) != 0;
case QuestPackageFilter.Everyone:
return true;
default:
@@ -1017,7 +1017,7 @@ namespace Game.Entities
uint XP = GetQuestXPReward(quest);
int moneyRew = 0;
if (getLevel() < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
if (GetLevel() < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
GiveXP(XP, null);
else
moneyRew = (int)(quest.GetRewMoneyMaxLevel() * WorldConfig.GetFloatValue(WorldCfg.RateDropMoney));
@@ -1033,7 +1033,7 @@ namespace Game.Entities
}
// honor reward
uint honor = quest.CalculateHonorGain(getLevel());
uint honor = quest.CalculateHonorGain(GetLevel());
if (honor != 0)
RewardHonor(null, 0, (int)honor);
@@ -1091,7 +1091,7 @@ namespace Game.Entities
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardSpell);
Unit caster = this;
if (questGiver != null && questGiver.isTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster))
if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster))
{
Unit unit = questGiver.ToUnit();
if (unit != null)
@@ -1108,7 +1108,7 @@ namespace Game.Entities
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(quest.RewardDisplaySpell[i]);
Unit caster = this;
if (questGiver != null && questGiver.isTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster))
if (questGiver != null && questGiver.IsTypeMask(TypeMask.Unit) && !quest.HasFlag(QuestFlags.PlayerCastOnComplete) && !spellInfo.HasTargetType(Targets.UnitCaster))
{
Unit unit = questGiver.ToUnit();
if (unit != null)
@@ -1263,7 +1263,7 @@ namespace Game.Entities
public bool SatisfyQuestLevel(Quest qInfo, bool msg)
{
if (getLevel() < GetQuestMinLevel(qInfo))
if (GetLevel() < GetQuestMinLevel(qInfo))
{
if (msg)
{
@@ -1273,7 +1273,7 @@ namespace Game.Entities
return false;
}
if (qInfo.MaxLevel > 0 && getLevel() > qInfo.MaxLevel)
if (qInfo.MaxLevel > 0 && GetLevel() > qInfo.MaxLevel)
{
if (msg)
{
@@ -1392,7 +1392,7 @@ namespace Game.Entities
if (reqClass == 0)
return true;
if ((reqClass & getClassMask()) == 0)
if ((reqClass & GetClassMask()) == 0)
{
if (msg)
{
@@ -1412,7 +1412,7 @@ namespace Game.Entities
if (reqraces == -1)
return true;
if ((reqraces & (long)getRaceMask()) == 0)
if ((reqraces & (long)GetRaceMask()) == 0)
{
if (msg)
{
@@ -1909,7 +1909,7 @@ namespace Game.Entities
{
if (SatisfyQuestLevel(quest, false))
{
if (getLevel() <= (GetQuestLevel(quest) + WorldConfig.GetIntValue(WorldCfg.QuestLowLevelHideDiff)))
if (GetLevel() <= (GetQuestLevel(quest) + WorldConfig.GetIntValue(WorldCfg.QuestLowLevelHideDiff)))
{
if (quest.IsDaily())
result2 = QuestGiverStatus.AvailableRep;
@@ -2189,7 +2189,7 @@ namespace Game.Entities
KilledMonsterCredit(cInfo.KillCredit[i]);
}
public void KilledMonsterCredit(uint entry, ObjectGuid guid = default(ObjectGuid))
public void KilledMonsterCredit(uint entry, ObjectGuid guid = default)
{
ushort addKillCount = 1;
uint real_entry = entry;
@@ -2287,7 +2287,7 @@ namespace Game.Entities
}
}
public void KillCreditGO(uint entry, ObjectGuid guid = default(ObjectGuid))
public void KillCreditGO(uint entry, ObjectGuid guid = default)
{
ushort addCastCount = 1;
for (byte i = 0; i < SharedConst.MaxQuestLogSize; ++i)
@@ -2747,7 +2747,7 @@ namespace Game.Entities
uint moneyReward;
if (getLevel() < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
if (GetLevel() < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
{
moneyReward = GetQuestMoneyReward(quest);
}
+18 -18
View File
@@ -342,7 +342,7 @@ namespace Game.Entities
{
SpecializationSpellsRecord specSpell = specSpells[j];
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(specSpell.SpellID);
if (spellInfo == null || spellInfo.SpellLevel > getLevel())
if (spellInfo == null || spellInfo.SpellLevel > GetLevel())
continue;
LearnSpell(specSpell.SpellID, false);
@@ -568,7 +568,7 @@ namespace Game.Entities
if (!ignore_condition && pEnchant.ConditionID != 0 && !EnchantmentFitsRequirements(pEnchant.ConditionID, -1))
return;
if (pEnchant.MinLevel > getLevel())
if (pEnchant.MinLevel > GetLevel())
return;
if (pEnchant.RequiredSkillID > 0 && pEnchant.RequiredSkillRank > GetSkillValue((SkillType)pEnchant.RequiredSkillID))
@@ -640,12 +640,12 @@ namespace Game.Entities
scalingClass = pEnchant.ScalingClassRestricted;
uint minLevel = ((uint)(pEnchant.Flags)).HasAnyFlag(0x20u) ? 1 : 60u;
uint scalingLevel = getLevel();
uint scalingLevel = GetLevel();
byte maxLevel = (byte)(pEnchant.MaxLevel != 0 ? pEnchant.MaxLevel : CliDB.SpellScalingGameTable.GetTableRowCount() - 1);
if (minLevel > getLevel())
if (minLevel > GetLevel())
scalingLevel = minLevel;
else if (maxLevel < getLevel())
else if (maxLevel < GetLevel())
scalingLevel = maxLevel;
GtSpellScalingRecord spellScaling = CliDB.SpellScalingGameTable.GetRow(scalingLevel);
@@ -665,12 +665,12 @@ namespace Game.Entities
scalingClass = pEnchant.ScalingClassRestricted;
uint minLevel = ((uint)(pEnchant.Flags)).HasAnyFlag(0x20u) ? 1 : 60u;
uint scalingLevel = getLevel();
uint scalingLevel = GetLevel();
byte maxLevel = (byte)(pEnchant.MaxLevel != 0 ? pEnchant.MaxLevel : CliDB.SpellScalingGameTable.GetTableRowCount() - 1);
if (minLevel > getLevel())
if (minLevel > GetLevel())
scalingLevel = minLevel;
else if (maxLevel < getLevel())
else if (maxLevel < GetLevel())
scalingLevel = maxLevel;
GtSpellScalingRecord spellScaling = CliDB.SpellScalingGameTable.GetRow(scalingLevel);
@@ -911,7 +911,7 @@ namespace Game.Entities
WorldObject target = GetViewpoint();
if (target)
{
if (target.isTypeMask(TypeMask.Unit))
if (target.IsTypeMask(TypeMask.Unit))
{
((Unit)target).RemoveAurasByType(AuraType.BindSight, GetGUID());
((Unit)target).RemoveAurasByType(AuraType.ModPossess, GetGUID());
@@ -1610,8 +1610,8 @@ namespace Game.Entities
void LearnSkillRewardedSpells(uint skillId, uint skillValue)
{
ulong raceMask = getRaceMask();
uint classMask = getClassMask();
ulong raceMask = GetRaceMask();
uint classMask = GetClassMask();
List<SkillLineAbilityRecord> skillLineAbilities = Global.DB2Mgr.GetSkillLineAbilitiesBySkill(skillId);
foreach (var ability in skillLineAbilities)
@@ -1639,7 +1639,7 @@ namespace Game.Entities
continue;
// check level, skip class spells if not high enough
if (getLevel() < spellInfo.SpellLevel)
if (GetLevel() < spellInfo.SpellLevel)
continue;
// need unlearn spell
@@ -1932,7 +1932,7 @@ namespace Game.Entities
if (HasSkill((SkillType)rcInfo.SkillID))
continue;
if (rcInfo.MinLevel > getLevel())
if (rcInfo.MinLevel > GetLevel())
continue;
LearnDefaultSkill(rcInfo);
@@ -1954,7 +1954,7 @@ namespace Game.Entities
if (rcInfo.Flags.HasAnyFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
skillValue = maxValue;
else if (GetClass() == Class.Deathknight)
skillValue = (ushort)Math.Min(Math.Max(1, (getLevel() - 1) * 5), maxValue);
skillValue = (ushort)Math.Min(Math.Max(1, (GetLevel() - 1) * 5), maxValue);
else if (skillId == SkillType.FistWeapons)
skillValue = Math.Max((ushort)1, GetSkillValue(SkillType.Unarmed));
@@ -1972,7 +1972,7 @@ namespace Game.Entities
if (rcInfo.Flags.HasAnyFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
skillValue = maxValue;
else if (GetClass() == Class.Deathknight)
skillValue = (ushort)Math.Min(Math.Max(1, (getLevel() - 1) * 5), maxValue);
skillValue = (ushort)Math.Min(Math.Max(1, (GetLevel() - 1) * 5), maxValue);
SetSkill(skillId, 1, skillValue, maxValue);
break;
@@ -3291,7 +3291,7 @@ namespace Game.Entities
}
// not allow proc extra attack spell at extra attack
if (m_extraAttacks != 0 && spellInfo.HasEffect(SpellEffectName.AddExtraAttacks))
if (ExtraAttacks != 0 && spellInfo.HasEffect(SpellEffectName.AddExtraAttacks))
return;
float chance = spellInfo.ProcChance;
@@ -3404,9 +3404,9 @@ namespace Game.Entities
{
// normalized proc chance for weapon attack speed
// (odd formula...)
if (isAttackReady(WeaponAttackType.BaseAttack))
if (IsAttackReady(WeaponAttackType.BaseAttack))
return (GetBaseAttackTime(WeaponAttackType.BaseAttack) * 1.8f / 1000.0f);
else if (haveOffhandWeapon() && isAttackReady(WeaponAttackType.OffAttack))
else if (HaveOffhandWeapon() && IsAttackReady(WeaponAttackType.OffAttack))
return (GetBaseAttackTime(WeaponAttackType.OffAttack) * 1.6f / 1000.0f);
return 0;
}
@@ -28,7 +28,7 @@ namespace Game.Entities
{
public void InitTalentForLevel()
{
uint level = getLevel();
uint level = GetLevel();
// talents base at level diff (talents = level - 9 but some can be used already)
if (level < PlayerConst.MinSpecializationLevel)
ResetTalentSpecialization();
+105 -112
View File
@@ -45,8 +45,8 @@ namespace Game.Entities
{
public Player(WorldSession session) : base(true)
{
objectTypeMask |= TypeMask.Player;
objectTypeId = TypeId.Player;
ObjectTypeMask |= TypeMask.Player;
ObjectTypeId = TypeId.Player;
m_playerData = new PlayerData();
m_activePlayerData = new ActivePlayerData();
@@ -536,11 +536,11 @@ namespace Game.Entities
// default combat reach 10
// TODO add weapon, skill check
if (isAttackReady(WeaponAttackType.BaseAttack))
if (IsAttackReady(WeaponAttackType.BaseAttack))
{
if (!IsWithinMeleeRange(victim))
{
setAttackTimer(WeaponAttackType.BaseAttack, 100);
SetAttackTimer(WeaponAttackType.BaseAttack, 100);
if (m_swingErrorMsg != 1) // send single time (client auto repeat)
{
SendAttackSwingNotInRange();
@@ -550,7 +550,7 @@ namespace Game.Entities
//120 degrees of radiant range, if player is not in boundary radius
else if (!IsWithinBoundaryRadius(victim) && !HasInArc(2 * MathFunctions.PI / 3, victim))
{
setAttackTimer(WeaponAttackType.BaseAttack, 100);
SetAttackTimer(WeaponAttackType.BaseAttack, 100);
if (m_swingErrorMsg != 2) // send single time (client auto repeat)
{
SendAttackSwingBadFacingAttack();
@@ -562,31 +562,31 @@ namespace Game.Entities
m_swingErrorMsg = 0; // reset swing error state
// prevent base and off attack in same time, delay attack at 0.2 sec
if (haveOffhandWeapon())
if (getAttackTimer(WeaponAttackType.OffAttack) < SharedConst.AttackDisplayDelay)
setAttackTimer(WeaponAttackType.OffAttack, SharedConst.AttackDisplayDelay);
if (HaveOffhandWeapon())
if (GetAttackTimer(WeaponAttackType.OffAttack) < SharedConst.AttackDisplayDelay)
SetAttackTimer(WeaponAttackType.OffAttack, SharedConst.AttackDisplayDelay);
// do attack
AttackerStateUpdate(victim, WeaponAttackType.BaseAttack);
resetAttackTimer(WeaponAttackType.BaseAttack);
ResetAttackTimer(WeaponAttackType.BaseAttack);
}
}
if (!IsInFeralForm() && haveOffhandWeapon() && isAttackReady(WeaponAttackType.OffAttack))
if (!IsInFeralForm() && HaveOffhandWeapon() && IsAttackReady(WeaponAttackType.OffAttack))
{
if (!IsWithinMeleeRange(victim))
setAttackTimer(WeaponAttackType.OffAttack, 100);
SetAttackTimer(WeaponAttackType.OffAttack, 100);
else if (!IsWithinBoundaryRadius(victim) && !HasInArc(2 * MathFunctions.PI / 3, victim))
setAttackTimer(WeaponAttackType.BaseAttack, 100);
SetAttackTimer(WeaponAttackType.BaseAttack, 100);
else
{
// prevent base and off attack in same time, delay attack at 0.2 sec
if (getAttackTimer(WeaponAttackType.BaseAttack) < SharedConst.AttackDisplayDelay)
setAttackTimer(WeaponAttackType.BaseAttack, SharedConst.AttackDisplayDelay);
if (GetAttackTimer(WeaponAttackType.BaseAttack) < SharedConst.AttackDisplayDelay)
SetAttackTimer(WeaponAttackType.BaseAttack, SharedConst.AttackDisplayDelay);
// do attack
AttackerStateUpdate(victim, WeaponAttackType.OffAttack);
resetAttackTimer(WeaponAttackType.OffAttack);
ResetAttackTimer(WeaponAttackType.OffAttack);
}
}
}
@@ -643,7 +643,7 @@ namespace Game.Entities
if (IsAlive())
{
m_regenTimer += diff;
RegenTimer += diff;
RegenerateAll();
}
@@ -722,7 +722,7 @@ namespace Game.Entities
SendUpdateToOutOfRangeGroupMembers();
Pet pet = GetPet();
if (pet != null && !pet.IsWithinDistInMap(this, GetMap().GetVisibilityRange()) && !pet.isPossessed())
if (pet != null && !pet.IsWithinDistInMap(this, GetMap().GetVisibilityRange()) && !pet.IsPossessed())
RemovePet(pet, PetSaveMode.NotInSlot, true);
if (IsAlive())
@@ -731,7 +731,7 @@ namespace Game.Entities
{
m_hostileReferenceCheckTimer = 15 * Time.InMilliseconds;
if (!GetMap().IsDungeon())
getHostileRefManager().deleteReferencesOutOfRange(GetVisibilityRange());
GetHostileRefManager().deleteReferencesOutOfRange(GetVisibilityRange());
}
else
m_hostileReferenceCheckTimer -= diff;
@@ -743,7 +743,7 @@ namespace Game.Entities
TeleportTo(teleportDest, m_teleport_options);
}
public override void setDeathState(DeathState s)
public override void SetDeathState(DeathState s)
{
bool oldIsAlive = IsAlive();
@@ -775,7 +775,7 @@ namespace Game.Entities
ResetCriteria(CriteriaTypes.GetKillingBlows, (uint)CriteriaCondition.NoDeath);
}
base.setDeathState(s);
base.SetDeathState(s);
if (IsAlive() && !oldIsAlive)
//clear aura case after resurrection by another way (spells will be applied before next death)
@@ -1001,7 +1001,7 @@ namespace Game.Entities
public void SetInvSlot(uint slot, ObjectGuid guid) { SetUpdateFieldValue(ref m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.InvSlots, (int)slot), guid); }
//Taxi
public void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(GetRace(), GetClass(), getLevel()); }
public void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(GetRace(), GetClass(), GetLevel()); }
//Cheat Commands
public bool GetCommandStatus(PlayerCommandStates command) { return (_activeCheats & command) != 0; }
@@ -1031,7 +1031,7 @@ namespace Game.Entities
if (!pet)
return;
if (m_temporaryUnsummonedPetNumber == 0 && pet.isControlled() && !pet.isTemporarySummoned())
if (m_temporaryUnsummonedPetNumber == 0 && pet.IsControlled() && !pet.IsTemporarySummoned())
{
m_temporaryUnsummonedPetNumber = pet.GetCharmInfo().GetPetNumber();
m_oldpetspell = pet.m_unitData.CreatedBySpell;
@@ -1528,7 +1528,7 @@ namespace Game.Entities
break;
}
if (rate != 1.0f && creatureOrQuestLevel < Formulas.GetGrayLevel(getLevel()))
if (rate != 1.0f && creatureOrQuestLevel < Formulas.GetGrayLevel(GetLevel()))
percent *= rate;
if (percent <= 0.0f)
@@ -1958,7 +1958,7 @@ namespace Game.Entities
// remove auras that need water/land
RemoveAurasWithInterruptFlags((apply ? SpellAuraInterruptFlags.NotAbovewater : SpellAuraInterruptFlags.NotUnderwater));
getHostileRefManager().updateThreatTables();
GetHostileRefManager().updateThreatTables();
}
public void ValidateMovementInfo(MovementInfo mi)
{
@@ -2177,7 +2177,7 @@ namespace Game.Entities
}
//GM
public bool isAcceptWhispers() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.AcceptWhispers); }
public bool IsAcceptWhispers() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.AcceptWhispers); }
public void SetAcceptWhispers(bool on)
{
if (on)
@@ -2200,13 +2200,13 @@ namespace Game.Entities
if (pet != null)
{
pet.SetFaction(35);
pet.getHostileRefManager().setOnlineOfflineState(false);
pet.GetHostileRefManager().setOnlineOfflineState(false);
}
RemovePvpFlag(UnitPVPStateFlags.FFAPvp);
ResetContestedPvP();
getHostileRefManager().setOnlineOfflineState(false);
GetHostileRefManager().setOnlineOfflineState(false);
CombatStopWithPets();
PhasingHandler.SetAlwaysVisible(GetPhaseShift(), true);
@@ -2225,7 +2225,7 @@ namespace Game.Entities
if (pet != null)
{
pet.SetFaction(GetFaction());
pet.getHostileRefManager().setOnlineOfflineState(true);
pet.GetHostileRefManager().setOnlineOfflineState(true);
}
// restore FFA PvP Server state
@@ -2235,13 +2235,13 @@ namespace Game.Entities
// restore FFA PvP area state, remove not allowed for GM mounts
UpdateArea(m_areaUpdateId);
getHostileRefManager().setOnlineOfflineState(true);
GetHostileRefManager().setOnlineOfflineState(true);
m_serverSideVisibilityDetect.SetValue(ServerSideVisibilityType.GM, AccountTypes.Player);
}
UpdateObjectVisibility();
}
public bool isGMChat() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.GMChat); }
public bool IsGMChat() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.GMChat); }
public void SetGMChat(bool on)
{
if (on)
@@ -2249,7 +2249,7 @@ namespace Game.Entities
else
m_ExtraFlags &= ~PlayerExtraFlags.GMChat;
}
public bool isTaxiCheater() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.TaxiCheat); }
public bool IsTaxiCheater() { return m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.TaxiCheat); }
public void SetTaxiCheater(bool on)
{
if (on)
@@ -2257,7 +2257,7 @@ namespace Game.Entities
else
m_ExtraFlags &= ~PlayerExtraFlags.TaxiCheat;
}
public bool isGMVisible() { return !m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.GMInvisible); }
public bool IsGMVisible() { return !m_ExtraFlags.HasAnyFlag(PlayerExtraFlags.GMInvisible); }
public void SetGMVisible(bool on)
{
if (on)
@@ -2347,7 +2347,7 @@ namespace Game.Entities
return;
break;
case GossipOption.Battlefield:
if (!creature.isCanInteractWithBattleMaster(this, false))
if (!creature.CanInteractWithBattleMaster(this, false))
canTalk = false;
break;
case GossipOption.Stablepet:
@@ -3506,7 +3506,7 @@ namespace Game.Entities
(newCustomDisplay[2] == null || (newCustomDisplay[2].Data == customDisplay[2])))
return 0;
GtBarberShopCostBaseRecord bsc = CliDB.BarberShopCostBaseGameTable.GetRow(getLevel());
GtBarberShopCostBaseRecord bsc = CliDB.BarberShopCostBaseGameTable.GetRow(GetLevel());
if (bsc == null) // shouldn't happen
return 0xFFFFFFFF;
@@ -3535,7 +3535,7 @@ namespace Game.Entities
uint GetChampioningFaction() { return m_ChampioningFaction; }
public void SetChampioningFaction(uint faction) { m_ChampioningFaction = faction; }
public void setFactionForRace(Race race)
public void SetFactionForRace(Race race)
{
m_team = TeamForRace(race);
@@ -3643,7 +3643,7 @@ namespace Game.Entities
SendPacket(packet);
}
public bool isAllowedToLoot(Creature creature)
public bool IsAllowedToLoot(Creature creature)
{
if (!creature.IsDead() || !creature.IsDamageEnoughForLootingAndReward())
return false;
@@ -3706,7 +3706,7 @@ namespace Game.Entities
void RegenerateAll()
{
m_regenTimerCount += m_regenTimer;
m_regenTimerCount += RegenTimer;
for (PowerType power = PowerType.Mana; power < PowerType.Max; power++)// = power + 1)
if (power != PowerType.Runes)
@@ -3721,9 +3721,9 @@ namespace Game.Entities
{
byte runeToRegen = m_runes.CooldownOrder[regenIndex];
uint runeCooldown = GetRuneCooldown(runeToRegen);
if (runeCooldown > m_regenTimer)
if (runeCooldown > RegenTimer)
{
SetRuneCooldown(runeToRegen, runeCooldown - m_regenTimer);
SetRuneCooldown(runeToRegen, runeCooldown - RegenTimer);
++regenIndex;
}
else
@@ -3742,7 +3742,7 @@ namespace Game.Entities
m_regenTimerCount -= 2000;
}
m_regenTimer = 0;
RegenTimer = 0;
}
void Regenerate(PowerType power)
{
@@ -3769,10 +3769,10 @@ namespace Game.Entities
if (powerType.RegenInterruptTimeMS != 0 && Time.GetMSTimeDiffToNow(m_combatExitTime) < powerType.RegenInterruptTimeMS)
return;
addvalue = (powerType.RegenPeace + m_unitData.PowerRegenFlatModifier[(int)powerIndex]) * 0.001f * m_regenTimer;
addvalue = (powerType.RegenPeace + m_unitData.PowerRegenFlatModifier[(int)powerIndex]) * 0.001f * RegenTimer;
}
else
addvalue = (powerType.RegenCombat + m_unitData.PowerRegenInterruptedFlatModifier[(int)powerIndex]) * 0.001f * m_regenTimer;
addvalue = (powerType.RegenCombat + m_unitData.PowerRegenInterruptedFlatModifier[(int)powerIndex]) * 0.001f * RegenTimer;
WorldCfg[] RatesForPower =
{
@@ -3804,7 +3804,7 @@ namespace Game.Entities
if (power != PowerType.Mana)
{
addvalue *= GetTotalAuraMultiplierByMiscValue(AuraType.ModPowerRegenPercent, (int)power);
addvalue += GetTotalAuraModifierByMiscValue(AuraType.ModPowerRegen, (int)power) * ((power != PowerType.Energy) ? m_regenTimerCount : m_regenTimer) / (5 * Time.InMilliseconds);
addvalue += GetTotalAuraModifierByMiscValue(AuraType.ModPowerRegen, (int)power) * ((power != PowerType.Energy) ? m_regenTimerCount : RegenTimer) / (5 * Time.InMilliseconds);
}
int minPower = powerType.MinPower;
@@ -3898,8 +3898,8 @@ namespace Game.Entities
addValue = HealthIncreaseRate;
if (!IsInCombat())
{
if (getLevel() < 15)
addValue = (0.20f * (GetMaxHealth()) / getLevel() * HealthIncreaseRate);
if (GetLevel() < 15)
addValue = (0.20f * (GetMaxHealth()) / GetLevel() * HealthIncreaseRate);
else
addValue = 0.015f * (GetMaxHealth()) * HealthIncreaseRate;
@@ -4116,7 +4116,7 @@ namespace Game.Entities
bool IsImmuneToEnvironmentalDamage()
{
// check for GM and death state included in isAttackableByAOE
return (!isTargetableForAttack(false));
return (!IsTargetableForAttack(false));
}
public uint EnvironmentalDamage(EnviromentalDamage type, uint damage)
{
@@ -4168,7 +4168,7 @@ namespace Game.Entities
return final_damage;
}
bool isTotalImmune()
bool IsTotalImmune()
{
var immune = GetAuraEffectsByType(AuraType.SchoolImmunity);
@@ -4273,7 +4273,7 @@ namespace Game.Entities
public bool IsMirrorTimerActive(MirrorTimerType type)
{
return m_MirrorTimer[(int)type] == getMaxTimer(type);
return m_MirrorTimer[(int)type] == GetMaxTimer(type);
}
void HandleDrowning(uint time_diff)
@@ -4291,7 +4291,7 @@ namespace Game.Entities
// Breath timer not activated - activate it
if (m_MirrorTimer[breathTimer] == -1)
{
m_MirrorTimer[breathTimer] = getMaxTimer(MirrorTimerType.Breath);
m_MirrorTimer[breathTimer] = GetMaxTimer(MirrorTimerType.Breath);
SendMirrorTimer(MirrorTimerType.Breath, m_MirrorTimer[breathTimer], m_MirrorTimer[breathTimer], -1);
}
else // If activated - do tick
@@ -4303,16 +4303,16 @@ namespace Game.Entities
m_MirrorTimer[breathTimer] += 1 * Time.InMilliseconds;
// Calculate and deal damage
// @todo Check this formula
uint damage = (uint)(GetMaxHealth() / 5 + RandomHelper.URand(0, getLevel() - 1));
uint damage = (uint)(GetMaxHealth() / 5 + RandomHelper.URand(0, GetLevel() - 1));
EnvironmentalDamage(EnviromentalDamage.Drowning, damage);
}
else if (!m_MirrorTimerFlagsLast.HasAnyFlag(PlayerUnderwaterState.InWater)) // Update time in client if need
SendMirrorTimer(MirrorTimerType.Breath, getMaxTimer(MirrorTimerType.Breath), m_MirrorTimer[breathTimer], -1);
SendMirrorTimer(MirrorTimerType.Breath, GetMaxTimer(MirrorTimerType.Breath), m_MirrorTimer[breathTimer], -1);
}
}
else if (m_MirrorTimer[breathTimer] != -1) // Regen timer
{
int UnderWaterTime = getMaxTimer(MirrorTimerType.Breath);
int UnderWaterTime = GetMaxTimer(MirrorTimerType.Breath);
// Need breath regen
m_MirrorTimer[breathTimer] += (int)(10 * time_diff);
if (m_MirrorTimer[breathTimer] >= UnderWaterTime || !IsAlive())
@@ -4327,7 +4327,7 @@ namespace Game.Entities
// Fatigue timer not activated - activate it
if (m_MirrorTimer[fatigueTimer] == -1)
{
m_MirrorTimer[fatigueTimer] = getMaxTimer(MirrorTimerType.Fatigue);
m_MirrorTimer[fatigueTimer] = GetMaxTimer(MirrorTimerType.Fatigue);
SendMirrorTimer(MirrorTimerType.Fatigue, m_MirrorTimer[fatigueTimer], m_MirrorTimer[fatigueTimer], -1);
}
else
@@ -4339,19 +4339,19 @@ namespace Game.Entities
m_MirrorTimer[fatigueTimer] += 1 * Time.InMilliseconds;
if (IsAlive()) // Calculate and deal damage
{
uint damage = (uint)(GetMaxHealth() / 5 + RandomHelper.URand(0, getLevel() - 1));
uint damage = (uint)(GetMaxHealth() / 5 + RandomHelper.URand(0, GetLevel() - 1));
EnvironmentalDamage(EnviromentalDamage.Exhausted, damage);
}
else if (HasPlayerFlag(PlayerFlags.Ghost)) // Teleport ghost to graveyard
RepopAtGraveyard();
}
else if (!m_MirrorTimerFlagsLast.HasAnyFlag(PlayerUnderwaterState.InDarkWater))
SendMirrorTimer(MirrorTimerType.Fatigue, getMaxTimer(MirrorTimerType.Fatigue), m_MirrorTimer[fatigueTimer], -1);
SendMirrorTimer(MirrorTimerType.Fatigue, GetMaxTimer(MirrorTimerType.Fatigue), m_MirrorTimer[fatigueTimer], -1);
}
}
else if (m_MirrorTimer[fatigueTimer] != -1) // Regen timer
{
int DarkWaterTime = getMaxTimer(MirrorTimerType.Fatigue);
int DarkWaterTime = GetMaxTimer(MirrorTimerType.Fatigue);
m_MirrorTimer[fatigueTimer] += (int)(10 * time_diff);
if (m_MirrorTimer[fatigueTimer] >= DarkWaterTime || !IsAlive())
StopMirrorTimer(MirrorTimerType.Fatigue);
@@ -4363,7 +4363,7 @@ namespace Game.Entities
{
// Breath timer not activated - activate it
if (m_MirrorTimer[fireTimer] == -1)
m_MirrorTimer[fireTimer] = getMaxTimer(MirrorTimerType.Fire);
m_MirrorTimer[fireTimer] = GetMaxTimer(MirrorTimerType.Fire);
else
{
m_MirrorTimer[fireTimer] -= (int)time_diff;
@@ -4425,7 +4425,7 @@ namespace Game.Entities
SendPacket(new StopMirrorTimer(Type));
}
int getMaxTimer(MirrorTimerType timer)
int GetMaxTimer(MirrorTimerType timer)
{
switch (timer)
{
@@ -4476,7 +4476,7 @@ namespace Game.Entities
if (GetSession().IsARecruiter() || (GetSession().GetRecruiterId() != 0))
AddDynamicFlag(UnitDynFlags.ReferAFriend);
setDeathState(DeathState.Alive);
SetDeathState(DeathState.Alive);
// add the flag to make sure opcode is always sent
AddUnitMovementFlag(MovementFlag.WaterWalk);
@@ -4525,15 +4525,15 @@ namespace Game.Entities
//Characters level 20 and up suffer from ten minutes of sickness.
int startLevel = WorldConfig.GetIntValue(WorldCfg.DeathSicknessLevel);
if (getLevel() >= startLevel)
if (GetLevel() >= startLevel)
{
// set resurrection sickness
CastSpell(this, 15007, true);
// not full duration
if (getLevel() < startLevel + 9)
if (GetLevel() < startLevel + 9)
{
int delta = (int)(getLevel() - startLevel + 1) * Time.Minute;
int delta = (int)(GetLevel() - startLevel + 1) * Time.Minute;
Aura aur = GetAura(15007, GetGUID());
if (aur != null)
aur.SetDuration(delta * Time.InMilliseconds);
@@ -4551,7 +4551,7 @@ namespace Game.Entities
StopMirrorTimers(); //disable timers(bars)
setDeathState(DeathState.Corpse);
SetDeathState(DeathState.Corpse);
SetDynamicFlags(UnitDynFlags.None);
if (!CliDB.MapStorage.LookupByKey(GetMapId()).Instanceable() && !HasAuraType(AuraType.PreventResurrection))
@@ -4847,7 +4847,7 @@ namespace Game.Entities
pet.SetFaction(GetFaction());
pet.SetNpcFlags(NPCFlags.None);
pet.SetNpcFlags2(NPCFlags2.None);
pet.InitStatsForLevel(getLevel());
pet.InitStatsForLevel(GetLevel());
SetMinion(pet, true);
@@ -4954,7 +4954,7 @@ namespace Game.Entities
pet.AddObjectToRemoveList();
pet.m_removed = true;
if (pet.isControlled())
if (pet.IsControlled())
{
SendPacket(new PetSpells());
@@ -5149,10 +5149,10 @@ namespace Game.Entities
}
// Used in triggers for check "Only to targets that grant experience or honor" req
public bool isHonorOrXPTarget(Unit victim)
public bool IsHonorOrXPTarget(Unit victim)
{
uint v_level = victim.GetLevelForTarget(this);
uint k_grey = Formulas.GetGrayLevel(getLevel());
uint k_grey = Formulas.GetGrayLevel(GetLevel());
// Victim level less gray level
if (v_level < k_grey)
@@ -5167,8 +5167,8 @@ namespace Game.Entities
return true;
}
public void setRegenTimerCount(uint time) { m_regenTimerCount = time; }
void setWeaponChangeTimer(uint time) { m_weaponChangeTimer = time; }
public void SetRegenTimerCount(uint time) { m_regenTimerCount = time; }
void SetWeaponChangeTimer(uint time) { m_weaponChangeTimer = time; }
//Team
public static Team TeamForRace(Race race)
@@ -5257,13 +5257,6 @@ namespace Game.Entities
DB.Characters.Execute(stmt);
}
}
void SetFactionForRace(Race race)
{
m_team = TeamForRace(race);
var rEntry = CliDB.ChrRacesStorage.LookupByKey(race);
SetFaction(rEntry.FactionID);
}
//Guild
public void SetInGuild(ulong guildId)
@@ -5301,7 +5294,7 @@ namespace Game.Entities
public void SetFreePrimaryProfessions(uint profs) { SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.CharacterPoints), profs); }
public void GiveLevel(uint level)
{
var oldLevel = getLevel();
var oldLevel = GetLevel();
if (level == oldLevel)
return;
@@ -5384,7 +5377,7 @@ namespace Game.Entities
if (pet)
pet.SynchronizeLevelWithOwner();
MailLevelReward mailReward = Global.ObjectMgr.GetMailLevelReward(level, (uint)getRaceMask());
MailLevelReward mailReward = Global.ObjectMgr.GetMailLevelReward(level, (uint)GetRaceMask());
if (mailReward != null)
{
//- TODO: Poor design of mail system
@@ -5423,33 +5416,33 @@ namespace Game.Entities
public void ToggleAFK()
{
if (isAFK())
if (IsAFK())
RemovePlayerFlag(PlayerFlags.AFK);
else
AddPlayerFlag(PlayerFlags.AFK);
// afk player not allowed in Battleground
if (!IsGameMaster() && isAFK() && InBattleground() && !InArena())
if (!IsGameMaster() && IsAFK() && InBattleground() && !InArena())
LeaveBattleground();
}
public void ToggleDND()
{
if (isDND())
if (IsDND())
RemovePlayerFlag(PlayerFlags.DND);
else
AddPlayerFlag(PlayerFlags.DND);
}
public bool isAFK() { return HasPlayerFlag(PlayerFlags.AFK); }
public bool isDND() { return HasPlayerFlag(PlayerFlags.DND); }
public bool IsAFK() { return HasPlayerFlag(PlayerFlags.AFK); }
public bool IsDND() { return HasPlayerFlag(PlayerFlags.DND); }
public ChatFlags GetChatFlags()
{
ChatFlags tag = ChatFlags.None;
if (isGMChat())
if (IsGMChat())
tag |= ChatFlags.GM;
if (isDND())
if (IsDND())
tag |= ChatFlags.DND;
if (isAFK())
if (IsAFK())
tag |= ChatFlags.AFK;
if (HasPlayerFlag(PlayerFlags.Developer))
tag |= ChatFlags.Dev;
@@ -5823,12 +5816,12 @@ namespace Game.Entities
_RemoveAllStatBonuses();
uint basemana;
Global.ObjectMgr.GetPlayerClassLevelInfo(GetClass(), getLevel(), out basemana);
Global.ObjectMgr.GetPlayerClassLevelInfo(GetClass(), GetLevel(), out basemana);
PlayerLevelInfo info = Global.ObjectMgr.GetPlayerLevelInfo(GetRace(), GetClass(), getLevel());
PlayerLevelInfo info = Global.ObjectMgr.GetPlayerLevelInfo(GetRace(), GetClass(), GetLevel());
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.MaxLevel), WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel));
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.NextLevelXP), Global.ObjectMgr.GetXPForLevel(getLevel()));
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.NextLevelXP), Global.ObjectMgr.GetXPForLevel(GetLevel()));
// reset before any aura state sources (health set/aura apply)
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.AuraState), 0u);
@@ -6052,7 +6045,7 @@ namespace Game.Entities
// target aura duration for caster show only if target exist at caster client
// send data at target visibility change (adding to client)
if (target.isTypeMask(TypeMask.Unit))
if (target.IsTypeMask(TypeMask.Unit))
SendInitialVisiblePackets(target.ToUnit());
}
}
@@ -6311,17 +6304,17 @@ namespace Game.Entities
if (areaEntry.ExplorationLevel > 0)
{
if (getLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
if (GetLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
{
SendExplorationExperience(areaId, 0);
}
else
{
int diff = (int)(getLevel() - areaEntry.ExplorationLevel);
int diff = (int)(GetLevel() - areaEntry.ExplorationLevel);
uint XP = 0;
if (diff < -5)
{
XP = (uint)(Global.ObjectMgr.GetBaseXP(getLevel() + 5) * WorldConfig.GetFloatValue(WorldCfg.RateXpExplore));
XP = (uint)(Global.ObjectMgr.GetBaseXP(GetLevel() + 5) * WorldConfig.GetFloatValue(WorldCfg.RateXpExplore));
}
else if (diff > 5)
{
@@ -6453,16 +6446,16 @@ namespace Game.Entities
data.Initialize(ChatMsg.WhisperInform, language, target, target, text);
SendPacket(data);
if (!isAcceptWhispers() && !IsGameMaster() && !target.IsGameMaster())
if (!IsAcceptWhispers() && !IsGameMaster() && !target.IsGameMaster())
{
SetAcceptWhispers(true);
SendSysMessage(CypherStrings.CommandWhisperon);
}
// announce afk or dnd message
if (target.isAFK())
if (target.IsAFK())
SendSysMessage(CypherStrings.PlayerAfk, target.GetName(), target.autoReplyMsg);
else if (target.isDND())
else if (target.IsDND())
SendSysMessage(CypherStrings.PlayerDnd, target.GetName(), target.autoReplyMsg);
}
@@ -6496,8 +6489,8 @@ namespace Game.Entities
m_lastFallZ = z;
}
public byte getCinematic() { return m_cinematic; }
public void setCinematic(byte cine) { m_cinematic = cine; }
public byte GetCinematic() { return m_cinematic; }
public void SetCinematic(byte cine) { m_cinematic = cine; }
public uint GetMovie() { return m_movie; }
public void SetMovie(uint movie) { m_movie = movie; }
@@ -6536,7 +6529,7 @@ namespace Game.Entities
int playerLevelDelta = 0;
// If XP < 50%, player should see scaling creature with -1 level except for level max
if (getLevel() < SharedConst.MaxLevel && xp < (m_activePlayerData.NextLevelXP / 2))
if (GetLevel() < SharedConst.MaxLevel && xp < (m_activePlayerData.NextLevelXP / 2))
playerLevelDelta = -1;
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ScalingPlayerLevelDelta), playerLevelDelta);
@@ -6553,10 +6546,10 @@ namespace Game.Entities
if (HasPlayerFlag(PlayerFlags.NoXPGain))
return;
if (victim != null && victim.IsTypeId(TypeId.Unit) && !victim.ToCreature().hasLootRecipient())
if (victim != null && victim.IsTypeId(TypeId.Unit) && !victim.ToCreature().HasLootRecipient())
return;
uint level = getLevel();
uint level = GetLevel();
Global.ScriptMgr.OnGivePlayerXP(this, xp, victim);
@@ -6593,7 +6586,7 @@ namespace Game.Entities
if (level < WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
GiveLevel(level + 1);
level = getLevel();
level = GetLevel();
nextLvlXP = m_activePlayerData.NextLevelXP;
}
@@ -6757,7 +6750,7 @@ namespace Game.Entities
if (GetDisplayId() != GetNativeDisplayId())
RestoreDisplayId(true);
if (IsDisallowedMountForm(getTransForm(), ShapeShiftForm.None, GetDisplayId()))
if (IsDisallowedMountForm(GetTransForm(), ShapeShiftForm.None, GetDisplayId()))
{
GetSession().SendActivateTaxiReply(ActivateTaxiReply.PlayerShapeshifted);
return false;
@@ -6931,7 +6924,7 @@ namespace Game.Entities
m_taxi.ClearTaxiDestinations(); // not destinations, clear source node
Dismount();
RemoveUnitFlag(UnitFlags.RemoveClientControl | UnitFlags.TaxiFlight);
getHostileRefManager().setOnlineOfflineState(true);
GetHostileRefManager().setOnlineOfflineState(true);
}
public void ContinueTaxiFlight()
@@ -6989,7 +6982,7 @@ namespace Game.Entities
public bool GetsRecruitAFriendBonus(bool forXP)
{
bool recruitAFriend = false;
if (getLevel() <= WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel) || !forXP)
if (GetLevel() <= WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel) || !forXP)
{
Group group = GetGroup();
if (group)
@@ -7006,12 +6999,12 @@ namespace Game.Entities
if (forXP)
{
// level must be allowed to get RaF bonus
if (player.getLevel() > WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel))
if (player.GetLevel() > WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevel))
continue;
// level difference must be small enough to get RaF bonus, UNLESS we are lower level
if (player.getLevel() < getLevel())
if (getLevel() - player.getLevel() > WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevelDifference))
if (player.GetLevel() < GetLevel())
if (GetLevel() - player.GetLevel() > WorldConfig.GetIntValue(WorldCfg.MaxRecruitAFriendBonusPlayerLevelDifference))
continue;
}
@@ -7109,8 +7102,8 @@ namespace Game.Entities
}
public bool IsSpellFitByClassAndRace(uint spell_id)
{
ulong racemask = getRaceMask();
uint classmask = getClassMask();
ulong racemask = GetRaceMask();
uint classmask = GetClassMask();
var bounds = Global.SpellMgr.GetSkillLineAbilityMapBounds(spell_id);
@@ -7202,7 +7195,7 @@ namespace Game.Entities
// farsight dynobj or puppet may be very far away
UpdateVisibilityOf(target);
if (target.isTypeMask(TypeMask.Unit) && target != GetVehicleBase())
if (target.IsTypeMask(TypeMask.Unit) && target != GetVehicleBase())
target.ToUnit().AddPlayerToVision(this);
SetSeer(target);
}
@@ -7218,7 +7211,7 @@ namespace Game.Entities
SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.FarsightObject), ObjectGuid.Empty);
if (target.isTypeMask(TypeMask.Unit) && target != GetVehicleBase())
if (target.IsTypeMask(TypeMask.Unit) && target != GetVehicleBase())
target.ToUnit().RemovePlayerFromVision(this);
//must immediately set seer back otherwise may crash
+5 -5
View File
@@ -27,6 +27,10 @@ namespace Game.Entities
{
public class PlayerTaxi
{
public byte[] m_taximask = new byte[PlayerConst.TaxiMaskSize];
List<uint> m_TaxiDestinations = new List<uint>();
uint m_flightMasterFactionId;
public void InitTaxiNodesForLevel(Race race, Class chrClass, uint level)
{
// class specific initial known nodes
@@ -261,10 +265,6 @@ namespace Game.Entities
return GetTaxiDestination();
}
public List<uint> GetPath() { return m_TaxiDestinations; }
public bool empty() { return m_TaxiDestinations.Empty(); }
public byte[] m_taximask = new byte[PlayerConst.TaxiMaskSize];
List<uint> m_TaxiDestinations = new List<uint>();
uint m_flightMasterFactionId;
public bool Empty() { return m_TaxiDestinations.Empty(); }
}
}
+8 -8
View File
@@ -4,6 +4,12 @@ namespace Game.Entities
{
public class RestMgr
{
Player _player;
long _restTime;
uint _innAreaTriggerId;
float[] _restBonus = new float[(int)RestTypes.Max];
RestFlag _restFlagMask;
public RestMgr(Player player)
{
_player = player;
@@ -18,7 +24,7 @@ namespace Game.Entities
{
case RestTypes.XP:
// Reset restBonus (XP only) for max level players
if (_player.getLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
if (_player.GetLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
restBonus = 0;
next_level_xp = _player.m_activePlayerData.NextLevelXP;
@@ -67,7 +73,7 @@ namespace Game.Entities
public void AddRestBonus(RestTypes restType, float restBonus)
{
// Don't add extra rest bonus to max level players. Note: Might need different condition in next expansion for honor XP (PLAYER_LEVEL_MIN_HONOR perhaps).
if (_player.getLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
if (_player.GetLevel() >= WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel))
restBonus = 0;
float totalRestBonus = GetRestBonus(restType) + restBonus;
@@ -153,11 +159,5 @@ namespace Game.Entities
public float GetRestBonus(RestTypes restType) { return _restBonus[(int)restType]; }
public bool HasRestFlag(RestFlag restFlag) { return (_restFlagMask & restFlag) != 0; }
public uint GetInnTriggerId() { return _innAreaTriggerId; }
Player _player;
long _restTime;
uint _innAreaTriggerId;
float[] _restBonus = new float[(int)RestTypes.Max];
RestFlag _restFlagMask;
}
}
+5 -5
View File
@@ -25,6 +25,11 @@ namespace Game.Entities
{
public class SceneMgr
{
Player _player;
Dictionary<uint, SceneTemplate> _scenesByInstance = new Dictionary<uint, SceneTemplate>();
uint _standaloneSceneInstanceID;
bool _isDebuggingScenes;
public SceneMgr(Player player)
{
_player = player;
@@ -237,10 +242,5 @@ namespace Game.Entities
public void ToggleDebugSceneMode() { _isDebuggingScenes = !_isDebuggingScenes; }
public bool IsInDebugSceneMode() { return _isDebuggingScenes; }
Player _player;
Dictionary<uint, SceneTemplate> _scenesByInstance = new Dictionary<uint, SceneTemplate>();
uint _standaloneSceneInstanceID;
bool _isDebuggingScenes;
}
}
+16 -16
View File
@@ -26,6 +26,8 @@ namespace Game.Entities
{
public class SocialManager : Singleton<SocialManager>
{
Dictionary<ObjectGuid, PlayerSocial> _socialMap = new Dictionary<ObjectGuid, PlayerSocial>();
SocialManager() { }
public const int FriendLimit = 50;
@@ -62,15 +64,15 @@ namespace Game.Entities
if (target.IsVisibleGloballyFor(player))
{
if (target.isDND())
if (target.IsDND())
friendInfo.Status = FriendStatus.DND;
else if (target.isAFK())
else if (target.IsAFK())
friendInfo.Status = FriendStatus.AFK;
else
friendInfo.Status = FriendStatus.Online;
friendInfo.Area = target.GetZoneId();
friendInfo.Level = target.getLevel();
friendInfo.Level = target.GetLevel();
friendInfo.Class = target.GetClass();
}
}
@@ -141,12 +143,13 @@ namespace Game.Entities
}
public void RemovePlayerSocial(ObjectGuid guid) { _socialMap.Remove(guid); }
Dictionary<ObjectGuid, PlayerSocial> _socialMap = new Dictionary<ObjectGuid, PlayerSocial>();
}
public class PlayerSocial
{
public Dictionary<ObjectGuid, FriendInfo> _playerSocialMap = new Dictionary<ObjectGuid, FriendInfo>();
ObjectGuid m_playerGUID;
uint GetNumberOfSocialsWithFlag(SocialFlag flag)
{
uint counter = 0;
@@ -277,13 +280,18 @@ namespace Game.Entities
ObjectGuid GetPlayerGUID() { return m_playerGUID; }
public void SetPlayerGUID(ObjectGuid guid) { m_playerGUID = guid; }
public Dictionary<ObjectGuid, FriendInfo> _playerSocialMap = new Dictionary<ObjectGuid, FriendInfo>();
ObjectGuid m_playerGUID;
}
public class FriendInfo
{
public ObjectGuid WowAccountGuid;
public FriendStatus Status;
public SocialFlag Flags;
public uint Area;
public uint Level;
public Class Class;
public string Note;
public FriendInfo()
{
Status = FriendStatus.Offline;
@@ -297,14 +305,6 @@ namespace Game.Entities
Flags = flags;
Note = note;
}
public ObjectGuid WowAccountGuid;
public FriendStatus Status;
public SocialFlag Flags;
public uint Area;
public uint Level;
public Class Class;
public string Note;
}
public enum FriendStatus