Beispiel #1
0
 public void Save()
 {
     this.Friends = "";
     foreach (KeyValuePair <int, String> Key in this.FriendsList)
     {
         this.Friends += Key.Key + "|" + Key.Value + ";";
     }
     this.Ennemys = "";
     foreach (KeyValuePair <int, String> Key in this.EnnemyList)
     {
         this.Ennemys += Key.Key + "|" + Key.Value + ";";
     }
     this.Bank = "";
     foreach (KeyValuePair <long, InventoryItemModel> KeyPair in this.bankItems)
     {
         this.Bank += KeyPair.Key + ";";
         InventoryItemTable.Update(KeyPair.Value);
     }
     this.Stables = "";
     foreach (KeyValuePair <int, Mount> KeyPair in this.Mounts)
     {
         this.Stables += KeyPair.Key + ";";
     }
     AccountDataTable.Update(this);
 }
Beispiel #2
0
        private static void BuyRequest(WorldClient Client, string Packet)
        {
            Client.Send(new GameRideMessage("v"));
            MountPark MP = Client.Character.myMap.mountPark;

            if (MP == null)
            {
                Client.Send(new BasicNoOperationMessage());
                return;
            }
            if (MP.get_owner() == -1)
            {
                Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 96));
                return;
            }
            if (MP.get_price() == 0)
            {
                Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 97));
                return;
            }
            if (!Client.Character.HasGuild())
            {
                Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 135));
                return;
            }
            if (Client.GetCharacter().getCharacterGuild().GradeType != GuildGradeEnum.GRADE_BOSS)
            {
                Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 98));
                return;
            }
            byte enclosMax       = (byte)Math.Floor((double)Client.Character.GetGuild().Level / 10);
            byte TotalEncloGuild = (byte)MountParkTable.CountByGuild(Client.Character.GetGuild().ID);

            if (TotalEncloGuild >= enclosMax)
            {
                Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 103));
                return;
            }
            if (Client.Character.Kamas < MP.get_price())
            {
                Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 82));
                return;
            }
            Client.GetCharacter().InventoryCache.SubstractKamas(MP.get_price());
            if (MP.get_owner() > 0)
            {
                var Owner = CharacterTable.GetCharacter(MP.get_owner());
                if (Owner != null && Owner.Account.curPlayer != null)
                {
                    Owner.Send(new ChatGameMessage("Un enclo a ete vendu a " + MP.get_price() + ".", "CC0000"));
                    Owner.Account.Data.BankKamas += MP.get_price();
                    Owner.Account.Data.Save();
                }
                else
                {
                    AccountDataTable.Update(MP.get_price(), MP.get_owner());
                }
            }
            MP.set_price(0);
            MP.set_owner(Client.Character.ID);
            MP.set_guild(Client.Character.GetGuild());
            MountParkTable.Update(MP);
            CharacterTable.Update(Client.Character);
            Client.GetCharacter().myMap.SendToMap(new MapMountParkMessage(MP));
        }