Exemplo n.º 1
0
        public static bool SaveEntity(Client.GameState client)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
                cmd.Update("entities").Set("WarehousePW", client.WarehousePW)
                    .Set("LotteryEntries2", client.LotteryEntries2)
                    .Set("Spouse", client.Entity.Spouse).Set("Money", client.Entity.Money)
                    .Set("ConquerPoints", client.Entity.ConquerPoints).Set("Body", client.Entity.Body)
                    .Set("Face", client.Entity.Face).Set("Class", client.Entity.Class).Set("Reborn", client.Entity.Reborn)
                    .Set("Level", client.Entity.Level).Set("HairStyle", client.Entity.HairStyle).Set("EnlightsReceived", client.Entity.ReceivedEnlightenPoints)
                    .Set("PKPoints", client.Entity.PKPoints).Set("QuizPoints", client.Entity.QuizPoints)
                    .Set("Experience", client.Entity.Experience).Set("MoneySave", client.MoneySave)
                    .Set("Hitpoints", client.Entity.Hitpoints).Set("LastDragonBallUse", client.LastDragonBallUse.ToBinary())
                    .Set("Strength", client.Entity.Strength).Set("Agility", client.Entity.Agility)
                    .Set("Spirit", client.Entity.Spirit).Set("Vitality", client.Entity.Vitality)
                    .Set("PreviousX", client.Entity.PrevX).Set("PreviousY", client.Entity.PrevY)
                    .Set("Atributes", client.Entity.Atributes).Set("Mana", client.Entity.Mana).Set("VIPLevel", client.Entity.VIPLevel)
                    .Set("MapID", client.Map.ID).Set("X", client.Entity.X).Set("Y", client.Entity.Y).Set("VirtuePoints", client.VirtuePoints)
                    .Set("PreviousMapID", client.Entity.PreviousMapID).Set("EnlightenPoints", client.Entity.EnlightenPoints)
                    .Set("LastResetTime", client.LastResetTime.ToBinary())
                    .Set("DoubleExpTime", client.Entity.DoubleExperienceTime)
                    .Set("DoubleExpToday", client.DoubleExpToday).Set("HeavenBlessingTime", client.Entity.HeavenBlessing)
                    .Set("InLottery", client.InLottery).Set("LotteryEntries", client.LotteryEntries).Set("LastLotteryEntry", client.LastLotteryEntry.Ticks)
                    .Set("HeadgearClaim", client.HeadgearClaim).Set("NecklaceClaim", client.NecklaceClaim).Set("ArmorClaim", client.ArmorClaim)
                    .Set("WeaponClaim", client.WeaponClaim).Set("RingClaim", client.RingClaim).Set("BootsClaim", client.BootsClaim)
                    .Set("TowerClaim", client.TowerClaim).Set("FanClaim", client.FanClaim).Set("ChatBanTime", client.ChatBanTime.Ticks)
                    .Set("ChatBanLasts", client.ChatBanLasts).Set("ChatBanned", client.ChatBanned).Set("BlessTime", client.BlessTime)
                    .Set("ExpBalls", client.ExpBalls)

                    .Set("FirstRebornLevel", client.Entity.FirstRebornLevel)
                    .Set("SecondRebornLevel", client.Entity.SecondRebornLevel)
                    .Set("Money", client.Entity.Money)
                    .Set("ConquerPoints", client.Entity.ConquerPoints).Set("EnlightmentWait", client.Entity.EnlightmentTime);
                if (client.Entity.Reborn == 1)
                {
                    cmd.Set("FirstRebornClass", client.Entity.FirstRebornClass);
                }
                if (client.Entity.Reborn == 2)
                {
                    cmd.Set("SecondRebornClass", client.Entity.SecondRebornClass);
                }
                if (client.Entity.MapID == 601)
                    cmd.Set("OfflineTGEnterTime", client.OfflineTGEnterTime.Ticks);
                else
                    cmd.Set("OfflineTGEnterTime", 0);

                if (client.AsMember != null)
                {
                    cmd.Set("GuildID", client.AsMember.GuildID).
                        Set("GuildRank", (ushort)client.AsMember.Rank).
                        Set("GuildSilverDonation", client.AsMember.SilverDonation).
                        Set("GuildConquerPointDonation", client.AsMember.ConquerPointDonation);
                }
                else
                {
                    cmd.Set("GuildID", 0).
                       Set("GuildRank", 0).
                       Set("GuildSilverDonation", 0).
                       Set("GuildConquerPointDonation", 0);
                }
                cmd.Where("UID", client.Entity.UID).Execute();
            }
            catch (Exception e) { Program.SaveException(e); } return true;
        }