Inheritance: System.Data.Objects.DataClasses.EntityObject
Exemplo n.º 1
0
        public Equip(DroppedEquip pBase, ZoneCharacter pNewOwner, sbyte pSlot)
        {
            DatabaseEquip dbeq = new DatabaseEquip();
            dbeq.IncDex = pBase.Dex;
            dbeq.IncStr = pBase.Str;
            dbeq.IncEnd = pBase.End;
            dbeq.IncInt = pBase.Int;
            dbeq.IncSpr = pBase.Spr;
            dbeq.Upgrades = pBase.Upgrades;
            dbeq.EquipID = pBase.ItemID;
            dbeq.Slot = pSlot;
            dbeq.Character = pNewOwner.character;

            Program.Entity.AddToDatabaseEquips(dbeq);
            equip = dbeq;
            ItemID = (ushort)dbeq.EquipID;
            pNewOwner.InventoryItems.Add(pSlot, this);
            pNewOwner.Save();
        }
Exemplo n.º 2
0
        public InventoryStatus GiveItem(string InxName, byte amount = 1)
        {
            ItemInfo info;

            if (DataProvider.Instance.ItemsByName.TryGetValue(InxName, out info))
            {
                ushort id = DataProvider.Instance.GetItemByInxNameInfo(InxName).ItemID;

                if (info.Slot == FiestaLib.ItemSlot.Normal)
                {
                    foreach (var i in InventoryItems.Values)
                    {
                        if (i.ItemID == id && i.Amount < i.Info.MaxLot)
                        {
                            // We found the same item and it can stack more!
                            byte left = (byte)(i.Info.MaxLot - i.Amount);
                            if (left > amount)
                            {
                                i.Amount += left;
                                amount -= left;
                            }
                            else
                            {
                                i.Amount += amount;
                                amount = 0;
                            }
                            Handler12.ModifyInventorySlot(this, 0x24, (byte)i.Slot, (byte)i.Slot, i);
                            if (amount == 0)
                            {
                                break;
                            }
                        }
                    }
                    // If we have still some stuff left, go ahead and create new stacks!
                    if (amount > 0)
                    {
                        while (amount > 0)
                        {
                            sbyte invslot;
                            if (GetFreeInventorySlot(out invslot))
                            {
                                DatabaseItem item = new DatabaseItem();
                                item.Amount = amount;
                                item.Character = character;
                                item.ObjectID = info.ItemID;
                                item.Slot = invslot;
                                Program.Entity.AddToDatabaseItems(item);
                                Item nitem = new Item(item);
                                InventoryItems.Add(invslot, nitem);
                                Handler12.ModifyInventorySlot(this, 0x24, (byte)invslot, (byte)invslot, nitem);
                                amount -= info.MaxLot;
                            }
                            else return InventoryStatus.FULL;
                        }
                    }
                    Save();
                    return InventoryStatus.ADDED;
                }
                else
                {
                    sbyte invslot;
                    if (GetFreeInventorySlot(out invslot))
                    {
                        DatabaseEquip equip = new DatabaseEquip();
                        equip.Character = character;
                        equip.EquipID = info.ItemID;
                        equip.Slot = invslot;
                        Program.Entity.AddToDatabaseEquips(equip);
                        Equip nequip = new Equip(equip);
                        InventoryItems.Add(invslot, nequip);
                        Save();
                        Handler12.ModifyInventorySlot(this, 0x24, (byte)invslot, (byte)invslot, nequip);
                        return InventoryStatus.ADDED;
                    }
                    else return InventoryStatus.FULL;
                }
            }
            else return InventoryStatus.NOT_FOUND;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Veraltete Methode zum Hinzufügen eines neuen Objekts zum EntitySet 'DatabaseEquips'. Verwenden Sie stattdessen die Methode '.Add' der zugeordneten Eigenschaft 'ObjectSet&lt;T&gt;'.
 /// </summary>
 public void AddToDatabaseEquips(DatabaseEquip databaseEquip)
 {
     base.AddObject("DatabaseEquips", databaseEquip);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Erstellt ein neues DatabaseEquip-Objekt.
 /// </summary>
 /// <param name="id">Anfangswert der Eigenschaft ID.</param>
 /// <param name="owner">Anfangswert der Eigenschaft Owner.</param>
 /// <param name="slot">Anfangswert der Eigenschaft Slot.</param>
 /// <param name="equipID">Anfangswert der Eigenschaft EquipID.</param>
 /// <param name="upgrades">Anfangswert der Eigenschaft Upgrades.</param>
 /// <param name="incStr">Anfangswert der Eigenschaft IncStr.</param>
 /// <param name="incEnd">Anfangswert der Eigenschaft IncEnd.</param>
 /// <param name="incDex">Anfangswert der Eigenschaft IncDex.</param>
 /// <param name="incInt">Anfangswert der Eigenschaft IncInt.</param>
 /// <param name="incSpr">Anfangswert der Eigenschaft IncSpr.</param>
 public static DatabaseEquip CreateDatabaseEquip(global::System.Int32 id, global::System.Int32 owner, global::System.Int16 slot, global::System.Int32 equipID, global::System.Byte upgrades, global::System.Byte incStr, global::System.Byte incEnd, global::System.Byte incDex, global::System.Byte incInt, global::System.Byte incSpr)
 {
     DatabaseEquip databaseEquip = new DatabaseEquip();
     databaseEquip.ID = id;
     databaseEquip.Owner = owner;
     databaseEquip.Slot = slot;
     databaseEquip.EquipID = equipID;
     databaseEquip.Upgrades = upgrades;
     databaseEquip.IncStr = incStr;
     databaseEquip.IncEnd = incEnd;
     databaseEquip.IncDex = incDex;
     databaseEquip.IncInt = incInt;
     databaseEquip.IncSpr = incSpr;
     return databaseEquip;
 }
Exemplo n.º 5
0
 public Equip(DatabaseEquip eqp)
 {
     equip = eqp;
     ItemID = (ushort)eqp.EquipID;
 }
Exemplo n.º 6
0
        public WorldCharacter CreateCharacter(string name, byte slot, byte hair, byte color, byte face, Job job, bool ismale)
        {
            if (Characters.ContainsKey(slot) || slot > 5)
                return null;
            //TODO: check if hair etc are actual beginner ones! (premium hack)

            BaseStatsEntry stats = DataProvider.Instance.JobBasestats[job];
            if (stats == null)
            {
                Log.WriteLine(LogLevel.Warn, "Houston, we have a problem! Jobstats not found for job {0}", job.ToString());
                return null;
            }

            Character newchar = new Character();
            newchar.AccountID = this.AccountID;
            newchar.CharLevel = 1;
            newchar.Name = name;
            newchar.Face = face;
            newchar.Hair = hair;
            newchar.HairColor = color;
            newchar.Job = (byte)job;
            newchar.Male = ismale;
            newchar.Slot = slot;
            newchar.XPos = 7636;
            newchar.YPos = 4610;
            newchar.HP = (short)stats.MaxHP;
            newchar.SP = (short)stats.MaxSP;
            newchar.HPStones = (short)stats.MaxHPStones;
            newchar.SPStones = (short)stats.MaxSPStones;
            Program.Entity.AddToCharacters(newchar);
            int charID = newchar.ID;
            ushort begineqp = GetBeginnerEquip(job);
            if (begineqp > 0)
            {
                DatabaseEquip eqp = new DatabaseEquip();
                eqp.EquipID = begineqp;
                eqp.Slot = (short)((job == Job.Archer) ? -10 : -12);
                newchar.Equips.Add(eqp);
            }
            Program.Entity.SaveChanges();
            WorldCharacter tadaa = new WorldCharacter(newchar, (job == Job.Archer) ? (byte)12 : (byte)10, begineqp);
            Characters.Add(slot, tadaa);
            return tadaa;
        }