Example #1
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);
        }
Example #2
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();
        }
Example #3
0
 public Equip(DatabaseEquip eqp)
 {
     equip  = eqp;
     ItemID = (ushort)eqp.EquipID;
 }