Ejemplo n.º 1
0
 public Player(string _Name, WowRealm _Realm, CharacterDataHistoryItem _Character, GuildDataHistoryItem _Guild, HonorDataHistoryItem _Honor, GearDataHistoryItem _Gear, ArenaDataHistoryItem _Arena, TalentsDataHistoryItem _Talents)
 {
     Name             = _Name;
     Realm            = _Realm;
     Character        = _Character.Data;
     Guild            = _Guild.Data;
     Honor            = _Honor.Data;
     Gear             = _Gear.Data;
     Arena            = _Arena.Data;
     TalentPointsData = _Talents.Data;
     Uploader         = _Character.Uploader;
     if (_Guild.Uploader.GetTime() > Uploader.GetTime())
     {
         Uploader = _Guild.Uploader;
     }
     if (_Honor.Uploader.GetTime() > Uploader.GetTime())
     {
         Uploader = _Honor.Uploader;
     }
     if (_Gear.Uploader.GetTime() > Uploader.GetTime())
     {
         Uploader = _Gear.Uploader;
     }
     if (_Arena.Uploader.GetTime() > Uploader.GetTime())
     {
         Uploader = _Arena.Uploader;
     }
     if (_Talents.Uploader.GetTime() > Uploader.GetTime())
     {
         Uploader = _Talents.Uploader;
     }
     LastSeen = Uploader.GetTime();
 }
Ejemplo n.º 2
0
 public Player(SerializationInfo _Info, StreamingContext _Context)
 {
     Name      = _Info.GetString("Name");
     Realm     = (WowRealm)_Info.GetInt32("Realm");
     Character = (CharacterData)_Info.GetValue("Character", typeof(CharacterData));
     Guild     = (GuildData)_Info.GetValue("Guild", typeof(GuildData));
     Honor     = (HonorData)_Info.GetValue("Honor", typeof(HonorData));
     Gear      = (GearData)_Info.GetValue("Gear", typeof(GearData));
     LastSeen  = (DateTime)_Info.GetValue("LastSeen", typeof(DateTime));
     Uploader  = (UploadID)_Info.GetValue("Uploader", typeof(UploadID));
 }
Ejemplo n.º 3
0
        public bool Update(System.Xml.XmlNode _PlayerNode, UploadID _Uploader /*Contains LastSeen*/, DateTime _LastSeen, PlayerHistory _PlayerHistory, WowVersionEnum _WowVersion)
        {
            var newCharacter = new PlayerData.CharacterData(_PlayerNode);
            var newGuild     = new PlayerData.GuildData(_PlayerNode);
            var newGear      = new PlayerData.GearData(_PlayerNode, _WowVersion);
            var newHonor     = new PlayerData.HonorData(_PlayerNode, _WowVersion);

            if (newGear.Items.Count == 0 && newGuild.GuildName == "nil" && newGuild.GuildRank == "nil" && newHonor.CurrentRank == 0 && _WowVersion == WowVersionEnum.Vanilla)
            {
                return(true);
            }

            PlayerData.ArenaData newArena = null;
            string newTalentPointsData    = null;

            if (_WowVersion == WowVersionEnum.TBC)
            {
                newArena = new PlayerData.ArenaData(_PlayerNode);
                _PlayerHistory.AddToHistory(newArena, _Uploader);
                newTalentPointsData = XMLUtility.GetChildValue(_PlayerNode, "TalentsData", "");
                _PlayerHistory.AddTalentsToHistory(newTalentPointsData, _Uploader);
            }

            _PlayerHistory.AddToHistory(newCharacter, _Uploader);
            _PlayerHistory.AddToHistory(newGuild, _Uploader);
            if (newGear.Items.Count > 0)
            {
                _PlayerHistory.AddToHistory(newGear, _Uploader);
            }
            _PlayerHistory.AddToHistory(newHonor, _Uploader);
            if (_LastSeen > LastSeen)
            {
                Uploader  = _Uploader;
                LastSeen  = _LastSeen;
                Character = newCharacter;
                Guild     = newGuild;
                if (newGear.Items.Count > 0)
                {
                    Gear = newGear;
                }
                Honor            = newHonor;
                Arena            = newArena;
                TalentPointsData = newTalentPointsData;
                return(false);
            }

            return(true);
        }
Ejemplo n.º 4
0
 public void SetData(HonorData _HonorData)
 {
     CurrentRank         = _HonorData.CurrentRank;
     CurrentRankProgress = _HonorData.CurrentRankProgress;
     TodayHK             = _HonorData.TodayHK;
     TodayDK             = _HonorData.TodayDK;
     YesterdayHK         = _HonorData.YesterdayHK;
     YesterdayHonor      = _HonorData.YesterdayHonor;
     ThisWeekHK          = _HonorData.ThisWeekHK;
     ThisWeekHonor       = _HonorData.ThisWeekHonor;
     LastWeekHK          = _HonorData.LastWeekHK;
     LastWeekHonor       = _HonorData.LastWeekHonor;
     LastWeekStanding    = _HonorData.LastWeekStanding;
     LifetimeHK          = _HonorData.LifetimeHK;
     LifetimeDK          = _HonorData.LifetimeDK;
     LifetimeHighestRank = _HonorData.LifetimeHighestRank;
 }
Ejemplo n.º 5
0
        public bool Update(UploadID _Uploader /*Contains LastSeen*/, DateTime _LastSeen, PlayerHistory _PlayerHistory, WowVersionEnum _WowVersion
                           , PlayerData.CharacterData _NewCharacter, PlayerData.GuildData _NewGuild, PlayerData.GearData _NewGear, PlayerData.HonorData _NewHonor, PlayerData.ArenaData _NewArena = null, string _NewTalents = null)
        {
            if (_WowVersion == WowVersionEnum.TBC)
            {
                if (_NewArena != null)
                {
                    _PlayerHistory.AddToHistory(_NewArena, _Uploader);
                }
                if (_NewTalents != null)
                {
                    _PlayerHistory.AddTalentsToHistory(_NewTalents, _Uploader);
                }
            }

            _PlayerHistory.AddToHistory(_NewCharacter, _Uploader);
            _PlayerHistory.AddToHistory(_NewGuild, _Uploader);
            if (_NewGear.Items.Count > 0)
            {
                _PlayerHistory.AddToHistory(_NewGear, _Uploader);
            }
            _PlayerHistory.AddToHistory(_NewHonor, _Uploader);
            if (_LastSeen > LastSeen)
            {
                Uploader  = _Uploader;
                LastSeen  = _LastSeen;
                Character = _NewCharacter;
                Guild     = _NewGuild;
                if (_NewGear.Items.Count > 0)
                {
                    Gear = _NewGear;
                }
                Honor            = _NewHonor;
                Arena            = _NewArena;
                TalentPointsData = _NewTalents;
                return(false);
            }

            return(true);
        }
Ejemplo n.º 6
0
 public bool IsRealisticChange(HonorData _HonorData, TimeSpan _TimeSpan)
 {
     //TODO: Implement
     return(true);
 }
Ejemplo n.º 7
0
 public bool IsSame(HonorData _HonorData, WowVersionEnum _WowVersion = WowVersionEnum.Vanilla)
 {
     if (TodayHK != _HonorData.TodayHK)
     {
         return(false);
     }
     if (YesterdayHK != _HonorData.YesterdayHK)
     {
         return(false);
     }
     if (YesterdayHonor != _HonorData.YesterdayHonor)
     {
         return(false);
     }
     if (LifetimeHK != _HonorData.LifetimeHK)
     {
         return(false);
     }
     if (_WowVersion != WowVersionEnum.Vanilla)
     {
         if (TodayHonorTBC != _HonorData.TodayHonorTBC)
         {
             return(false);
         }
     }
     else
     {
         if (ThisWeekHK != _HonorData.ThisWeekHK)
         {
             return(false);
         }
         if (ThisWeekHonor != _HonorData.ThisWeekHonor)
         {
             return(false);
         }
         if (LastWeekHK != _HonorData.LastWeekHK)
         {
             return(false);
         }
         if (LastWeekHonor != _HonorData.LastWeekHonor)
         {
             return(false);
         }
         if (CurrentRank != _HonorData.CurrentRank)
         {
             return(false);
         }
         if (CurrentRankProgress != _HonorData.CurrentRankProgress)
         {
             return(false);
         }
         if (TodayDK != _HonorData.TodayDK)
         {
             return(false);
         }
         if (LastWeekStanding != _HonorData.LastWeekStanding)
         {
             return(false);
         }
         if (LifetimeDK != _HonorData.LifetimeDK)
         {
             return(false);
         }
         if (LifetimeHighestRank != _HonorData.LifetimeHighestRank)
         {
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 8
0
        public bool IsSame(HonorData _HonorData)
        {
            if (CurrentRank != _HonorData.CurrentRank)
            {
                return(false);
            }
            if (CurrentRankProgress != _HonorData.CurrentRankProgress)
            {
                return(false);
            }
            if (TodayHK != _HonorData.TodayHK)
            {
                return(false);
            }
            if (TodayDK != _HonorData.TodayDK)
            {
                return(false);
            }
            if (YesterdayHK != _HonorData.YesterdayHK)
            {
                return(false);
            }
            if (YesterdayHonor != _HonorData.YesterdayHonor)
            {
                return(false);
            }
            if (ThisWeekHK != _HonorData.ThisWeekHK)
            {
                return(false);
            }
            if (ThisWeekHonor != _HonorData.ThisWeekHonor)
            {
                return(false);
            }
            if (LastWeekHK != _HonorData.LastWeekHK)
            {
                return(false);
            }
            if (LastWeekHonor != _HonorData.LastWeekHonor)
            {
                return(false);
            }
            if (LastWeekStanding != _HonorData.LastWeekStanding)
            {
                return(false);
            }
            if (LifetimeHK != _HonorData.LifetimeHK)
            {
                return(false);
            }
            if (LifetimeDK != _HonorData.LifetimeDK)
            {
                return(false);
            }
            if (LifetimeHighestRank != _HonorData.LifetimeHighestRank)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 9
0
 public HonorDataHistoryItem(SerializationInfo _Info, StreamingContext _Context)
 {
     Data     = (HonorData)_Info.GetValue("Data", typeof(HonorData));
     Uploader = (UploadID)_Info.GetValue("Uploader", typeof(UploadID));
 }
Ejemplo n.º 10
0
 //public HonorDataHistoryItem()
 //{ }
 public HonorDataHistoryItem(HonorData _Honor, UploadID _Uploader)
 {
     Data     = _Honor;
     Uploader = _Uploader;
 }
Ejemplo n.º 11
0
 public void AddToHistory(HonorData _HonorData, UploadID _Uploader)
 {
     UtilityClass.AddToHistory.RunGeneric(HonorHistory, _HonorData, _Uploader);
 }
Ejemplo n.º 12
0
        public int GenerateNewPlayerHonorDataEntry(PlayerData.HonorData _HonorData, WowVersionEnum _WowVersion)
        {
            if (_HonorData == null)
            {
                return(0);
            }

            int resultHonorID = 0;
            var conn          = OpenConnection();

            try
            {
                using (var cmd = new NpgsqlCommand("INSERT INTO playerhonortable(id, todayhk, todayhonor, yesterdayhk, yesterdayhonor, lifetimehk) VALUES (DEFAULT, :TodayHK, :TodayHonor, :YesterdayHK, :YesterdayHonor, :LifetimeHK) RETURNING id", conn))
                {
                    {
                        var todayHKParam = new NpgsqlParameter("TodayHK", NpgsqlDbType.Integer);
                        todayHKParam.Value = _HonorData.TodayHK;
                        cmd.Parameters.Add(todayHKParam);
                    }
                    {
                        var todayHonorParam = new NpgsqlParameter("TodayHonor", NpgsqlDbType.Integer);
                        if (_WowVersion == WowVersionEnum.Vanilla)
                        {
                            todayHonorParam.Value = 0;
                        }
                        else
                        {
                            todayHonorParam.Value = _HonorData.TodayHonorTBC;
                        }
                        cmd.Parameters.Add(todayHonorParam);
                    }
                    {
                        var yesterdayHKParam = new NpgsqlParameter("YesterdayHK", NpgsqlDbType.Integer);
                        yesterdayHKParam.Value = _HonorData.YesterdayHK;
                        cmd.Parameters.Add(yesterdayHKParam);
                    }
                    {
                        var yesterdayHonorParam = new NpgsqlParameter("YesterdayHonor", NpgsqlDbType.Integer);
                        yesterdayHonorParam.Value = _HonorData.YesterdayHonor;
                        cmd.Parameters.Add(yesterdayHonorParam);
                    }
                    {
                        var lifetimeHKParam = new NpgsqlParameter("LifetimeHK", NpgsqlDbType.Integer);
                        lifetimeHKParam.Value = _HonorData.LifetimeHK;
                        cmd.Parameters.Add(lifetimeHKParam);
                    }
                    using (var reader = cmd.ExecuteReader())
                    {
                        if (reader.Read() == true)
                        {
                            resultHonorID = reader.GetInt32(0);
                        }
                    }
                }

                if (_WowVersion == WowVersionEnum.Vanilla && resultHonorID != 0)
                {
                    using (var cmd = new NpgsqlCommand("INSERT INTO playerhonorvanillatable(playerhonorid, currentrank, currentrankprogress, todaydk, thisweekhk, thisweekhonor, lastweekhk, lastweekhonor, lastweekstanding, lifetimedk, lifetimehighestrank) VALUES (:ID, :CurrentRank, :CurrentRankProgress, :TodayDK, :ThisWeekHK, :ThisWeekHonor, :LastWeekHK, :LastWeekHonor, :LastWeekStanding, :LifetimeDK, :LifetimeHighestRank) RETURNING playerhonorid", conn))
                    {
                        cmd.Parameters.Add(new NpgsqlParameter("ID", NpgsqlDbType.Integer)).Value                   = (int)resultHonorID;
                        cmd.Parameters.Add(new NpgsqlParameter("CurrentRank", NpgsqlDbType.Smallint)).Value         = _HonorData.CurrentRank;
                        cmd.Parameters.Add(new NpgsqlParameter("CurrentRankProgress", NpgsqlDbType.Real)).Value     = _HonorData.CurrentRankProgress;
                        cmd.Parameters.Add(new NpgsqlParameter("TodayDK", NpgsqlDbType.Integer)).Value              = _HonorData.TodayDK;
                        cmd.Parameters.Add(new NpgsqlParameter("ThisWeekHK", NpgsqlDbType.Integer)).Value           = _HonorData.ThisWeekHK;
                        cmd.Parameters.Add(new NpgsqlParameter("ThisWeekHonor", NpgsqlDbType.Integer)).Value        = _HonorData.ThisWeekHonor;
                        cmd.Parameters.Add(new NpgsqlParameter("LastWeekHK", NpgsqlDbType.Integer)).Value           = _HonorData.LastWeekHK;
                        cmd.Parameters.Add(new NpgsqlParameter("LastWeekHonor", NpgsqlDbType.Integer)).Value        = _HonorData.LastWeekHonor;
                        cmd.Parameters.Add(new NpgsqlParameter("LastWeekStanding", NpgsqlDbType.Integer)).Value     = _HonorData.LastWeekStanding;
                        cmd.Parameters.Add(new NpgsqlParameter("LifetimeDK", NpgsqlDbType.Integer)).Value           = _HonorData.LifetimeDK;
                        cmd.Parameters.Add(new NpgsqlParameter("LifetimeHighestRank", NpgsqlDbType.Smallint)).Value = _HonorData.LifetimeHighestRank;
                        using (var reader = cmd.ExecuteReader())
                        {
                            if (reader.Read() == true)
                            {
                                if (resultHonorID == reader.GetInt32(0))
                                {
                                    return(resultHonorID);
                                }
                            }
                        }
                    }
                }
            }
            finally
            {
                CloseConnection();
            }
            return(resultHonorID);
        }