Beispiel #1
0
        public override void OnLoad()
        {
            _Client.State = (int)eClientState.WorldEnter;

            if (!_Inited)
            {
                EvtInterface.Obj = this;
                EvtInterface.AddEventNotify("Playing", Save);
                EvtInterface.Start();

                ItmInterface.Load(CharMgr.GetItemChar(_Info.CharacterId));
                StsInterface.Load(CharMgr.GetCharacterInfoStats(_Info.CareerLine, _Value.Level));
                QtsInterface.Load(this._Info.Quests);
                TokInterface.Load(_Info.Toks);
                SocInterface.Load(_Info.Socials);
                AbtInterface.Load();
                StsInterface.ApplyStats();

                SetLevel(_Value.Level);
                SetRenownLevel(_Value.RenownRank);
                SetOffset((UInt16)(_Value.WorldX >> 12), (UInt16)(_Value.WorldY >> 12));
                _Inited = true;
            }

            base.OnLoad();

            StartInit();
        }
Beispiel #2
0
 public override void SendMeTo(Player Plr)
 {
     ItmInterface.SendEquiped(Plr);
     SendState(Plr);
     MvtInterface.CurrentMount.SendMount(Plr);
     base.SendMeTo(Plr);
 }
Beispiel #3
0
        public void StartInit()
        {
            RemovePlayer(this);
            Client.State = (int)eClientState.WorldEnter;
            SendMoney();
            SendStats();
            SendSpeed();
            SendInited();
            SendRankUpdate(this);
            SendXp();
            SendRenown();
            TokInterface.SendAllToks();
            SendSkills();
            Health = TotalHealth;
            ItmInterface.SendAllItems(this);
            AbtInterface.SendAbilities();

            /*PacketOut Out = new PacketOut((byte)Opcodes.F_CHARACTER_INFO);
             * Out.WriteByte(1);
             * Out.WriteByte(1);
             * Out.WriteUInt16(0x300);
             * Out.WriteUInt16(8159);
             * Out.WriteByte(1);
             * SendPacket(Out);*/

            QtsInterface.SendQuests();

            SendInitComplete();
            SocInterface.SendFriends();
        }
Beispiel #4
0
        public void StartInit()
        {
            RemovePlayer(this);
            Client.State = (int)eClientState.WorldEnter;
            SendMoney();
            SendStats();
            SendSpeed(Speed);
            SendInited();
            SendRankUpdate(this);
            SendXpTable();
            WorldMgr.GeneralScripts.OnWorldPlayerEvent("SEND_PACKAGES", this, null);
            SendXp();
            SendRenown();
            TokInterface.SendAllToks();
            SendSkills();
            SendUpdateState();

            /*{
             *  PacketOut Out = new PacketOut((byte)Opcodes.F_INFLUENCE_INFO);
             *  Out.WriteHexStringBytes("00000000");
             *  SendPacket(Out);
             * }
             * {
             *  PacketOut Out = new PacketOut((byte)Opcodes.F_PLAY_TIME_STATS);
             *  Out.WriteHexStringBytes("000000000000000000000000");
             *  SendPacket(Out);
             * }
             *
             * {
             *  PacketOut Out = new PacketOut((byte)Opcodes.F_TACTICS);
             *  Out.WriteHexStringBytes("0300");
             *  SendPacket(Out);
             * }
             *
             * {
             *  PacketOut Out = new PacketOut((byte)Opcodes.F_MORALE_LIST);
             *  Out.WriteHexStringBytes("00 00 00 00 00 00 00 00 00 00 00".Replace(" ", string.Empty));
             *  SendPacket(Out);
             * }*/

            Health = TotalHealth;
            ItmInterface.SendAllItems(this);
            AbtInterface.SendAbilities();

            QtsInterface.SendQuests();
            MvtInterface.CurrentMount.SendMount(this);

            SendInitComplete();
            SocInterface.SendFriends();

            if (GetGroup() != null)
            {
                GetGroup().Update();
            }

            SendMessage(0, "MOTD: Welcome to WarEmu", "", SystemData.ChatLogFilters.CHATLOGFILTERS_CITY_ANNOUNCE);

            MlInterface.SendMailCounts();
        }
Beispiel #5
0
        public void SendStats()
        {
            PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_STATS);

            ItmInterface.BuildStats(ref Out);
            StsInterface.BuildStats(ref Out);
            SendPacket(Out);
        }
Beispiel #6
0
        public override void Dispose()
        {
            ItmInterface.Stop();
            CbtInterface.Stop();
            StsInterface.Stop();
            QtsInterface.Stop();
            MvtInterface.Stop();
            AbtInterface.Stop();
            EvtInterface.Stop();
            AiInterface.Stop();

            base.Dispose();
        }
 public override void SendMeTo(Player plr)
 {
     /*if (Plr.CrrInterface is IPetCareerInterface && Plr.CrrInterface.GetTargetOfInterest() != null)
      *  (Plr.CrrInterface.GetTargetOfInterest() as Pet).SendPet(2);*/
     ItmInterface.SendEquipped(plr);
     SendState(plr);
     OSInterface.SendObjectStates(plr);
     base.SendMeTo(plr);
     if (MountID != 0)
     {
         SendMount(plr);
     }
     SendGfxMods();
 }
Beispiel #8
0
        public override void Update()
        {
            long Tick = TCPManager.GetTimeStampMS();

            UpdateHealth(Tick);
            UpdateActionPoints(Tick);
            EvtInterface.Update(Tick);

            CbtInterface.Update(Tick);
            ItmInterface.Update(Tick);
            StsInterface.Update(Tick);
            QtsInterface.Update(Tick);
            MvtInterface.Update(Tick);
            AbtInterface.Update(Tick);
            AiInterface.Update(Tick);

            if (NextSend < Tick)
            {
                NextSend = Tick + STATE_INTERVAL;
                SendState(null);
            }

            base.Update();
        }
Beispiel #9
0
        public override void OnLoad()
        {
            InteractType = GenerateInteractType(Spawn.Title);

            SetFaction(Spawn.Faction != 0 ? Spawn.Faction : Spawn.Proto.Faction);

            ItmInterface.Load(WorldMgr.GetCreatureItems(Spawn.Entry));
            Level = (byte)RandomMgr.Next((int)Spawn.Proto.MinLevel, (int)Spawn.Proto.MaxLevel);
            StsInterface.SetBaseStat((byte)GameData.Stats.STATS_WOUNDS, GenerateWounds(Level, Rank));
            StsInterface.ApplyStats();
            Health = TotalHealth;

            X = Zone.CalculPin((uint)(Spawn.WorldX), true);
            Y = Zone.CalculPin((uint)(Spawn.WorldY), false);
            Z = (ushort)(Spawn.WorldZ * 2);


            // TODO : Bad Height Formula

            /*int HeightMap = HeightMapMgr.GetHeight(Zone.ZoneId, X, Y);
             * if (Z < HeightMap)
             * {
             *  Log.Error("Creature", "["+Spawn.Entry+"] Invalid Height : Min=" + HeightMap + ",Z=" + Z);
             *  return;
             * }*/

            Heading         = (ushort)Spawn.WorldO;
            WorldPosition.X = Spawn.WorldX;
            WorldPosition.Y = Spawn.WorldY;
            WorldPosition.Z = Spawn.WorldZ;

            SetOffset((ushort)(Spawn.WorldX >> 12), (ushort)(Spawn.WorldY >> 12));
            Region.UpdateRange(this);

            base.OnLoad();
        }
Beispiel #10
0
 public void Save()
 {
     ItmInterface.Save();
     CalcWorldPositions();
     CharMgr.Database.SaveObject(_Value);
 }
Beispiel #11
0
        public override void OnLoad()
        {
            InteractType = Spawn.Proto.InteractType;

            SetFaction(Spawn.Faction != 0 ? Spawn.Faction : Spawn.Proto.Faction);

            ItmInterface.Load(CreatureService.GetCreatureItems(Spawn.Entry));
            if (Spawn.Proto.MinLevel > Spawn.Proto.MaxLevel)
            {
                Spawn.Proto.MinLevel = Spawn.Proto.MaxLevel;
            }

            if (Spawn.Proto.MaxLevel <= Spawn.Proto.MinLevel)
            {
                Spawn.Proto.MaxLevel = Spawn.Proto.MinLevel;
            }

            if (Spawn.Proto.MaxLevel == 0)
            {
                Spawn.Proto.MaxLevel = 1;
            }
            if (Spawn.Proto.MinLevel == 0)
            {
                Spawn.Proto.MinLevel = 1;
            }

            if (Spawn.Level != 0)
            {
                if (Spawn.Level > 2)
                {
                    Level = (byte)StaticRandom.Instance.Next(Spawn.Level - 1, Spawn.Level + 1);
                }
                else
                {
                    Level = (byte)StaticRandom.Instance.Next(Spawn.Level, Spawn.Level + 1);
                }
            }
            else
            {
                Level = (byte)StaticRandom.Instance.Next(Spawn.Proto.MinLevel, Spawn.Proto.MaxLevel + 1);
            }

            SetCreatureStats();

            Health = TotalHealth;

            X = Zone.CalculPin((uint)Spawn.WorldX, true);
            Y = Zone.CalculPin((uint)Spawn.WorldY, false);
            Z = (ushort)Spawn.WorldZ;

            // TODO : Bad Height Formula

            /*int HeightMap = HeightMapMgr.GetHeight(Zone.ZoneId, X, Y);
             * if (Z < HeightMap)
             * {
             *  Log.Error("Creature", "["+Spawn.Entry+"] Invalid Height : Min=" + HeightMap + ",Z=" + Z);
             *  return;
             * }*/

            Heading         = (ushort)Spawn.WorldO;
            WorldPosition.X = Spawn.WorldX;
            WorldPosition.Y = Spawn.WorldY;
            WorldPosition.Z = Spawn.WorldZ;

            SetOffset((ushort)(Spawn.WorldX >> 12), (ushort)(Spawn.WorldY >> 12));
            ScrInterface.AddScript(Spawn.Proto.ScriptName);

            SaveSpawnData();
            LoadInterfaces();

            AiInterface.SetBrain(new DummyBrain(this));

            States.Add(0x12);
            States.Add((byte)CreatureState.UnkOmnipresent);

            Speed = 350;
            StsInterface.Speed = 350;
            MvtInterface.SetBaseSpeed(Speed);
            MvtInterface.FollowReacquisitionInterval = 100;

            IsActive = true;
        }
Beispiel #12
0
        public override void OnLoad()
        {
            InteractType = GenerateInteractType(Spawn.Title != 0 ? Spawn.Title : Spawn.Proto.Title);

            SetFaction(Spawn.Faction != 0 ? Spawn.Faction : Spawn.Proto.Faction);

            ItmInterface.Load(WorldMgr.GetCreatureItems(Spawn.Entry));
            if (Spawn.Proto.MinLevel > Spawn.Proto.MaxLevel)
            {
                Spawn.Proto.MinLevel = Spawn.Proto.MaxLevel;
            }

            if (Spawn.Proto.MaxLevel <= Spawn.Proto.MinLevel)
            {
                Spawn.Proto.MaxLevel = Spawn.Proto.MinLevel;
            }

            if (Spawn.Proto.MaxLevel == 0)
            {
                Spawn.Proto.MaxLevel = 1;
            }
            if (Spawn.Proto.MinLevel == 0)
            {
                Spawn.Proto.MinLevel = 1;
            }

            Level = (byte)RandomMgr.Next((int)Spawn.Proto.MinLevel, (int)Spawn.Proto.MaxLevel + 1);
            StsInterface.SetBaseStat((byte)GameData.Stats.STATS_WOUNDS, GenerateWounds(Level, Rank));
            StsInterface.ApplyStats();
            Health = TotalHealth;

            X = Zone.CalculPin((uint)(Spawn.WorldX), true);
            Y = Zone.CalculPin((uint)(Spawn.WorldY), false);
            Z = (ushort)(Spawn.WorldZ);

            /*
             * if (Zone.ZoneId == 161)
             * {
             *  Z += 16384;
             *  X += 16384;
             *  Y += 16384;
             * }
             */
            // TODO : Bad Height Formula

            /*int HeightMap = HeightMapMgr.GetHeight(Zone.ZoneId, X, Y);
             * if (Z < HeightMap)
             * {
             *  Log.Error("Creature", "["+Spawn.Entry+"] Invalid Height : Min=" + HeightMap + ",Z=" + Z);
             *  return;
             * }*/

            Heading         = (ushort)Spawn.WorldO;
            WorldPosition.X = Spawn.WorldX;
            WorldPosition.Y = Spawn.WorldY;
            WorldPosition.Z = Spawn.WorldZ;

            SetOffset((ushort)(Spawn.WorldX >> 12), (ushort)(Spawn.WorldY >> 12));
            ScrInterface.AddScript(Spawn.Proto.ScriptName);
            base.OnLoad();

            if (Spawn.Title == 0 && Spawn.Icone == 0 && Spawn.Proto.Title == 0 && Spawn.Icone == 0 && Spawn.Emote == 0 && Spawn.Proto.FinishingQuests == null && Spawn.Proto.StartingQuests == null)
            {
                if (Faction <= 1 || Faction == 128 || Faction == 129)
                {
                    SFastRandom Random = new SFastRandom(X ^ Y ^ Z);

                    for (int i = 0; i < 3; ++i)
                    {
                        Waypoint Wp = new Waypoint();
                        Wp.X           = (ushort)(X + Random.randomInt(50) + Random.randomInt(100) + Random.randomInt(150));
                        Wp.Y           = (ushort)(Y + Random.randomInt(50) + Random.randomInt(100) + Random.randomInt(150));
                        Wp.Z           = (ushort)Z;
                        Wp.Speed       = 10;
                        Wp.WaitAtEndMS = (uint)(5000 + Random.randomIntAbs(10) * 1000);
                        AiInterface.AddWaypoint(Wp);
                    }
                }
            }

            IsActive = true;
        }
Beispiel #13
0
 public override void SendMeTo(Player Plr)
 {
     ItmInterface.SendEquiped(Plr);
     SendState(Plr);
     base.SendMeTo(Plr);
 }
Beispiel #14
0
        public override void OnLoad()
        {
            InteractType = GenerateInteractType(Spawn.Title != 0 ? Spawn.Title : Spawn.Proto.Title);

            SetFaction(Spawn.Faction != 0 ? Spawn.Faction : Spawn.Proto.Faction);

            ItmInterface.Load(WorldMgr.GetCreatureItems(Spawn.Entry));
            if (Spawn.Proto.MinLevel > Spawn.Proto.MaxLevel)
            {
                Spawn.Proto.MinLevel = Spawn.Proto.MaxLevel;
            }

            if (Spawn.Proto.MaxLevel <= Spawn.Proto.MinLevel)
            {
                Spawn.Proto.MaxLevel = Spawn.Proto.MinLevel;
            }

            if (Spawn.Proto.MaxLevel == 0)
            {
                Spawn.Proto.MaxLevel = 1;
            }
            if (Spawn.Proto.MinLevel == 0)
            {
                Spawn.Proto.MinLevel = 1;
            }


            if (Spawn.Level != 0)
            {
                if (Spawn.Level > 2)
                {
                    Level = (byte)RandomMgr.Next((int)Spawn.Level - 1, Spawn.Level + 1);
                }
                else
                {
                    Level = (byte)RandomMgr.Next((int)Spawn.Level, Spawn.Level + 1);
                }
            }
            else
            {
                Level = (byte)RandomMgr.Next((int)Spawn.Proto.MinLevel, (int)Spawn.Proto.MaxLevel + 1);
            }
            StsInterface.SetBaseStat((byte)GameData.Stats.STATS_WOUNDS, GenerateWounds(Level, Rank));
            StsInterface.ApplyStats();
            Health = TotalHealth;

            X = Zone.CalculPin((uint)(Spawn.WorldX), true);
            Y = Zone.CalculPin((uint)(Spawn.WorldY), false);
            Z = (ushort)(Spawn.WorldZ);

            /*
             * if (Zone.ZoneId == 161)
             * {
             *  Z += 16384;
             *  X += 16384;
             *  Y += 16384;
             * }
             * //*/
            // TODO : Bad Height Formula

            /*
             * //int HeightMap = HeightMapMgr.GetHeight(Zone.ZoneId, X, Y);
             * int HeightMap = ClientFileMgr.GetHeight(Zone.ZoneId, X, Y);
             *
             * if (Z < HeightMap)
             * {
             *  Log.Error("Creature", "["+Spawn.Entry+"] Invalid Height : Min=" + HeightMap + ",Z=" + Z);
             *  return;
             * }*/

            Heading         = (ushort)Spawn.WorldO;
            WorldPosition.X = Spawn.WorldX;
            WorldPosition.Y = Spawn.WorldY;
            WorldPosition.Z = Spawn.WorldZ;

            SetOffset((ushort)(Spawn.WorldX >> 12), (ushort)(Spawn.WorldY >> 12));
            ScrInterface.AddScript(Spawn.Proto.ScriptName);
            base.OnLoad();

            /*AiInterface.Waypoints = WorldMgr.GetNpcWaypoints(Spawn.Guid);
             *
             * if (Spawn.Title == 0 && Spawn.Icone == 0 && Spawn.Proto.Title == 0 && Spawn.Icone == 0 && Spawn.Emote == 0 && Spawn.Proto.FinishingQuests == null && Spawn.Proto.StartingQuests == null)
             * {
             *  if (Faction <= 1 || Faction == 128 || Faction == 129)
             *  {
             *      if (AiInterface.Waypoints.Count <= 4)
             *      {
             *          int i = 0;
             *          if (AiInterface.Waypoints.Count != 0)
             *              i = AiInterface.Waypoints.Count - 1;
             *          for (; i < 3; ++i)
             *          {
             *              AiInterface.AddWaypoint(new Waypoint());
             *          }
             *      }
             *      foreach (Waypoint Wp in AiInterface.Waypoints)
             *      {
             *          AiInterface.RandomizeWaypoint(Wp);
             *      }
             *  }
             * }*/
            IsActive = true;

            if (InteractType == GameData.InteractType.INTERACTTYPE_TRAINER)
            {
                States.Add(1);
            }

            if (InteractType == GameData.InteractType.INTERACTTYPE_BANKER)
            {
                States.Add(11);                                                 // 11
            }
            if (InteractType == GameData.InteractType.INTERACTTYPE_GUILD_VAULT) // added
            {
                States.Add(0);                                                  // dont know what states are yet ?
            }
            if (InteractType == GameData.InteractType.INTERACTTYPE_AUCTIONEER)
            {
                States.Add(12);
            }

            if (InteractType == GameData.InteractType.INTERACTTYPE_GUILD_REGISTRAR)
            {
                States.Add(14);
            }

            if (InteractType == GameData.InteractType.INTERACTTYPE_FLIGHT_MASTER)
            {
                States.Add(15);
            }

            if (InteractType == GameData.InteractType.INTERACTTYPE_DYEMERCHANT)
            {
                States.Add(26);
            }
        }