protected override void BehaveCore(BehaviorCondition cond, RealmTime?time, object state) { float dist = 8; var n = 0; object o; if (Host.StateStorage.TryGetValue(Key, out o)) { n = (int)o; } else { n = 0; } if (n == 0 && GetNearestEntity(ref dist, null) != null) { Taunt("Ah, fresh meat for the minions!"); Host.StateStorage[Key] = 1; } else if (n < 2 && (Host as Character).HP < HPThreshold) { Taunt("The meat ain't supposed to bite back! Waaaaa!!"); Host.StateStorage[Key] = 2; } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime? time, object state) { if (Host.Self.Owner.Name != "Battle Arena" && Host.Self.Owner.Name != "Free Battle Arena") { if (new Random().Next(1, 100) <= percent) { var entity = Entity.Resolve(objType) as Portal; var parent = Host as Entity; entity.Move(parent.X, parent.Y); parent.Owner.EnterWorld(entity); var w = RealmManager.GetWorld(Host.Self.Owner.Id); w.Timers.Add(new WorldTimer(timeExist*1000, (world, t) => { if (timeExist > 0) try { w.LeaveWorld(entity); } catch { } })); } } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime?time, object state, string msg, Player player) { if (!adminOnly || player.Client.Account.Rank >= 2) { foreach (var s in chat) { if (msg.ToLower() == s.ToLower()) { foreach (var i in behaves) { i.Tick(Host, (RealmTime)time); } return; } } if (falseBehaves != null) { foreach (var f in falseBehaves) { f.Tick(Host, (RealmTime)time); } } } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime?time, object state) { if (cond == BehaviorCondition.OnDeath) { if (!Host.Self.BagDropped) { DamageCounter counter = (Host as Enemy).DamageCounter; var dat = counter.GetPlayerData(); Dictionary <Player, List <Item> > items = new Dictionary <Player, List <Item> >(); ProcessPublicBags(rand, dat); if (Host.Self.Owner.Name == "Battle Arena") { if (rand.Next(1, 3) == 1) { ProcessSoulBags(rand, dat); } } else { ProcessSoulBags(rand, dat); } Host.Self.BagDropped = true; } } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime? time, object state, string msg, Player player) { if (!adminOnly || player.Client.Account.Rank >= 2) { foreach (var s in chat) { if (msg.ToLower() == s.ToLower()) { foreach (var i in behaves) { i.Tick(Host, (RealmTime)time); } return; } } if (falseBehaves != null) { foreach (var f in falseBehaves) { f.Tick(Host, (RealmTime)time); } } } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime?time, object state) { float dist = 8; int n = 0; object o; if (Host.StateStorage.TryGetValue(Key, out o)) { n = (int)o; } else { n = 0; } if (n == 0 && GetNearestEntity(ref dist, null) != null) { Taunt("Time to test my power!!"); Host.StateStorage[Key] = 1; } else if (n < 2 && (Host as Character).HP < HPThreshold) { Taunt("The admin weapons will never be yours!!"); Host.StateStorage[Key] = 2; } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime? time, object state) { if (cond == BehaviorCondition.OnDeath) { if (!Host.Self.BagDropped) { var counter = (Host as Enemy).DamageCounter; var dat = counter.GetPlayerData(); var items = new Dictionary<Player, List<Item>>(); ProcessPublicBags(rand, dat); if (Host.Self.Owner.Name == "Battle Arena") { if (rand.Next(1, 5) == 1) { ProcessSoulBags(rand, dat); } } else if (Host.Self.Owner.Name == "Free Battle Arena") { if (rand.Next(1, 15) == 1) { ProcessSoulBags(rand, dat); } } else ProcessSoulBags(rand, dat); Host.Self.BagDropped = true; } } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime?time, object state) { if (Host.Self.Owner.Name != "Battle Arena" && Host.Self.Owner.Name != "Free Battle Arena" && Host.Self.Owner.Name != "Arena" && Host.Self.Owner.Name != "Nexus") { if (new Random().Next(1, 100) <= percent) { var entity = Entity.Resolve(objType) as Portal; var parent = Host as Entity; entity.Move(parent.X, parent.Y); parent.Owner.EnterWorld(entity); var w = RealmManager.GetWorld(Host.Self.Owner.Id); w.Timers.Add(new WorldTimer(timeExist * 1000, (world, t) => { if (timeExist > 0) { try { w.LeaveWorld(entity); } catch { } } })); } } }
protected override void BehaveCore(BehaviorCondition cond, realm.RealmTime? time, object state) { Enemy entity = Entity.Resolve(objType) as Enemy; Enemy parent = Host as Enemy; entity.Move(parent.X, parent.Y); entity.Terrain = (Host as Enemy).Terrain; parent.DamageCounter.Corpse = entity.DamageCounter; parent.Owner.EnterWorld(entity); }
protected override void BehaveCore(BehaviorCondition cond, realm.RealmTime?time, object state) { Enemy entity = Entity.Resolve(objType) as Enemy; Enemy parent = Host as Enemy; entity.Move(parent.X, parent.Y); entity.Terrain = (Host as Enemy).Terrain; parent.DamageCounter.Corpse = entity.DamageCounter; parent.Owner.EnterWorld(entity); }
protected override void BehaveCore(BehaviorCondition cond, RealmTime?time, object state) { if (Host.Self.State == name) { foreach (var i in behave) { i.Tick(Host, (RealmTime)time); } } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime? time, object state) { if (Host.Self.State == name) { foreach (var i in behave) { i.Tick(Host, (RealmTime)time); } } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime? time, object state) { if (cond == BehaviorCondition.OnDeath) { DamageCounter counter = (Host as Enemy).DamageCounter; var dat = counter.GetPlayerData(); Dictionary<Player, List<Item>> items = new Dictionary<Player, List<Item>>(); ProcessPublicBags(rand, dat); ProcessSoulBags(rand, dat); } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime?time, object state) { if (cond == BehaviorCondition.OnDeath) { DamageCounter counter = (Host as Enemy).DamageCounter; var dat = counter.GetPlayerData(); Dictionary <Player, List <Item> > items = new Dictionary <Player, List <Item> >(); ProcessPublicBags(rand, dat); ProcessSoulBags(rand, dat); } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime? time, object state) { var c = rand.Next(minCount, maxCount + 1); for (var i = 0; i < c; i++) { var entity = Entity.Resolve(objType); var parent = Host as Entity; entity.Move(parent.X, parent.Y); (entity as Enemy).Terrain = (Host as Enemy).Terrain; parent.Owner.EnterWorld(entity); } }
protected override void BehaveCore(BehaviorCondition cond, realm.RealmTime?time, object state) { int c = rand.Next(minCount, maxCount + 1); for (int i = 0; i < c; i++) { Entity entity = Entity.Resolve(objType); Entity parent = Host as Entity; entity.Move(parent.X, parent.Y); (entity as Enemy).Terrain = (Host as Enemy).Terrain; parent.Owner.EnterWorld(entity); } }
public void BehaveWall(Player killer, Wall w, World wallWorld) { this.Host = w; BehaviorCondition cond = BehaviorCondition.OnDeath; if (cond == BehaviorCondition.OnDeath) { wOwner = wallWorld; var dat = new Tuple <Player, int>[] { new Tuple <Player, int>(killer, 500) }; Dictionary <Player, List <Item> > items = new Dictionary <Player, List <Item> >(); ProcessPublicBags(rand, dat); ProcessSoulBags(rand, dat); } }
protected override void BehaveCore(BehaviorCondition cond, realm.RealmTime?time, object state) { float dist = 2; var entity = GetNearestEntity(ref dist, null); if (entity != null) { var chr = Host as Character; var angleInc = (2 * Math.PI) / 12; var desc = chr.ObjectDesc.Projectiles[0]; byte prjId = 0; Position prjPos = new Position() { X = chr.X, Y = chr.Y }; var dmg = chr.Random.Next(desc.MinDamage, desc.MaxDamage); for (int i = 0; i < 12; i++) { var prj = chr.CreateProjectile( desc, chr.ObjectType, dmg, time.Value.tickTimes, prjPos, (float)(angleInc * i)); chr.Owner.EnterWorld(prj); if (i == 0) { prjId = prj.ProjectileId; } } chr.Owner.BroadcastPacket(new MultiShootPacket() { BulletId = prjId, OwnerId = Host.Self.Id, BulletType = (byte)desc.BulletType, Position = prjPos, Angle = 0, Damage = (short)dmg, NumShots = 12, AngleIncrement = (float)angleInc, }, null); chr.Owner.LeaveWorld(chr); } }
// Token: 0x06001F1C RID: 7964 RVA: 0x0009E288 File Offset: 0x0009C488 public static ConfigDataBehavior.ParamData InitParamData(BehaviorCondition c, string param) { ConfigDataBehavior.ParamData paramData = new ConfigDataBehavior.ParamData(); if (c == BehaviorCondition.BehaviorCondition_EnemyHPPercentLessEqual || c == BehaviorCondition.BehaviorCondition_DistanceToMoveTargetLestEqual || c == BehaviorCondition.BehaviorCondition_SelfHPPercentLessEqual || c == BehaviorCondition.BehaviorCondition_SelfHPPercentGreaterEqual) { if (!float.TryParse(param, out paramData._float)) { return(null); } } else if (c == BehaviorCondition.BehaviorCondition_TurnN || c == BehaviorCondition.BehaviorCondition_DoingBehaviorN || c == BehaviorCondition.BehaviorCondition_FoundEnemyWithBuffN || c == BehaviorCondition.BehaviorCondition_NoEnemyWithBuffN || c == BehaviorCondition.BehaviorCondition_HeroNExist || c == BehaviorCondition.BehaviorCondition_MemberAttackedByEnemy) { if (!int.TryParse(param, out paramData._int)) { return(null); } } else if (c == BehaviorCondition.BehaviorCondition_MemberHPPercentLessEqual) { string[] array = param.Split(new char[] { ',' }); if (array.Length != 2) { return(null); } if (!int.TryParse(array[0], out paramData._int)) { return(null); } if (!float.TryParse(array[1], out paramData._float)) { return(null); } } else if (c == BehaviorCondition.BehaviorCondition_EnemyEnterMoveAndAttackRangeExcept || c == BehaviorCondition.BehaviorCondition_NoEnemyEnterMoveAndAttackRangeExcept) { ConfigDataBehavior.TryParseIntArray(param, out paramData._ints); } return(paramData); }
protected override void BehaveCore(BehaviorCondition cond, RealmTime? time, object state) { float dist = 8; int n = 0; object o; if (Host.StateStorage.TryGetValue(Key, out o)) n = (int)o; else n = 0; if (n == 0 && GetNearestEntity(ref dist, null) != null) { Taunt("Time to test my power!!"); Host.StateStorage[Key] = 1; } else if (n < 2 && (Host as Character).HP < HPThreshold) { Taunt("The admin weapons will never be yours!!"); Host.StateStorage[Key] = 2; } }
protected override void BehaveCore(BehaviorCondition cond, realm.RealmTime?time, object state) { if (new Random().Next(1, 100) <= percent) { Portal entity = Entity.Resolve(objType) as Portal; Entity parent = Host as Entity; entity.Move(parent.X, parent.Y); parent.Owner.EnterWorld(entity); World w = RealmManager.GetWorld(Host.Self.Owner.Id); w.Timers.Add(new WorldTimer(30 * 1000, (world, t) => //default portal close time * 1000 { try { w.LeaveWorld(entity); } catch //couldn't remove portal, Owner became null. Should be fixed with RealmManager implementation { Program.logger.Error("Couldn't despawn portal."); } })); } }
protected override void BehaveCore(BehaviorCondition cond, realm.RealmTime? time, object state) { if (new Random().Next(1, 100) <= percent) { Portal entity = Entity.Resolve(objType) as Portal; Entity parent = Host as Entity; entity.Move(parent.X, parent.Y); parent.Owner.EnterWorld(entity); World w = RealmManager.GetWorld(Host.Self.Owner.Id); w.Timers.Add(new WorldTimer(30 * 1000, (world, t) => //default portal close time * 1000 { try { w.LeaveWorld(entity); } catch //couldn't remove portal, Owner became null. Should be fixed with RealmManager implementation { Console.Out.WriteLine("Couldn't despawn portal."); } })); } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime? time, object state) { float dist = 8; int n = 0; object o; if (Host.StateStorage.TryGetValue(Key, out o)) n = (int)o; else n = 0; if (n == 0 && GetNearestEntity(ref dist, null) != null) { Taunt("Ah, fresh meat for the minions!"); Host.StateStorage[Key] = 1; } else if (n < 2 && (Host as Character).HP < HPThreshold) { Taunt("The meat ain't supposed to bite back! Waaaaa!!"); Host.StateStorage[Key] = 2; } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime? time, object state) { float dist = 2; var entity = GetNearestEntity(ref dist, null); if (entity != null) { var chr = Host as Character; var angleInc = (2*Math.PI)/12; var desc = chr.ObjectDesc.Projectiles[0]; byte prjId = 0; var prjPos = new Position {X = chr.X, Y = chr.Y}; var dmg = chr.Random.Next(desc.MinDamage, desc.MaxDamage); for (var i = 0; i < 12; i++) { var prj = chr.CreateProjectile( desc, chr.ObjectType, dmg, time.Value.tickTimes, prjPos, (float) (angleInc*i)); chr.Owner.EnterWorld(prj); if (i == 0) prjId = prj.ProjectileId; } chr.Owner.BroadcastPacket(new MultiShootPacket { BulletId = prjId, OwnerId = Host.Self.Id, BulletType = (byte) desc.BulletType, Position = prjPos, Angle = 0, Damage = (short) dmg, NumShots = 12, AngleIncrement = (float) angleInc, }, null); chr.Owner.LeaveWorld(chr); } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime?time, object state) { behav.Tick(Host, time.Value); }
public void Behave(BehaviorCondition cond, IBehaviorHost host, RealmTime? time, object state, params Object[] args) { this.Host = host; BehaveCore(cond, time, state, args); }
protected virtual void BehaveCore(BehaviorCondition cond, RealmTime? time, object state, string msg, Player player) { }
protected virtual void BehaveCore(BehaviorCondition cond, RealmTime? time, object state) { }
public void Behave(BehaviorCondition cond, IBehaviorHost host, RealmTime? time, object state, string msg, Player player) { this.Host = host; BehaveCore(cond, time, state, msg, player); }
public void Behave(BehaviorCondition cond, IBehaviorHost host, RealmTime? time, object state) { this.Host = host; BehaveCore(cond, time, state); }
protected override void BehaveCore(BehaviorCondition cond, RealmTime? time, object state) { var enemy = Host as Enemy; if (enemy.HP < threshold) result.Tick(Host, time.Value); else if (no != null) no.Tick(Host, time.Value); }
protected abstract void BehaveCore(BehaviorCondition cond, RealmTime? time, object state);
public ConditionalState(BehaviorCondition cond, string name, params Behavior[] behave) { this.cond = cond; this.name = name; this.behave = behave; }
protected override void BehaveCore(BehaviorCondition cond, RealmTime? time, object state) { var yes = Host.StateStorage.ContainsKey(42); var val = 0; if (yes) val = (int) Host.StateStorage[42]; if (cond == BehaviorCondition.OnHit) { if (!yes) Host.StateStorage[42] = val = 1; var hp = (Host as Enemy).HP; if (hp < 170 && val > 0) { Taunt("Engaging Super-Mode!!!"); Host.Self.Owner.BroadcastPacket(new ShowEffectPacket { EffectType = EffectType.Flashing, PosA = new Position {X = 3, Y = 1000000}, TargetId = Host.Self.Id, Color = new ARGB(0xffffff00) }, null); Host.StateStorage[42] = -1; } } else { var host = Host as Enemy; if (val > 0 && val <= 250) { if (val == 1) { var rand = new Random(); var count = rand.Next(4, 8); Debug.WriteLine(count); for (var i = 0; i < count; i++) { var entity = Entity.Resolve(0x7f01); entity.Move(Host.Self.X, Host.Self.Y); Host.Self.Owner.EnterWorld(entity); } } val += time.Value.thisTickTimes; Host.StateStorage[42] = val; if (host.AltTextureIndex != 2) { host.AltTextureIndex = 2; host.UpdateCount++; } } else if (val > 250) { if (host.AltTextureIndex != 1) { host.AltTextureIndex = 1; host.UpdateCount++; } } else if (val < 0) { if (host.AltTextureIndex != 4) { host.AltTextureIndex = 4; host.UpdateCount++; } } else { var oldIndex = host.AltTextureIndex; var newIndex = 0 + ((int) ((time.Value.tickTimes/1000)%2)*3); if (newIndex != oldIndex) { host.AltTextureIndex = newIndex; host.UpdateCount++; } } } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime? time, object state, Object[] args) { if (args.Length != 3) return; string msg = args[0] as string; Player player = args[1] as Player; if (!adminOnly || player.Client.Account.Rank >= 2) { foreach (var s in chat) { if (msg.ToLower().Contains(s.ToLower())) { foreach (var i in behaves) { i.Tick(Host, (RealmTime)time); } if (setNPCFollowing) (Host.Self as NPC).NPCFollowing = player; return; } } if (falseBehaves != null) { foreach (var f in falseBehaves) { f.Tick(Host, (RealmTime)time); } } } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime?time, object state) { bool yes = Host.StateStorage.ContainsKey(42); int val = 0; if (yes) { val = (int)Host.StateStorage[42]; } if (cond == BehaviorCondition.OnHit) { if (!yes) { Host.StateStorage[42] = val = 1; } int hp = (Host as Enemy).HP; if (hp < 170 && val > 0) { Taunt("Engaging Super-Mode!!!"); Host.Self.Owner.BroadcastPacket(new ShowEffectPacket() { EffectType = EffectType.Flashing, PosA = new Position() { X = 3, Y = 1000000 }, TargetId = Host.Self.Id, Color = new ARGB(0xffffff00) }, null); Host.StateStorage[42] = -1; } } else { var host = Host as Enemy; if (val > 0 && val <= 250) { if (val == 1) { Random rand = new Random(); int count = rand.Next(4, 8); System.Diagnostics.Debug.WriteLine(count); for (int i = 0; i < count; i++) { Entity entity = Entity.Resolve(0x7f01); entity.Move(Host.Self.X, Host.Self.Y); Host.Self.Owner.EnterWorld(entity); } } val += time.Value.thisTickTimes; Host.StateStorage[42] = val; if (host.AltTextureIndex != 2) { host.AltTextureIndex = 2; host.UpdateCount++; } } else if (val > 250) { if (host.AltTextureIndex != 1) { host.AltTextureIndex = 1; host.UpdateCount++; } } else if (val < 0) { if (host.AltTextureIndex != 4) { host.AltTextureIndex = 4; host.UpdateCount++; } } else { int oldIndex = host.AltTextureIndex; int newIndex = 0 + ((int)((time.Value.tickTimes / 1000) % 2) * 3); if (newIndex != oldIndex) { host.AltTextureIndex = newIndex; host.UpdateCount++; } } } }
protected override void BehaveCore(BehaviorCondition cond, RealmTime? time, object state) { behav.Tick(Host, time.Value); }
public void Behave(BehaviorCondition cond, IBehaviorHost host, RealmTime? time, object state, string msg) { Host = host; BehaveCore(cond, time, state, msg); }