Esempio n. 1
0
 public MapPosition(DBSerial fs)
 {
     pos.x = fs.pack.GetFloat();
     pos.y = fs.pack.GetFloat();
     pos.z = fs.pack.GetFloat();
     flags = fs.pack.GetDWord();
 }
Esempio n. 2
0
        public bool Create(ulong guid, string n, byte[] _data)
        {
            Name  = n;
            _guid = guid;

            DBSerial  data = new DBSerial(new MemoryStream(_data));
            Hashtable h    = data.Deserialize() as Hashtable;

            if (h == null)
            {
                return(false);
            }

            ByteArray b = new ByteArray(h["Base"] as byte[]);

            b.Get(out race).Get(out class_).Get(out gender).
            Get(out skin).Get(out face).Get(out hairStyle).Get(out hairColor).Get(out facialHair).Get(out outfitId);

            b    = new ByteArray(h["Position"] as byte[]);
            Map  = b.GetWord();
            Zone = b.GetWord();
            b.Get(out Pos.x).Get(out Pos.y).Get(out Pos.z).Get(out this.Orientation);

            tutorialFlags = h["TutorialFlags"] as byte[];
            stat          = h["Stat"] as byte[];

            b         = new ByteArray(h["Power"] as byte[]);
            powerType = (PowerType)b.GetByte();
            b.Get(out mpower[0]).Get(out mpower[1]).Get(out mpower[2]).Get(out mpower[3]).Get(out mpower[4]).
            Get(out power[0]).Get(out power[1]).Get(out power[2]).Get(out power[3]).Get(out power[4]);

            b = new ByteArray(h["Health"] as byte[]);
            b.Get(out mhealth).Get(out health);

            b = new ByteArray(h["Attack"] as byte[]);
            b.Get(out attack).Get(out minDamage).Get(out maxDamage).Get(out attackTime0).Get(out attackTime1);

            displayID = (uint)(int)h["DisplayID"];
            level     = (uint)(int)h["Level"];
            xp        = (uint)(int)h["XP"];
            restxp    = (uint)(int)h["RestXP"];

            uint logouttm = (uint)(int)h["TimeStamp"];

            logouttm = Const.GetTimeStamp() - logouttm;
            if (logouttm > 3 * 24 * 60)
            {
                logouttm = 3 * 24 * 60;
            }

            uint maxxp = Script.GetNextLevelXP(this);

            restxp += (logouttm * maxxp) / 3 * 24 * 60;
            if (restxp > maxxp)
            {
                restxp = maxxp;
            }
            return(Create(new ByteArray(h["Items"] as byte[])));
        }
Esempio n. 3
0
 public void Add(DBSerial fs)
 {
     fs.pack.Add((byte)obtype).Add(point.x, point.y, point.z, ang).Add(map);
     fs.Add(spawnDist);
     fs.Add(spawnEntry);
     fs.Add(spawnMaxCount);
     fs.Add(spawnTime);
     if (data != null)
     {
         fs.Add((int)1);
         fs.Add(data);
     }
     else
     {
         fs.Add((int)0);
     }
 }
Esempio n. 4
0
        public SpawnData(DBSerial fs)
        {
            obtype        = (ObjectType)fs.pack.GetByte();
            point.x       = fs.pack.GetFloat();
            point.y       = fs.pack.GetFloat();
            point.z       = fs.pack.GetFloat();
            ang           = fs.pack.GetFloat();
            map           = fs.pack.GetWord();
            spawnDist     = (float[])fs.Get();
            spawnEntry    = (int[])fs.Get();
            spawnMaxCount = (int[])fs.Get();
            spawnTime     = (int[])fs.Get();
            int havemap = (int)fs.Get();

            if (havemap == 1)
            {
                data = fs.Get() as Hashtable;
            }
        }
Esempio n. 5
0
 public void Add(DBSerial fs)
 {
     fs.pack.Add(pos.x, pos.y, pos.z).Add(flags);
 }