상속: System.Data.Objects.DataClasses.EntityObject
예제 #1
0
파일: Skill.cs 프로젝트: Canic/Zepheus_2k15
 public Skill(ZoneCharacter c, ushort ID)
 {
     DatabaseSkill db = new DatabaseSkill();
     db.Owner = c.ID;
     db.SkillID = (short)ID;
     db.Upgrades = 0;
     db.IsPassive = false;
     db.Character = c.character;
     Program.Entity.AddToDatabaseSkills(db);
     Program.Entity.SaveChanges();
     _skill = db;
 }
예제 #2
0
        public void UseItem(sbyte slot)
        {
            Item item;
            if (!InventoryItems.TryGetValue(slot, out item)) //TODO: not sure about return scrolls
            {
                //TODO: send item not found / error occured packet
                return;
            }

            if (item.Info.Level > Level)
            {
                Handler12.SendItemUsed(this, item, 1800);
                return;
            }

            if (((uint)item.Info.Jobs & (uint)Job) == 0)
            {
                Handler12.SendItemUsed(this, item, 1801);
                return;
            }

            if (item.Info.Type == ItemType.Useable) //potion
            {
                if (item.Info.Class == ItemClass.ReturnScroll) //return scroll
                {
                    RecallCoordinate coord;
                    MapInfo map;
                    if (DataProvider.Instance.RecallCoordinates.TryGetValue(item.Info.InxName, out coord)
                        && (map = DataProvider.Instance.MapsByID.Values.First(m => m.ShortName == coord.MapName)) != null)
                    {
                        Handler12.SendItemUsed(this, item); //No idea what this does, but normally it's sent.
                        UseOneItemStack(item);
                        ChangeMap(map.ID, coord.LinkX, coord.LinkY); //TODO: do this properly via world later.

                    }
                    else
                    {
                        Handler12.SendItemUsed(this, item, 1811);
                    }
                }
                else if (item.Info.Class == ItemClass.Skillbook)
                {
                    //TODO: passive skills!
                    ActiveSkillInfo info;
                    if (DataProvider.Instance.ActiveSkillsByName.TryGetValue(item.Info.InxName, out info))
                    {
                        if (SkillsActive.ContainsKey(info.ID))
                        {
                            Handler12.SendItemUsed(this, item, 1811);
                            //character has this skill already
                        }
                        else
                        {
                            Handler12.SendItemUsed(this, item);
                            UseOneItemStack(item);
                            DatabaseSkill dskill = new DatabaseSkill();
                            dskill.Character = character;
                            dskill.SkillID = (short)info.ID;
                            dskill.IsPassive = false;
                            dskill.Upgrades = 0;
                            Program.Entity.AddToDatabaseSkills(dskill);
                            Save();
                            Skill skill = new Skill(dskill);
                            SkillsActive.Add(skill.ID, skill);
                            Handler18.SendSkillLearnt(this, skill.ID);
                            //TODO: broadcast the animation of learning to others
                        }
                    }
                    else
                    {
                        Log.WriteLine(LogLevel.Error, "Character tried to use skillbook but ActiveSkill does not exist.");
                        Handler12.SendItemUsed(this, item, 1811);
                    }
                }
                else
                {
                    ItemUseEffectInfo effects;
                    if (!DataProvider.Instance.ItemUseEffects.TryGetValue(item.ItemID, out effects))
                    {
                        Log.WriteLine(LogLevel.Warn, "Missing ItemUseEffect for ID {0}", item.ItemID);
                        Handler12.SendItemUsed(this, item, 1811);
                        return;
                    }

                    Handler12.SendItemUsed(this, item); //No idea what this does, but normally it's sent.
                    UseOneItemStack(item);
                    foreach (ItemEffect effect in effects.Effects)
                    {
                        switch (effect.Type)
                        {
                            case ItemUseEffectType.AbState: //TOOD: add buffs for itemuse
                                continue;

                            case ItemUseEffectType.HP:
                                HealHP(effect.Value);
                                break;

                            case ItemUseEffectType.SP:
                                HealSP(effect.Value);
                                break;
                            case ItemUseEffectType.ScrollTier:

                                break;

                            default:
                                Log.WriteLine(LogLevel.Warn, "Invalid item effect for ID {0}: {1}", item.ItemID, effect.Type.ToString());
                                break;
                        }
                    }
                }
            }
            else
            {
                Log.WriteLine(LogLevel.Warn, "Invalid item use.");
            }
        }
예제 #3
0
파일: World.cs 프로젝트: Canic/Zepheus_2k15
 /// <summary>
 /// Veraltete Methode zum Hinzufügen eines neuen Objekts zum EntitySet 'DatabaseSkills'. Verwenden Sie stattdessen die Methode '.Add' der zugeordneten Eigenschaft 'ObjectSet&lt;T&gt;'.
 /// </summary>
 public void AddToDatabaseSkills(DatabaseSkill databaseSkill)
 {
     base.AddObject("DatabaseSkills", databaseSkill);
 }
예제 #4
0
파일: World.cs 프로젝트: Canic/Zepheus_2k15
 /// <summary>
 /// Erstellt ein neues DatabaseSkill-Objekt.
 /// </summary>
 /// <param name="id">Anfangswert der Eigenschaft ID.</param>
 /// <param name="owner">Anfangswert der Eigenschaft Owner.</param>
 /// <param name="skillID">Anfangswert der Eigenschaft SkillID.</param>
 /// <param name="upgrades">Anfangswert der Eigenschaft Upgrades.</param>
 /// <param name="isPassive">Anfangswert der Eigenschaft IsPassive.</param>
 public static DatabaseSkill CreateDatabaseSkill(global::System.Int32 id, global::System.Int32 owner, global::System.Int16 skillID, global::System.Int16 upgrades, global::System.Boolean isPassive)
 {
     DatabaseSkill databaseSkill = new DatabaseSkill();
     databaseSkill.ID = id;
     databaseSkill.Owner = owner;
     databaseSkill.SkillID = skillID;
     databaseSkill.Upgrades = upgrades;
     databaseSkill.IsPassive = isPassive;
     return databaseSkill;
 }
예제 #5
0
파일: Skill.cs 프로젝트: Canic/Zepheus_2k15
 public Skill(DatabaseSkill skill)
 {
     _skill = skill;
 }