示例#1
0
 public SQLIngameItemInfo(PlayerData.ItemInfo _ItemInfo)
 {
     ItemID    = _ItemInfo.ItemID;
     EnchantID = _ItemInfo.EnchantID;
     SuffixID  = _ItemInfo.SuffixID;
     UniqueID  = _ItemInfo.UniqueID;
 }
示例#2
0
 public PlayerData.ItemInfo GenerateItemInfo(ItemSlot _Slot, int[] _GemIDs = null)
 {
     PlayerData.ItemInfo itemInfo = new PlayerData.ItemInfo();
     itemInfo.Slot      = _Slot;
     itemInfo.ItemID    = ItemID;
     itemInfo.EnchantID = EnchantID;
     itemInfo.SuffixID  = SuffixID;
     itemInfo.UniqueID  = UniqueID;
     itemInfo.GemIDs    = _GemIDs;
     return(itemInfo);
 }
示例#3
0
        public PlayerData.ItemInfo GetLatestItemInfoForPlayer(string _Player, WowRealm _Realm, int _ItemID)
        {
            PlayerData.ItemInfo latestItemInfo = new PlayerData.ItemInfo();
            latestItemInfo.Slot   = VF_RealmPlayersDatabase.ItemSlot.Unknown;
            latestItemInfo.ItemID = _ItemID;
            DateTime latestItemInfoDate = DateTime.MinValue;

            var conn = OpenConnection();

            try
            {
                using (var cmd = new NpgsqlCommand("SELECT DISTINCT ii.enchantid, ii.suffixid, ii.uniqueid, MAX(pdt.updatetime) FROM PlayerTable player"
                                                   + " INNER JOIN PlayerDataTable pdt ON pdt.PlayerID = player.ID"
                                                   + " INNER JOIN PlayerGearTable pgt ON pgt.ID = pdt.gearinfo INNER JOIN IngameItemTable ii"
                                                   + " ON ii.ID = pgt.head OR ii.ID = pgt.neck OR ii.ID = pgt.shoulder OR ii.ID = pgt.shirt"
                                                   + " OR ii.ID = pgt.chest OR ii.ID = pgt.belt OR ii.ID = pgt.legs OR ii.ID = pgt.feet"
                                                   + " OR ii.ID = pgt.wrist OR ii.ID = pgt.gloves OR ii.ID = pgt.finger_1 OR ii.ID = pgt.finger_2"
                                                   + " OR ii.ID = pgt.trinket_1 OR ii.ID = pgt.trinket_2 OR ii.ID = pgt.back"
                                                   + " OR ii.ID = pgt.main_hand OR ii.ID = pgt.off_hand OR ii.ID = pgt.ranged"
                                                   + " OR ii.ID = pgt.tabard WHERE ii.ItemID = :ItemID AND player.name = :PlayerName AND player.realm = :Realm GROUP BY ii.enchantid, ii.suffixid, ii.uniqueid", conn))
                {
                    cmd.Parameters.Add(new NpgsqlParameter("ItemID", NpgsqlDbType.Integer)).Value  = _ItemID;
                    cmd.Parameters.Add(new NpgsqlParameter("PlayerName", NpgsqlDbType.Text)).Value = _Player;
                    cmd.Parameters.Add(new NpgsqlParameter("Realm", NpgsqlDbType.Integer)).Value   = (int)_Realm;
                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read() == true && reader.IsDBNull(3) == false)
                        {
                            DateTime currItemInfoDate = reader.GetTimeStamp(3).DateTime;
                            if (currItemInfoDate > latestItemInfoDate)
                            {
                                latestItemInfoDate       = currItemInfoDate;
                                latestItemInfo.EnchantID = reader.GetInt32(0);
                                latestItemInfo.SuffixID  = reader.GetInt32(1);
                                latestItemInfo.UniqueID  = reader.GetInt32(2);
                            }
                        }
                    }
                }
            }
            finally
            {
                CloseConnection();
            }

            if (latestItemInfoDate != DateTime.MinValue)
            {
                return(latestItemInfo);
            }

            return(null);
        }