Ejemplo n.º 1
0
        public SimpleNpc(int id, BaseGame game, NpcInfo npcInfo, int type)
            : base(id, game, npcInfo.Camp, npcInfo.Name, npcInfo.ModelID, npcInfo.Blood, npcInfo.Immunity, -1)
        {
            if (type == 0)
            {
                Type = eLivingType.SimpleNpc;
            }
            else
            {
                Type = eLivingType.SimpleNpc1;
            }
            m_npcInfo = npcInfo;

            m_ai = ScriptMgr.CreateInstance(npcInfo.Script) as ABrain;
            if (m_ai == null)
            {
                log.ErrorFormat("Can't create abrain :{0}", npcInfo.Script);
                m_ai = SimpleBrain.Simple;
            }
            m_ai.Game = m_game;
            m_ai.Body = this;
            try
            {
                m_ai.OnCreated();
            }
            catch (Exception ex)
            {
                log.ErrorFormat("SimpleNpc Created error:{1}", ex);
            }
        }
Ejemplo n.º 2
0
 public SimpleNpc(int id, BaseGame game, NpcInfo npcInfo, int direction, int type)
     : base(id, game, npcInfo.Camp, npcInfo.Name, npcInfo.ModelID, npcInfo.Blood, npcInfo.Immunity, direction)
 {
     if (type == 0)
     {
         base.Type = eLivingType.SimpleNpcSpecial;
     }
     else
     {
         base.Type = eLivingType.SimpleNpcNormal;
     }
     this.m_npcInfo = npcInfo;
     this.m_ai      = (ScriptMgr.CreateInstance(npcInfo.Script) as ABrain);
     if (this.m_ai == null)
     {
         SimpleNpc.log.ErrorFormat("Can't create abrain :{0}", npcInfo.Script);
         this.m_ai = SimpleBrain.Simple;
     }
     this.m_ai.Game = this.m_game;
     this.m_ai.Body = this;
     try
     {
         this.m_ai.OnCreated();
     }
     catch (Exception arg)
     {
         SimpleNpc.log.ErrorFormat("SimpleNpc Created error:{1}", arg);
     }
 }
Ejemplo n.º 3
0
 public SimpleBoss(int id, BaseGame game, NpcInfo npcInfo, int direction, int type, string actions)
     : base(id, game, npcInfo.Camp, npcInfo.Name, npcInfo.ModelID, npcInfo.Blood, npcInfo.Immunity, direction)
 {
     if (type == 0)
     {
         base.Type = eLivingType.SimpleBossSpecial;
     }
     if (type == 10)
     {
         base.Type = eLivingType.SimpleNpcNormal;
     }
     else
     {
         base.Type = eLivingType.SimpleBossHard;
     }
     base.ActionStr     = actions;
     this.m_mostHateful = new Dictionary <Player, int>();
     this.m_npcInfo     = npcInfo;
     this.m_ai          = (ScriptMgr.CreateInstance(npcInfo.Script) as ABrain);
     if (this.m_ai == null)
     {
         SimpleBoss.log.ErrorFormat("Can't create abrain :{0}", npcInfo.Script);
         this.m_ai = SimpleBrain.Simple;
     }
     this.m_ai.Game = this.m_game;
     this.m_ai.Body = this;
     try
     {
         this.m_ai.OnCreated();
     }
     catch (Exception arg)
     {
         SimpleBoss.log.ErrorFormat("SimpleBoss Created error:{1}", arg);
     }
 }
Ejemplo n.º 4
0
        public void SetBrain(ABrain newBrain)
        {
            CurrentBrain?.Stop();

            CurrentBrain = newBrain;

            if (Aggros == null)
            {
                Aggros = new Dictionary <ushort, AggroInfo>();
            }

            CurrentBrain?.Start(Aggros);
        }
Ejemplo n.º 5
0
 public SimpleNpc(int id, BaseGame game, NpcInfo npcInfo, int type, int direction, int rank) : base(id, game, npcInfo.Camp, npcInfo.Name, npcInfo.ModelID, npcInfo.Blood, npcInfo.Immunity, direction, npcInfo.MaxBeatDis)
 {
     if (type == 0)
     {
         base.Type = eLivingType.SimpleNpc;
     }
     else
     {
         if (type == 1)
         {
             base.Type = eLivingType.SimpleNpcNormal;
         }
         else
         {
             if (type == 2)
             {
                 base.Type = eLivingType.SimpleNpcDeck;
             }
             else
             {
                 if (type == 3)
                 {
                     base.Type = eLivingType.SimpleWingNpc;
                 }
             }
         }
     }
     this.m_npcInfo = npcInfo;
     this.m_ai      = (ScriptMgr.CreateInstance(npcInfo.Script) as ABrain);
     if (this.m_ai == null)
     {
         if (this.m_npcInfo.Type != 3)
         {
             SimpleNpc.log.ErrorFormat("Can't create abrain :{0}", npcInfo.Script);
         }
         this.m_ai = SimpleBrain.Simple;
     }
     this.m_ai.Game = this.m_game;
     this.m_ai.Body = this;
     this.m_rank    = rank;
     this.Reset();
     try
     {
         this.m_ai.OnCreated();
     }
     catch (Exception ex)
     {
         SimpleNpc.log.ErrorFormat("SimpleNpc Created error:{0}", ex);
     }
 }
Ejemplo n.º 6
0
        public void CheckGuardHate(ABrain monsterBrain, ref uint hateCaused)
        {
            if (_guardBuffs == null)
            {
                return;
            }

            foreach (GuardBuff g in _guardBuffs)
            {
                if (g.SplitHate(monsterBrain, ref hateCaused))
                {
                    return;
                }
            }
        }
Ejemplo n.º 7
0
        public bool SplitHate(ABrain monsterBrain, ref uint hateCaused)
        {
            if (Caster.IsDead || !Caster.ObjectWithinRadiusFeet(Target, 30))
            {
                return(false);
            }

            uint myHate = (uint)(hateCaused * _hateSplitFactor);

            hateCaused -= myHate;

            monsterBrain.AddHatred(Caster, true, myHate);

            return(true);
        }
Ejemplo n.º 8
0
 public SimpleBoss(int id, BaseGame game, NpcInfo npcInfo, int direction, int type) : base(id, game, npcInfo.Camp, npcInfo.Name, npcInfo.ModelID, npcInfo.Blood, npcInfo.Immunity, direction, npcInfo.MaxBeatDis)
 {
     if (type == 0)
     {
         base.Type = eLivingType.SimpleBoss;
     }
     if (type == 1)
     {
         base.Type = eLivingType.SimpleBossNormal;
     }
     if (type == 2)
     {
         base.Type = eLivingType.SimpleBossHard;
     }
     if (type == 3)
     {
         base.Type = eLivingType.SimpleLongNpc;
     }
     this.m_mostHateful = new Dictionary <Player, int>();
     this.m_npcInfo     = npcInfo;
     this.m_ai          = (ScriptMgr.CreateInstance(npcInfo.Script) as ABrain);
     if (this.m_ai == null)
     {
         SimpleBoss.log.ErrorFormat("Can't create abrain :{0}", npcInfo.Script);
         this.m_ai = SimpleBrain.Simple;
     }
     this.m_ai.Game         = this.m_game;
     this.m_ai.Body         = this;
     this.SimpleBossShooted = (SimpleBoss.SimpleBossShootedEventHanld)Delegate.Combine(this.SimpleBossShooted, new SimpleBoss.SimpleBossShootedEventHanld(this.ShootedSay));
     try
     {
         this.m_ai.OnCreated();
     }
     catch (Exception ex)
     {
         SimpleBoss.log.ErrorFormat("SimpleBoss Created error:{0}", ex);
     }
 }
Ejemplo n.º 9
0
 public NormalBoss(int id, BaseGame game, SqlDataProvider.Data.NpcInfo npcInfo, int direction, int type) : base(id, game, npcInfo.Camp, npcInfo.Name, npcInfo.ModelID, npcInfo.Blood, npcInfo.Immunity, direction)
 {
     this.m_child = new List <SimpleNpc>();
     this.m_boss  = new List <SimpleBoss>();
     this.m_npc   = new List <NormalNpc>();
     if (type == 0)
     {
         base.Type = eLivingType.SimpleBossSpecial;
     }
     if (type == 10)
     {
         base.Type = eLivingType.SimpleNpcNormal;
     }
     else
     {
         base.Type = eLivingType.SimpleBossHard;
     }
     this.m_mostHateful = new Dictionary <Player, int>();
     this.m_npcInfo     = npcInfo;
     this.m_ai          = ScriptMgr.CreateInstance(npcInfo.Script) as ABrain;
     if (this.m_ai == null)
     {
         log.ErrorFormat("Can't create abrain :{0}", npcInfo.Script);
         this.m_ai = SimpleBrain.Simple;
     }
     this.m_ai.Game = base.m_game;
     this.m_ai.Body = this;
     try
     {
         this.m_ai.OnCreated();
     }
     catch (Exception ex)
     {
         log.ErrorFormat("SimpleBoss Created error:{1}", ex);
     }
 }
Ejemplo n.º 10
0
 public Doppelganger(ABrain defaultBrain) : base(defaultBrain)
 {
 }
Ejemplo n.º 11
0
 public FakeNPC(ABrain defaultBrain) : base(defaultBrain)
 {
     this.ObjectState = eObjectState.Active;
 }
Ejemplo n.º 12
0
 public FakeNPC(ABrain defaultBrain) : base(defaultBrain)
 {
 }
Ejemplo n.º 13
0
 public GamePet(ABrain brain) : base(brain)
 {
 }
Ejemplo n.º 14
0
        public void SetVariables(GameNPC mob)
        {
            mob.X               = this.X + 10;
            mob.Y               = this.Y + 10;
            mob.Z               = this.Z;
            mob.CurrentRegion   = this.CurrentRegion;
            mob.Heading         = this.Heading;
            mob.Level           = this.Level;
            mob.Realm           = this.Realm;
            mob.Name            = "Dork's Minion";
            mob.Model           = this.Model;
            mob.Flags           = this.Flags;
            mob.MeleeDamageType = this.MeleeDamageType;
            mob.RespawnInterval = -1; // dont respawn
            mob.RoamingRange    = this.RoamingRange;
            mob.MaxDistance     = 4000;

            // also copies the stats

            mob.Strength     = this.Strength;
            mob.Constitution = this.Constitution;
            mob.Dexterity    = this.Dexterity;
            mob.Quickness    = this.Quickness;
            mob.Intelligence = this.Intelligence;
            mob.Empathy      = this.Empathy;
            mob.Piety        = this.Piety;
            mob.Charisma     = this.Charisma;

            //Fill the living variables
            mob.CurrentSpeed = 0;

            mob.MaxSpeedBase        = this.MaxSpeedBase;
            mob.Size                = this.Size;
            mob.NPCTemplate         = this.NPCTemplate;
            mob.Inventory           = this.Inventory;
            mob.EquipmentTemplateID = this.EquipmentTemplateID;
            if (mob.Inventory != null)
            {
                mob.SwitchWeapon(this.ActiveWeaponSlot);
            }

            ABrain brain = null;

            foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                brain = (ABrain)assembly.CreateInstance(this.Brain.GetType().FullName, true);
                if (brain != null)
                {
                    break;
                }
            }

            if (brain == null)
            {
                mob.SetOwnBrain(new StandardMobBrain());
            }
            else if (brain is StandardMobBrain)
            {
                StandardMobBrain sbrain  = (StandardMobBrain)brain;
                StandardMobBrain tsbrain = (StandardMobBrain)this.Brain;
                sbrain.AggroLevel = tsbrain.AggroLevel;
                sbrain.AggroRange = tsbrain.AggroRange;
                mob.SetOwnBrain(sbrain);
            }
        }
Ejemplo n.º 15
0
 public GameSummoner(ABrain defaultBrain) : base(defaultBrain)
 {
 }
Ejemplo n.º 16
0
 public Executions(Unit owner, CombatInterface_Npc combat, ABrain brain)
 {
     Owner  = owner;
     Combat = combat;
     Brain  = brain;
 }