public CreatureAI_Onyxia(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { Phase = 0; AllowedMove = false; Creature.Flying = false; Creature.VisibleDistance = 700f; }
public CreatureAI_Golemagg_the_Incinerator(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { Phase = 0; AllowedMove = false; Creature.Flying = false; Creature.VisibleDistance = 700f; }
// Public Next_Summon_1 As Integer = 0 // Public Next_Summon_2 As Integer = 0 public CreatureAI_Kurinnax(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { phase = 0; AllowedMove = false; Creature.Flying = false; Creature.VisibleDistance = 700; }
public StandStillAI(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { if (Creature is null) { throw new ArgumentNullException(nameof(Creature)); } AllowedMove = false; }
public CritterAI(ref WS_Creatures.CreatureObject Creature) { aiCreature = null; aiTimer = 0; CombatTimer = 0; WasAlive = true; State = AIState.AI_WANDERING; aiCreature = Creature ?? throw new ArgumentNullException(nameof(Creature)); aiTarget = null; }
public GuardWaypointAI(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { if (Creature is null) { throw new ArgumentNullException(nameof(Creature)); } CurrentWaypoint = -1; AllowedMove = true; IsWaypoint = true; }
public void HealGluth(ref WS_Creatures.CreatureObject NPC_Gluth, ref WS_Creatures.CreatureObject Zombie_Chow) { coords Waypoint1 = new() { X = 3304.919922d, Y = 3139.149902d, Z = 296.890015d, Orientation = 1.33d }; aiCreature.MoveTo((float)Waypoint1.X, (float)Waypoint1.Y, (float)Waypoint1.Z, (float)Waypoint1.Orientation); if (Conversions.ToBoolean(aiCreature.MoveTo((float)Waypoint1.X, (float)Waypoint1.Y, (float)Waypoint1.Z, (float)Waypoint1.Orientation, true))) { WS_Base.BaseUnit argAttacker = null; aiCreature.Heal(50000, Attacker: argAttacker); } }
public DefaultAI(ref WS_Creatures.CreatureObject Creature) { aiCreature = null; aiTimer = 0; nextAttack = 0; ignoreLoot = false; AllowedAttack = true; AllowedMove = true; IsWaypoint = false; ResetX = 0f; ResetY = 0f; ResetZ = 0f; ResetO = 0f; ResetRun = true; ResetFinished = false; LastHitX = 0f; LastHitY = 0f; LastHitZ = 0f; State = AIState.AI_WANDERING; aiCreature = Creature ?? throw new ArgumentNullException(nameof(Creature)); aiTarget = null; }
public CreatureAI_Druid_of_the_Fang(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { AllowedMove = false; Creature.Flying = false; Creature.VisibleDistance = 700f; }
// Public NextExplosion As Integer = 0 public CreatureAI_Arcanist_Doan(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { AllowedMove = false; Creature.Flying = false; Creature.VisibleDistance = 700f; }
public CreatureAI_Earthborer(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { AllowedMove = false; Creature.Flying = false; Creature.VisibleDistance = 700f; }
public CreatureAI_Zombie_Chow(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { AllowedMove = false; Creature.Flying = false; Creature.VisibleDistance = 700f; }
public CreatureAI_Taragaman_the_Hungerer(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { AllowedMove = false; Creature.Flying = false; Creature.VisibleDistance = 700f; }
public void AddToPacket(ref PacketClass packet, ObjectUpdateType updateType, ref WS_Creatures.CreatureObject updateObject) { checked { packet.AddInt8((byte)updateType); packet.AddPackGUID(updateObject.GUID); if (updateType == ObjectUpdateType.UPDATETYPE_CREATE_OBJECT) { packet.AddInt8(3); } if (updateType is ObjectUpdateType.UPDATETYPE_CREATE_OBJECT or ObjectUpdateType.UPDATETYPE_MOVEMENT) { packet.AddInt8(112); packet.AddInt32(8388608); packet.AddInt32(WorldServiceLocator._WS_Network.MsTime()); packet.AddSingle(updateObject.positionX); packet.AddSingle(updateObject.positionY); packet.AddSingle(updateObject.positionZ); packet.AddSingle(updateObject.orientation); packet.AddSingle(0f); packet.AddSingle(WorldServiceLocator._WorldServer.CREATURESDatabase[updateObject.ID].WalkSpeed); packet.AddSingle(WorldServiceLocator._WorldServer.CREATURESDatabase[updateObject.ID].RunSpeed); packet.AddSingle(WorldServiceLocator._Global_Constants.UNIT_NORMAL_SWIM_BACK_SPEED); packet.AddSingle(WorldServiceLocator._Global_Constants.UNIT_NORMAL_SWIM_SPEED); packet.AddSingle(WorldServiceLocator._Global_Constants.UNIT_NORMAL_WALK_BACK_SPEED); packet.AddSingle(WorldServiceLocator._Global_Constants.UNIT_NORMAL_TURN_RATE); packet.AddUInt32(1u); } if (updateType is ObjectUpdateType.UPDATETYPE_CREATE_OBJECT or ObjectUpdateType.UPDATETYPE_VALUES) { var updateCount = 0; var num = UpdateMask.Count - 1; for (var i = 0; i <= num; i++) { if (UpdateMask.Get(i)) { updateCount = i; } } packet.AddInt8((byte)(checked (updateCount + 32) / 32)); packet.AddBitArray(UpdateMask, checked ((byte)(checked (updateCount + 32) / 32)) * 4); var num2 = UpdateMask.Count - 1; for (var j = 0; j <= num2; j++) { if (UpdateMask.Get(j)) { if (UpdateData[j] is uint) { packet.AddUInt32(Conversions.ToUInteger(UpdateData[j])); } else if (UpdateData[j] is float) { packet.AddSingle(Conversions.ToSingle(UpdateData[j])); } else { packet.AddInt32(Conversions.ToInteger(UpdateData[j])); } } } UpdateMask.SetAll(value: false); } if (packet is UpdatePacketClass @class) { @class.UpdatesCount++; } } }
public void On_CMSG_TEXT_EMOTE(ref Packets.PacketClass packet, ref WS_Network.ClientClass client) { checked { if (packet.Data.Length - 1 < 21 && client.Character != null) { return; } packet.GetInt16(); int TextEmote = packet.GetInt32(); int Unk = packet.GetInt32(); ulong GUID = packet.GetUInt64(); WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_TEXT_EMOTE [TextEmote={2} Unk={3}]", client.IP, client.Port, TextEmote, Unk); if (WorldServiceLocator._CommonGlobalFunctions.GuidIsCreature(GUID) && WorldServiceLocator._WorldServer.WORLD_CREATUREs.ContainsKey(GUID)) { WS_Quests aLLQUESTS = WorldServiceLocator._WorldServer.ALLQUESTS; ref WS_PlayerData.CharacterObject character = ref client.Character; Dictionary <ulong, WS_Creatures.CreatureObject> wORLD_CREATUREs; ulong key; WS_Creatures.CreatureObject creature = (wORLD_CREATUREs = WorldServiceLocator._WorldServer.WORLD_CREATUREs)[key = GUID]; aLLQUESTS.OnQuestDoEmote(ref character, ref creature, TextEmote); wORLD_CREATUREs[key] = creature; if (WorldServiceLocator._WorldServer.WORLD_CREATUREs[GUID].aiScript != null && WorldServiceLocator._WorldServer.WORLD_CREATUREs[GUID].aiScript is WS_Creatures_AI.GuardAI) { ((WS_Creatures_AI.GuardAI)WorldServiceLocator._WorldServer.WORLD_CREATUREs[GUID].aiScript).OnEmote(TextEmote); } } if (WorldServiceLocator._WS_DBCDatabase.EmotesText.ContainsKey(TextEmote)) { if (WorldServiceLocator._WS_DBCDatabase.EmotesState[WorldServiceLocator._WS_DBCDatabase.EmotesText[TextEmote]] == 0) { client.Character.DoEmote(WorldServiceLocator._WS_DBCDatabase.EmotesText[TextEmote]); } else if (WorldServiceLocator._WS_DBCDatabase.EmotesState[WorldServiceLocator._WS_DBCDatabase.EmotesText[TextEmote]] == 2) { client.Character.cEmoteState = WorldServiceLocator._WS_DBCDatabase.EmotesText[TextEmote]; client.Character.SetUpdateFlag(148, client.Character.cEmoteState); client.Character.SendCharacterUpdate(); } } string secondName = ""; if (decimal.Compare(new decimal(GUID), 0m) > 0) { if (WorldServiceLocator._WorldServer.CHARACTERs.ContainsKey(GUID)) { secondName = WorldServiceLocator._WorldServer.CHARACTERs[GUID].Name; } else if (WorldServiceLocator._WorldServer.WORLD_CREATUREs.ContainsKey(GUID)) { secondName = WorldServiceLocator._WorldServer.WORLD_CREATUREs[GUID].Name; } } Packets.PacketClass SMSG_TEXT_EMOTE = new Packets.PacketClass(Opcodes.SMSG_TEXT_EMOTE); try { SMSG_TEXT_EMOTE.AddUInt64(client.Character.GUID); SMSG_TEXT_EMOTE.AddInt32(TextEmote); SMSG_TEXT_EMOTE.AddInt32(255); SMSG_TEXT_EMOTE.AddInt32(secondName.Length + 1); SMSG_TEXT_EMOTE.AddString(secondName); client.Character.SendToNearPlayers(ref SMSG_TEXT_EMOTE); } finally { SMSG_TEXT_EMOTE.Dispose(); } }
public BossAI(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { }
public virtual void OnQuestEmote(ref WS_PlayerData.CharacterObject objCharacter, ref WS_Creatures.CreatureObject Creature, int EmoteID) { }
public virtual void OnQuestCastSpell(ref WS_PlayerData.CharacterObject objCharacter, ref WS_Creatures.CreatureObject Creature, int SpellID) { }
public virtual void OnQuestKill(ref WS_PlayerData.CharacterObject objCharacter, ref WS_Creatures.CreatureObject Creature) { }
public WaypointAI(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { CurrentWaypoint = -1; IsWaypoint = true; }
public void LoadSpawns(byte TileX, byte TileY, uint TileMap, uint TileInstance) { checked { float MinX = (32 - TileX) * WorldServiceLocator._Global_Constants.SIZE; float MaxX = (32 - (TileX + 1)) * WorldServiceLocator._Global_Constants.SIZE; float MinY = (32 - TileY) * WorldServiceLocator._Global_Constants.SIZE; float MaxY = (32 - (TileY + 1)) * WorldServiceLocator._Global_Constants.SIZE; if (MinX > MaxX) { float tmpSng2 = MinX; MinX = MaxX; MaxX = tmpSng2; } if (MinY > MaxY) { float tmpSng = MinY; MinY = MaxY; MaxY = tmpSng; } ulong InstanceGuidAdd = 0uL; if (TileInstance > 0L) { InstanceGuidAdd = Convert.ToUInt64(decimal.Add(new decimal(1000000L), decimal.Multiply(new decimal(TileInstance - 1L), new decimal(100000L)))); } DataTable MysqlQuery = new DataTable(); WorldServiceLocator._WorldServer.WorldDatabase.Query($"SELECT * FROM creature LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid WHERE map={TileMap} AND position_X BETWEEN '{MinX}' AND '{MaxX}' AND position_Y BETWEEN '{MinY}' AND '{MaxY}';", ref MysqlQuery); IEnumerator enumerator = default; try { enumerator = MysqlQuery.Rows.GetEnumerator(); while (enumerator.MoveNext()) { DataRow row = (DataRow)enumerator.Current; if (WorldServiceLocator._WorldServer.WORLD_CREATUREs.ContainsKey(Convert.ToUInt64(decimal.Add(decimal.Add(new decimal(row.As <long>("guid")), new decimal(InstanceGuidAdd)), new decimal(WorldServiceLocator._Global_Constants.GUID_UNIT))))) { continue; } try { WS_Creatures.CreatureObject tmpCr = new WS_Creatures.CreatureObject(Convert.ToUInt64(decimal.Add(new decimal(row.As <long>("guid")), new decimal(InstanceGuidAdd))), row); if (tmpCr.GameEvent == 0) { tmpCr.instance = TileInstance; tmpCr.AddToWorld(); } } catch (Exception ex5) { ProjectData.SetProjectError(ex5); Exception ex4 = ex5; WorldServiceLocator._WorldServer.Log.WriteLine(LogType.CRITICAL, "Error when creating creature [{0}].{1}{2}", row["id"], Environment.NewLine, ex4.ToString()); ProjectData.ClearProjectError(); } } } finally { if (enumerator is IDisposable) { (enumerator as IDisposable).Dispose(); } } MysqlQuery.Clear(); WorldServiceLocator._WorldServer.WorldDatabase.Query($"SELECT * FROM gameobject LEFT OUTER JOIN game_event_gameobject ON gameobject.guid = game_event_gameobject.guid WHERE map={TileMap} AND spawntimesecs>=0 AND position_X BETWEEN '{MinX}' AND '{MaxX}' AND position_Y BETWEEN '{MinY}' AND '{MaxY}';", ref MysqlQuery); IEnumerator enumerator2 = default; try { enumerator2 = MysqlQuery.Rows.GetEnumerator(); while (enumerator2.MoveNext()) { DataRow row = (DataRow)enumerator2.Current; if (WorldServiceLocator._WorldServer.WORLD_GAMEOBJECTs.ContainsKey(row.As <ulong>("guid") + InstanceGuidAdd + WorldServiceLocator._Global_Constants.GUID_GAMEOBJECT) || WorldServiceLocator._WorldServer.WORLD_GAMEOBJECTs.ContainsKey(row.As <ulong>("guid") + InstanceGuidAdd + WorldServiceLocator._Global_Constants.GUID_TRANSPORT)) { continue; } try { WS_GameObjects.GameObjectObject tmpGo = new WS_GameObjects.GameObjectObject(row.As <ulong>("guid") + InstanceGuidAdd, row); if (tmpGo.GameEvent == 0) { tmpGo.instance = TileInstance; tmpGo.AddToWorld(); } } catch (Exception ex6) { ProjectData.SetProjectError(ex6); Exception ex3 = ex6; WorldServiceLocator._WorldServer.Log.WriteLine(LogType.CRITICAL, "Error when creating gameobject [{0}].{1}{2}", row["id"], Environment.NewLine, ex3.ToString()); ProjectData.ClearProjectError(); } } } finally { if (enumerator2 is IDisposable) { (enumerator2 as IDisposable).Dispose(); } } MysqlQuery.Clear(); WorldServiceLocator._WorldServer.CharacterDatabase.Query(string.Format("SELECT * FROM corpse WHERE map={0} AND instance={5} AND position_x BETWEEN '{1}' AND '{2}' AND position_y BETWEEN '{3}' AND '{4}';", TileMap, MinX, MaxX, MinY, MaxY, TileInstance), ref MysqlQuery); IEnumerator enumerator3 = default; try { enumerator3 = MysqlQuery.Rows.GetEnumerator(); while (enumerator3.MoveNext()) { DataRow InfoRow = (DataRow)enumerator3.Current; if (!WorldServiceLocator._WorldServer.WORLD_CORPSEOBJECTs.ContainsKey(Conversions.ToULong(InfoRow["guid"]) + WorldServiceLocator._Global_Constants.GUID_CORPSE)) { try { WS_Corpses.CorpseObject tmpCorpse = new WS_Corpses.CorpseObject(Conversions.ToULong(InfoRow["guid"]), InfoRow) { instance = TileInstance }; tmpCorpse.AddToWorld(); } catch (Exception ex7) { ProjectData.SetProjectError(ex7); Exception ex2 = ex7; WorldServiceLocator._WorldServer.Log.WriteLine(LogType.CRITICAL, "Error when creating corpse [{0}].{1}{2}", InfoRow["guid"], Environment.NewLine, ex2.ToString()); ProjectData.ClearProjectError(); } } } } finally { if (enumerator3 is IDisposable) { (enumerator3 as IDisposable).Dispose(); } } try { WorldServiceLocator._WorldServer.WORLD_TRANSPORTs_Lock.AcquireReaderLock(1000); foreach (KeyValuePair <ulong, WS_Transports.TransportObject> Transport in WorldServiceLocator._WorldServer.WORLD_TRANSPORTs) { try { if (Transport.Value.MapID == TileMap && Transport.Value.positionX >= MinX && Transport.Value.positionX <= MaxX && Transport.Value.positionY >= MinY && Transport.Value.positionY <= MaxY) { if (!Maps[TileMap].Tiles[TileX, TileY].GameObjectsHere.Contains(Transport.Value.GUID)) { Maps[TileMap].Tiles[TileX, TileY].GameObjectsHere.Add(Transport.Value.GUID); } Transport.Value.NotifyEnter(); } } catch (Exception ex8) { ProjectData.SetProjectError(ex8); Exception ex = ex8; WorldServiceLocator._WorldServer.Log.WriteLine(LogType.CRITICAL, "Error when creating transport [{0}].{1}{2}", Transport.Key - WorldServiceLocator._Global_Constants.GUID_MO_TRANSPORT, Environment.NewLine, ex.ToString()); ProjectData.ClearProjectError(); } } } catch (Exception projectError) { ProjectData.SetProjectError(projectError); ProjectData.ClearProjectError(); } finally { WorldServiceLocator._WorldServer.WORLD_TRANSPORTs_Lock.ReleaseReaderLock(); } } }
public CreatureAI(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) // The following under this are very self explanatory, on spawn the creature will not move by itself nor fly. It will be visible from far away. This can be changed. { AllowedMove = false; Creature.Flying = false; Creature.VisibleDistance = 700f; }
public CreatureAI_Ragefire_Shaman(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { AllowedMove = false; Creature.Flying = false; Creature.VisibleDistance = 700f; }
public CreatureAI_Targorr_the_Dread(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { AllowedMove = false; Creature.Flying = false; Creature.VisibleDistance = 700f; }
public CreatureAI_Searing_Blade_Cultist(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { AllowedMove = false; Creature.Flying = false; Creature.VisibleDistance = 700f; }
public CreatureAI_Baron_Geddon(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { AllowedMove = false; Creature.Flying = false; Creature.VisibleDistance = 700f; }
private void Update(object state) { if (SpellManagerWorking) { WorldServiceLocator._WorldServer.Log.WriteLine(LogType.WARNING, "Update: Spell Manager skipping update"); return; } SpellManagerWorking = true; checked { try { WorldServiceLocator._WorldServer.WORLD_CREATUREs_Lock.AcquireReaderLock(WorldServiceLocator._Global_Constants.DEFAULT_LOCK_TIMEOUT); long num = WorldServiceLocator._WorldServer.WORLD_CREATUREsKeys.Count - 1; for (long i = 0L; i <= num; i++) { WS_Creatures.CreatureObject creatureObject = WorldServiceLocator._WorldServer.WORLD_CREATUREs[Conversions.ToULong(WorldServiceLocator._WorldServer.WORLD_CREATUREsKeys[(int)i])]; if (creatureObject != null) { ulong key; Dictionary <ulong, WS_Creatures.CreatureObject> wORLD_CREATUREs; object value = WorldServiceLocator._WorldServer.WORLD_CREATUREsKeys[(int)i]; WS_Base.BaseUnit objCharacter = (wORLD_CREATUREs = WorldServiceLocator._WorldServer.WORLD_CREATUREs)[key = Conversions.ToULong(value)]; UpdateSpells(ref objCharacter); wORLD_CREATUREs[key] = (WS_Creatures.CreatureObject)objCharacter; } } } catch (Exception ex4) { ProjectData.SetProjectError(ex4); Exception ex3 = ex4; WorldServiceLocator._WorldServer.Log.WriteLine(LogType.FAILED, ex3.ToString(), null); ProjectData.ClearProjectError(); } finally { if (WorldServiceLocator._WorldServer.WORLD_CREATUREs_Lock.IsReaderLockHeld) { WorldServiceLocator._WorldServer.WORLD_CREATUREs_Lock.ReleaseReaderLock(); } } try { WorldServiceLocator._WorldServer.CHARACTERs_Lock.AcquireReaderLock(WorldServiceLocator._Global_Constants.DEFAULT_LOCK_TIMEOUT); foreach (var Character in WorldServiceLocator._WorldServer.CHARACTERs.Where(Character => Character.Value != null)) { WS_Base.BaseUnit objCharacter = Character.Value; UpdateSpells(ref objCharacter); } } catch (Exception ex5) { ProjectData.SetProjectError(ex5); Exception ex2 = ex5; WorldServiceLocator._WorldServer.Log.WriteLine(LogType.FAILED, ex2.ToString(), null); ProjectData.ClearProjectError(); } finally { WorldServiceLocator._WorldServer.CHARACTERs_Lock.ReleaseReaderLock(); } List <WS_DynamicObjects.DynamicObjectObject> DynamicObjectsToDelete = new List <WS_DynamicObjects.DynamicObjectObject>(); try { WorldServiceLocator._WorldServer.WORLD_DYNAMICOBJECTs_Lock.AcquireReaderLock(WorldServiceLocator._Global_Constants.DEFAULT_LOCK_TIMEOUT); foreach (KeyValuePair <ulong, WS_DynamicObjects.DynamicObjectObject> Dynamic in WorldServiceLocator._WorldServer.WORLD_DYNAMICOBJECTs) { if (Dynamic.Value != null && Dynamic.Value.Update()) { DynamicObjectsToDelete.Add(Dynamic.Value); } } } catch (Exception ex6) { ProjectData.SetProjectError(ex6); Exception ex = ex6; WorldServiceLocator._WorldServer.Log.WriteLine(LogType.FAILED, ex.ToString(), null); ProjectData.ClearProjectError(); } finally { WorldServiceLocator._WorldServer.WORLD_DYNAMICOBJECTs_Lock.ReleaseReaderLock(); } foreach (WS_DynamicObjects.DynamicObjectObject item in DynamicObjectsToDelete) { item?.Delete(); } SpellManagerWorking = false; } }
public CreatureAI_Lord_Pythas(ref WS_Creatures.CreatureObject Creature) : base(ref Creature) { AllowedMove = false; Creature.Flying = false; Creature.VisibleDistance = 700f; }
public CreatureAI_The_Plains_Vision(ref WS_Creatures.CreatureObject Creature) { aiCreature = Creature; InitWaypoints(); }