Esempio n. 1
0
        public void updateTime()
        {
            BinWriter w = new BinWriter();

            w.Write(WorldClock.GetTimeStamp());
            WorldServer.GetClientByCharacterID((uint)this.GUID).Send(SMSG.GAMETIME_UPDATE, w);

            /*		//BinWriter w = LoginClient.NewPacket(SMSG.LOGIN_SETTIMESPEED);
             *                      /*w.Write((float)0);
             *                      w.Write((int)0);*/
            /*w.Write((byte)1);
             * w.Write((byte)1);
             * w.Write((byte)1);
             * w.Write((byte)1);
             * w.Write((byte)1);
             * w.Write((byte)1);
             * w.Write((byte)1);
             * w.Write((byte)1);
             * Send(w);
             *
             * DateTime time = WorldServer.m_clock.time;	//Moved this code to WorldClock, so I could use the timestamp in other places.
             * uint timeSeq = 0;
             *
             * // 4 bytes of packed time data.  the bits are:
             * // high 2 bits - unknown
             * timeSeq|=(uint)0;
             * // next 5 bits - year
             * timeSeq<<=5;
             * timeSeq|=(uint)1;
             * // next 4 bits - month
             * timeSeq<<=4;
             * timeSeq|=(uint)time.Month;
             * // next 7 bits - day of month
             * timeSeq<<=7;
             * timeSeq|=(uint)time.Day;
             * // next 3 bits - day of week
             * timeSeq<<=3;
             * timeSeq|=(uint)time.DayOfWeek;
             * // next 5 bits - hours
             * timeSeq<<=5;
             * timeSeq|=(uint)((time.Hour==0) ? 24 : time.Hour );
             * // low 6 bits  - minutes
             * timeSeq<<=6;
             * timeSeq|=(uint)time.Minute;
             *
             * BinWriter w = new BinWriter();
             * w.Write(timeSeq);
             * WorldServer.GetClientByCharacterID((uint)this.GUID).Send(SMSG.GAMETIME_UPDATE,w);
             */
        }
Esempio n. 2
0
        //		[UpdateValueAttribute(PLAYERFIELDS.SKILL_INFO, ArraySize=384)]
        //		protected uint [] m_skill_info;

        public PlayerObject(DBCharacter c) : base()
        {
            m_character                     = c;
            m_character.Health              = c.Health;
            m_character.MaxHealth           = c.MaxHealth;
            m_character.Power               = c.Power;
            m_character.MaxPower            = c.MaxPower;
            m_character.Strength            = c.Strength;
            m_character.BaseStrength        = c.BaseStrength;
            m_character.Stamina             = c.Stamina;
            m_character.BaseStamina         = c.BaseStamina;
            m_character.Agility             = c.Agility;
            m_character.BaseAgility         = c.BaseAgility;
            m_character.Intellect           = c.Intellect;
            m_character.BaseIntellect       = c.BaseIntellect;
            m_character.Spirit              = c.Spirit;
            m_character.BaseSpirit          = c.BaseSpirit;
            m_character.AttackPower         = c.AttackPower;
            m_character.AttackPowerModifier = c.AttackPowerModifier;
            m_character.GuildID             = c.GuildID;
            m_character.GuildRank           = c.GuildRank;
            m_character.GuildTimeStamp      = WorldClock.GetTimeStamp();


            m_scale           = c.Scale;
            m_displayID       = c.DisplayID;
            m_nativedisplayID = c.DisplayID;
            m_playerFlags     = 0;
            m_accessLevel     = ACCESSLEVEL.NORMAL;
            m_baseattacktime  = 2000;
            //			m_skill_info = new uint[384];
            //			m_skill_info[0] = 133;	//Just for a test, Mage spell fireball
            Inventory = new PlayerInventory(this);
            if (c.Items != null)
            {
                foreach (DBItem item in c.Items)
                {
                    Inventory.CreateItem(item);
                }
            }
            StatManager.CalculateNextLevelExp(this);
            StatManager.CalculateNewStats(this);

            ObjectManager.AddWorldObject(this);
            EventManager.AddEvent(new AggrMonsterEvent(this));
            EventManager.AddEvent(new RoamingEvent(this));
        }