コード例 #1
0
        public void AddItem(uint uid, int quantity, uint price)
        {
            var item = Client.Character.Inventory.GetItem(uid);

            if (item == null)
            {
                Client.Character.ReplyError("Impossible, cet item n'éxiste pas");
                return;
            }
            if (item.Quantity < quantity)
            {
                return;
            }
            if (CharacterBidItems.Count == BidShopRecord.GetBidShop(BidShopId).MaxItemPerAccount)
            {
                return;
            }
            Client.Character.Inventory.RemoveItem(item.UID, (uint)quantity);
            var existing = CharacterBidItems.Find(x => x.objectUID == item.UID);

            if (existing == null)
            {
                SaveTask.AddElement(new BidShopItemRecord(BidShopId, price, quantity, item));
            }
            else
            {
                SaveTask.AddElement(new BidShopItemRecord(BidShopId, price, quantity, item.CloneAndGetNewUID()));
            }
            OpenSellPanel();
        }
コード例 #2
0
        public static void AddShortcut(int characterid, sbyte slotid, ushort spellid)
        {
            var existing = GetShorcut(characterid, slotid);

            if (existing != null)
            {
                RemoveShortcut(existing.CharacterId, existing.SlotId);
            }
            SaveTask.AddElement(new SpellShortcutRecord(SpellsShortcuts.PopNextId <SpellShortcutRecord>(x => x.Id), characterid, spellid, slotid));
        }
コード例 #3
0
        /// <summary>
        /// Total Initiative = ( Bonus Caractéristiques + Bonus initiative) x ( Points de vie actuels / Points de vie max )
        /// </summary>
        /// <param name="character"></param>
        public static void Create(Character character)
        {
            var breed = BreedRecord.GetBreed(character.Record.Breed);

            character.Record.SpellPoints = (ushort)ConfigurationManager.Instance.StartLevel;
            character.Record.StatsPoints = 0;
            var stats = new StatsRecord(character.Id, breed.StartLifePoints, (short)(ConfigurationManager.Instance.StartLevel * 10), breed.StartLifePoints, breed.StartProspecting, 6, 3, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

            character.CurrentStats = new BasicStats((ushort)stats.MaxEnergyPoints, (uint)stats.LifePoints);
            SaveTask.AddElement(stats);
        }
コード例 #4
0
        public static void AddShortcut(int characterid, sbyte slotid, int shortcuttype, int value1, int value2)
        {
            var existing = GetShorcut(characterid, slotid);

            if (existing != null)
            {
                RemoveShortcut(existing.CharacterId, existing.SlotId);
            }
            SaveTask.AddElement(new GeneralShortcutRecord(GeneralShortcuts.PopNextId <GeneralShortcutRecord>(x => x.Id)
                                                          , characterid, shortcuttype, value1, value2, slotid));
        }
コード例 #5
0
ファイル: Character.cs プロジェクト: leonardo-spy/Symbioz
 public void UpdateBreedSpells(bool sendpackets = true)
 {
     foreach (var spell in BreedSpellRecord.GetBreedSpellsForLevel(Record.Level, Record.Breed, Spells.ConvertAll <short>(x => (short)x.spellId)))
     {
         SaveTask.AddElement(new CharacterSpellRecord(CharacterSpellRecord.CharactersSpells.PopNextId <CharacterSpellRecord>(x => x.Id), Id, spell.spellId, 1));
         SaveTask.AddElement(new SpellShortcutRecord(SpellShortcutRecord.SpellsShortcuts.PopNextId <SpellShortcutRecord>(x => x.Id), Id, (ushort)spell.spellId, SpellShortcutRecord.GetFreeSlotId(Id)));
     }
     if (sendpackets)
     {
         RefreshShortcuts();
         RefreshSpells();
     }
 }
コード例 #6
0
 public override void AddItemToPanel(CharacterItemRecord obj, uint quantity)
 {
     if (obj.IsNull())  // il ajoute a son propre panel
     {
         return;
     }
     if (quantity == obj.Quantity)
     {
         var existing = BankItems.ExistingItem(obj);
         if (!existing.IsNull())
         {
             existing.Quantity += quantity;
             SaveTask.UpdateElement(existing);
             Client.Character.Inventory.RemoveItem(obj.UID, obj.Quantity);
             Client.Send(new StorageObjectUpdateMessage(existing.GetObjectItem()));
             return;
         }
         else
         {
             var newBankItem = obj.GetBankItem(Client.Account.Id);
             Client.Send(new StorageObjectUpdateMessage(newBankItem.GetObjectItem()));
             SaveTask.AddElement(newBankItem);
             Client.Character.Inventory.RemoveItem(obj.UID, obj.Quantity);
             return;
         }
     }
     else
     {
         var existing = BankItems.ExistingItem(obj);
         if (existing != null)
         {
             existing.Quantity += (uint)quantity;
             Client.Send(new StorageObjectUpdateMessage(existing.GetObjectItem()));
             Client.Character.Inventory.RemoveItem(obj.UID, quantity);
             SaveTask.UpdateElement(existing);
             return;
         }
         else
         {
             var addedItem = obj.CloneWithUID(); // fonctionne
             addedItem.Quantity = (uint)quantity;
             Client.Send(new StorageObjectUpdateMessage(addedItem.GetObjectItem()));
             SaveTask.AddElement(addedItem.GetBankItem(Client.Account.Id));
             Client.Character.Inventory.RemoveItem(obj.UID, quantity);
             return;
         }
     }
 }
コード例 #7
0
        public void Add(CharacterItemRecord item, bool refresh = true)
        {
            var existingItem = Items.ExistingItem(item);

            if (existingItem == null)
            {
                Items.Add(item);
                if (!CharacterItemRecord.CharactersItems.Contains(item))
                {
                    SaveTask.AddElement(item);
                }
            }
            else
            {
                existingItem.Quantity += item.Quantity;
                SaveTask.UpdateElement(existingItem);
            }
            if (refresh)
            {
                Refresh();
                Character.RefreshShortcuts();
            }
        }
コード例 #8
0
 public static void AddBidShopGain(BidShopItemRecord selledItem)
 {
     SaveTask.AddElement(new BidShopGainRecord(PopNextUID(), selledItem.OwnerId, selledItem.GID, selledItem.Quantity, selledItem.Price));
 }
コード例 #9
0
 /// <summary>
 /// Using SaveTask.cs
 /// </summary>
 /// <param name="table"></param>
 /// <param name="addtolist"></param>
 public static void AddElement(this ITable table, bool addtolist = true)
 {
     SaveTask.AddElement(table, addtolist);
 }