public bool GetObjectHitPos(ref WS_Base.BaseObject obj, ref WS_Base.BaseObject obj2, ref float rx, ref float ry, ref float rz, float pModifyDist) { rx = ValidateMapCoord(rx); ry = ValidateMapCoord(ry); rz = ValidateMapCoord(rz); return(GetObjectHitPos(obj.MapID, obj.positionX, obj.positionY, obj.positionZ + 2f, obj2.positionX, obj2.positionY, obj2.positionZ + 2f, ref rx, ref ry, ref rz, pModifyDist)); }
public bool IsInLineOfSight(ref WS_Base.BaseObject obj, float x2, float y2, float z2) { x2 = ValidateMapCoord(x2); y2 = ValidateMapCoord(y2); z2 = ValidateMapCoord(z2); return(IsInLineOfSight(obj.MapID, obj.positionX, obj.positionY, obj.positionZ + 2f, x2, y2, z2)); }
public bool GetObjectHitPos(ref WS_Base.BaseObject obj, float x2, float y2, float z2, ref float rx, ref float ry, ref float rz, float pModifyDist) { rx = ValidateMapCoord(rx); ry = ValidateMapCoord(ry); rz = ValidateMapCoord(rz); x2 = ValidateMapCoord(x2); y2 = ValidateMapCoord(y2); z2 = ValidateMapCoord(z2); return(GetObjectHitPos(obj.MapID, obj.positionX, obj.positionY, obj.positionZ + 2f, x2, y2, z2, ref rx, ref ry, ref rz, pModifyDist)); }
public bool Update() { if (Caster == null) { return(true); } var DeleteThis = false; checked { if (Duration > 1000) { Duration -= 1000; } else { DeleteThis = true; } } foreach (var effect in Effects) { var Effect = effect; if (Effect.GetRadius == 0f) { if (Effect.Amplitude == 0 || checked (WorldServiceLocator._WS_Spells.SPELLs[SpellID].GetDuration - Duration) % Effect.Amplitude == 0) { var obj = WorldServiceLocator._WS_Spells.AURAs[Effect.ApplyAuraIndex]; ref var caster = ref Caster; WS_Base.BaseObject baseObject = this; obj(ref caster, ref baseObject, ref Effect, SpellID, 1, AuraAction.AURA_UPDATE); } continue; } var Targets = WorldServiceLocator._WS_Spells.GetEnemyAtPoint(ref Caster, positionX, positionY, positionZ, Effect.GetRadius); foreach (var item in Targets) { var Target = item; if (Effect.Amplitude == 0 || checked (WorldServiceLocator._WS_Spells.SPELLs[SpellID].GetDuration - Duration) % Effect.Amplitude == 0) { var obj2 = WorldServiceLocator._WS_Spells.AURAs[Effect.ApplyAuraIndex]; WS_Base.BaseObject baseObject = this; obj2(ref Target, ref baseObject, ref Effect, SpellID, 1, AuraAction.AURA_UPDATE); } } }
public void InitializeTalentSpells(WS_PlayerData.CharacterObject objCharacter) { WS_Spells.SpellTargets t = new WS_Spells.SpellTargets(); WS_Base.BaseUnit objCharacter2 = objCharacter; t.SetTarget_SELF(ref objCharacter2); objCharacter = (WS_PlayerData.CharacterObject)objCharacter2; foreach (KeyValuePair <int, WS_Spells.CharacterSpell> Spell in objCharacter.Spells) { if (WorldServiceLocator._WS_Spells.SPELLs.ContainsKey(Spell.Key) && WorldServiceLocator._WS_Spells.SPELLs[Spell.Key].IsPassive) { if (!objCharacter.HavePassiveAura(Spell.Key) && WorldServiceLocator._WS_Spells.SPELLs[Spell.Key].CanCast(ref objCharacter, t, FirstCheck: false) == SpellFailedReason.SPELL_NO_ERROR) { WS_Spells.SpellInfo spellInfo = WorldServiceLocator._WS_Spells.SPELLs[Spell.Key]; WS_Base.BaseObject caster = objCharacter; spellInfo.Apply(ref caster, t); objCharacter = (WS_PlayerData.CharacterObject)caster; } else if (objCharacter.HavePassiveAura(Spell.Key) && WorldServiceLocator._WS_Spells.SPELLs[Spell.Key].CanCast(ref objCharacter, t, FirstCheck: false) != SpellFailedReason.SPELL_NO_ERROR) { objCharacter.RemoveAuraBySpell(Spell.Key); } } } }
public void AddToWorld() { WorldServiceLocator._WS_Maps.GetMapTile(positionX, positionY, ref CellX, ref CellY); if (WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[CellX, CellY] == null) { WorldServiceLocator._WS_CharMovement.MAP_Load(CellX, CellY, MapID); } WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[CellX, CellY].CorpseObjectsHere.Add(GUID); Packets.PacketClass packet = new Packets.PacketClass(Opcodes.SMSG_UPDATE_OBJECT); checked { try { Packets.UpdateClass tmpUpdate = new Packets.UpdateClass(WorldServiceLocator._Global_Constants.FIELD_MASK_SIZE_CORPSE); try { packet.AddInt32(1); packet.AddInt8(0); FillAllUpdateFlags(ref tmpUpdate); Packets.UpdateClass updateClass = tmpUpdate; CorpseObject updateObject = this; updateClass.AddToPacket(ref packet, ObjectUpdateType.UPDATETYPE_CREATE_OBJECT, ref updateObject); } finally { tmpUpdate.Dispose(); } short i = -1; do { short j = -1; do { if ((short)unchecked (CellX + i) >= 0 && (short)unchecked (CellX + i) <= 63 && (short)unchecked (CellY + j) >= 0 && (short)unchecked (CellY + j) <= 63 && WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)] != null && WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)].PlayersHere.Count > 0) { WS_Maps.TMapTile tMapTile = WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)]; ulong[] list = tMapTile.PlayersHere.ToArray(); ulong[] array = list; foreach (ulong plGUID in array) { int num; if (WorldServiceLocator._WorldServer.CHARACTERs.ContainsKey(plGUID)) { WS_PlayerData.CharacterObject characterObject = WorldServiceLocator._WorldServer.CHARACTERs[plGUID]; WS_Base.BaseObject objCharacter = this; num = (characterObject.CanSee(ref objCharacter) ? 1 : 0); } else { num = 0; } if (num != 0) { WorldServiceLocator._WorldServer.CHARACTERs[plGUID].client.SendMultiplyPackets(ref packet); WorldServiceLocator._WorldServer.CHARACTERs[plGUID].corpseObjectsNear.Add(GUID); SeenBy.Add(plGUID); } } } j = (short)unchecked (j + 1); }while (j <= 1); i = (short)unchecked (i + 1); }while (i <= 1); } finally { packet.Dispose(); } } }
public void AddToWorld() { WorldServiceLocator._WS_Maps.GetMapTile(positionX, positionY, ref CellX, ref CellY); if (WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[CellX, CellY] == null) { WorldServiceLocator._WS_CharMovement.MAP_Load(CellX, CellY, MapID); } try { WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[CellX, CellY].DynamicObjectsHere.Add(GUID); } catch (Exception projectError) { ProjectData.SetProjectError(projectError); WorldServiceLocator._WorldServer.Log.WriteLine(LogType.WARNING, "AddToWorld failed MapId: {0} Tile XY: {1} {2} GUID: {3}", MapID, CellX, CellY, GUID); ProjectData.ClearProjectError(); return; } Packets.PacketClass packet = new(Opcodes.SMSG_UPDATE_OBJECT); packet.AddInt32(1); packet.AddInt8(0); Packets.UpdateClass tmpUpdate = new(WorldServiceLocator._Global_Constants.FIELD_MASK_SIZE_DYNAMICOBJECT); FillAllUpdateFlags(ref tmpUpdate); var updateClass = tmpUpdate; var updateObject = this; updateClass.AddToPacket(ref packet, ObjectUpdateType.UPDATETYPE_CREATE_OBJECT_SELF, ref updateObject); tmpUpdate.Dispose(); short i = -1; checked { do { short j = -1; do { if ((short)unchecked (CellX + i) >= 0 && (short)unchecked (CellX + i) <= 63 && (short)unchecked (CellY + j) >= 0 && (short)unchecked (CellY + j) <= 63 && WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)] != null && WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)].PlayersHere.Count > 0) { var tMapTile = WorldServiceLocator._WS_Maps.Maps[MapID].Tiles[(short)unchecked (CellX + i), (short)unchecked (CellY + j)]; var list = tMapTile.PlayersHere.ToArray(); var array = list; foreach (var plGUID in array) { int num; if (WorldServiceLocator._WorldServer.CHARACTERs.ContainsKey(plGUID)) { var characterObject = WorldServiceLocator._WorldServer.CHARACTERs[plGUID]; WS_Base.BaseObject objCharacter = this; num = characterObject.CanSee(ref objCharacter) ? 1 : 0; } else { num = 0; } if (num != 0) { WorldServiceLocator._WorldServer.CHARACTERs[plGUID].client.SendMultiplyPackets(ref packet); WorldServiceLocator._WorldServer.CHARACTERs[plGUID].dynamicObjectsNear.Add(GUID); SeenBy.Add(plGUID); } } } j = (short)unchecked (j + 1); }while (j <= 1); i = (short)unchecked (i + 1); }while (i <= 1); packet.Dispose(); } }
public void Update() { checked { var num = WorldServiceLocator._Global_Constants.MAX_AURA_EFFECTs - 1; for (var i = 0; i <= num; i++) { if (ActiveSpells[i] == null) { continue; } if (ActiveSpells[i].SpellDuration == WorldServiceLocator._Global_Constants.SPELL_DURATION_INFINITE) { ActiveSpells[i].SpellDuration = Duration; } if (ActiveSpells[i].SpellDuration != WorldServiceLocator._Global_Constants.SPELL_DURATION_INFINITE) { ActiveSpells[i].SpellDuration -= 1000; byte k = 0; do { if (ActiveSpells[i] != null && ActiveSpells[i].Aura[k] != null && ActiveSpells[i].Aura_Info[k].Amplitude != 0 && checked (Duration - ActiveSpells[i].SpellDuration) % ActiveSpells[i].Aura_Info[k].Amplitude == 0) { var obj = ActiveSpells[i].Aura[k]; WS_Base.BaseUnit Target = this; ref var spellCaster = ref ActiveSpells[i].SpellCaster; WS_Base.BaseObject baseObject = spellCaster; obj(ref Target, ref baseObject, ref ActiveSpells[i].Aura_Info[k], ActiveSpells[i].SpellID, ActiveSpells[i].StackCount + 1, AuraAction.AURA_UPDATE); spellCaster = (WS_Base.BaseUnit)baseObject; } k = (byte)unchecked ((uint)(k + 1)); }while (k <= 2u); if (ActiveSpells[i] != null && ActiveSpells[i].SpellDuration <= 0 && ActiveSpells[i].SpellDuration != WorldServiceLocator._Global_Constants.SPELL_DURATION_INFINITE) { RemoveAura(i, ref ActiveSpells[i].SpellCaster, RemovedByDuration: true); } } byte j = 0; do { if (ActiveSpells[i] != null && ActiveSpells[i].Aura_Info[j] != null && ActiveSpells[i].Aura_Info[j].ID == SpellEffects_Names.SPELL_EFFECT_APPLY_AREA_AURA) { List <WS_Base.BaseUnit> Targets = new(); switch (Caster) { case WS_PlayerData.CharacterObject _: { var wS_Spells = WorldServiceLocator._WS_Spells; WS_PlayerData.CharacterObject objCharacter = (WS_PlayerData.CharacterObject)Caster; Targets = wS_Spells.GetPartyMembersAtPoint(ref objCharacter, ActiveSpells[i].Aura_Info[j].GetRadius, positionX, positionY, positionZ); break; } default: { var wS_Spells2 = WorldServiceLocator._WS_Spells; WS_Base.BaseUnit Target = this; Targets = wS_Spells2.GetFriendAroundMe(ref Target, ActiveSpells[i].Aura_Info[j].GetRadius); break; } } foreach (var item in new List <WS_Base.BaseUnit>()) { var Unit = item; if (!Unit.HaveAura(ActiveSpells[i].SpellID)) { var wS_Spells3 = WorldServiceLocator._WS_Spells; WS_Base.BaseObject baseObject = this; wS_Spells3.ApplyAura(ref Unit, ref baseObject, ref ActiveSpells[i].Aura_Info[j], ActiveSpells[i].SpellID); } } } j = (byte)unchecked ((uint)(j + 1)); }while (j <= 2u); } }
private void UpdateSpells(ref WS_Base.BaseUnit objCharacter) { if (objCharacter is WS_Totems.TotemObject @object) { @object.Update(); return; } checked { for (int i = 0; i <= WorldServiceLocator._Global_Constants.MAX_AURA_EFFECTs - 1; i++) { if (objCharacter.ActiveSpells[i] == null) { continue; } if (objCharacter.ActiveSpells[i].SpellDuration != WorldServiceLocator._Global_Constants.SPELL_DURATION_INFINITE) { objCharacter.ActiveSpells[i].SpellDuration -= 1000; byte j = 0; do { if (objCharacter.ActiveSpells[i] != null && objCharacter.ActiveSpells[i].Aura[j] != null && objCharacter.ActiveSpells[i].Aura_Info[j] != null && objCharacter.ActiveSpells[i].Aura_Info[j].Amplitude != 0 && checked (objCharacter.ActiveSpells[i].GetSpellInfo.GetDuration - objCharacter.ActiveSpells[i].SpellDuration) % objCharacter.ActiveSpells[i].Aura_Info[j].Amplitude == 0) { ref WS_Base.BaseUnit spellCaster = ref objCharacter.ActiveSpells[i].SpellCaster; WS_Base.BaseObject Caster = spellCaster; objCharacter.ActiveSpells[i].Aura[j](ref objCharacter, ref Caster, ref objCharacter.ActiveSpells[i].Aura_Info[j], objCharacter.ActiveSpells[i].SpellID, objCharacter.ActiveSpells[i].StackCount + 1, AuraAction.AURA_UPDATE); ref WS_Base.BaseUnit reference = ref spellCaster; reference = (WS_Base.BaseUnit)Caster; } j = (byte)unchecked ((uint)(j + 1)); }while (j <= 2u); if (objCharacter.ActiveSpells[i] != null && objCharacter.ActiveSpells[i].SpellDuration <= 0 && objCharacter.ActiveSpells[i].SpellDuration != WorldServiceLocator._Global_Constants.SPELL_DURATION_INFINITE) { objCharacter.RemoveAura(i, ref objCharacter.ActiveSpells[i].SpellCaster, RemovedByDuration: true); } } byte k = 0; do { if (objCharacter.ActiveSpells[i] != null && objCharacter.ActiveSpells[i].Aura_Info[k] != null && objCharacter.ActiveSpells[i].Aura_Info[k].ID == SpellEffects_Names.SPELL_EFFECT_APPLY_AREA_AURA) { if (objCharacter.ActiveSpells[i].SpellCaster == objCharacter) { List <WS_Base.BaseUnit> Targets = new List <WS_Base.BaseUnit>(); switch (objCharacter) { case WS_PlayerData.CharacterObject _: { WS_Spells wS_Spells = WorldServiceLocator._WS_Spells; WS_PlayerData.CharacterObject objCharacter2 = (WS_PlayerData.CharacterObject)objCharacter; Targets = wS_Spells.GetPartyMembersAroundMe(ref objCharacter2, objCharacter.ActiveSpells[i].Aura_Info[k].GetRadius); break; } case WS_Totems.TotemObject _ when((WS_Totems.TotemObject) objCharacter).Caster != null && ((WS_Totems.TotemObject)objCharacter).Caster is WS_PlayerData.CharacterObject: { WS_Spells wS_Spells2 = WorldServiceLocator._WS_Spells; ref WS_Base.BaseUnit caster2 = ref ((WS_Totems.TotemObject)objCharacter).Caster; ref WS_Base.BaseUnit reference = ref caster2; WS_PlayerData.CharacterObject objCharacter2 = (WS_PlayerData.CharacterObject)caster2; List <WS_Base.BaseUnit> partyMembersAtPoint = wS_Spells2.GetPartyMembersAtPoint(ref objCharacter2, objCharacter.ActiveSpells[i].Aura_Info[k].GetRadius, objCharacter.positionX, objCharacter.positionY, objCharacter.positionZ); reference = objCharacter2; Targets = partyMembersAtPoint; break; } } foreach (WS_Base.BaseUnit item in Targets) { WS_Base.BaseUnit Unit = item; if (!Unit.HaveAura(objCharacter.ActiveSpells[i].SpellID)) { WS_Spells wS_Spells3 = WorldServiceLocator._WS_Spells; WS_Base.BaseObject Caster = objCharacter; wS_Spells3.ApplyAura(ref Unit, ref Caster, ref objCharacter.ActiveSpells[i].Aura_Info[k], objCharacter.ActiveSpells[i].SpellID); objCharacter = (WS_Base.BaseUnit)Caster; } } } else if (objCharacter.ActiveSpells[i].SpellCaster != null && objCharacter.ActiveSpells[i].SpellCaster.Exist) { WS_PlayerData.CharacterObject caster = null; switch (objCharacter.ActiveSpells[i].SpellCaster) { case WS_PlayerData.CharacterObject _: caster = (WS_PlayerData.CharacterObject)objCharacter.ActiveSpells[i].SpellCaster; break; case WS_Totems.TotemObject _ when((WS_Totems.TotemObject) objCharacter.ActiveSpells[i].SpellCaster).Caster != null && ((WS_Totems.TotemObject)objCharacter.ActiveSpells[i].SpellCaster).Caster is WS_PlayerData.CharacterObject object1: caster = object1; break; } if (caster == null || caster.Group == null || !caster.Group.LocalMembers.Contains(objCharacter.GUID)) { objCharacter.RemoveAura(i, ref objCharacter.ActiveSpells[i].SpellCaster); } else if (!objCharacter.ActiveSpells[i].SpellCaster.HaveAura(objCharacter.ActiveSpells[i].SpellID)) { objCharacter.RemoveAura(i, ref objCharacter.ActiveSpells[i].SpellCaster); } else if (WorldServiceLocator._WS_Combat.GetDistance(objCharacter, objCharacter.ActiveSpells[i].SpellCaster) > objCharacter.ActiveSpells[i].Aura_Info[k].GetRadius) { objCharacter.RemoveAura(i, ref objCharacter.ActiveSpells[i].SpellCaster); } } else { objCharacter.RemoveAura(i, ref objCharacter.ActiveSpells[i].SpellCaster); } }
public bool IsInLineOfSight(ref WS_Base.BaseObject obj, ref WS_Base.BaseObject obj2) { return(IsInLineOfSight(obj.MapID, obj.positionX, obj.positionY, obj.positionZ + 2f, obj2.positionX, obj2.positionY, obj2.positionZ + 2f)); }
public bool IsOutsideOfMap(ref WS_Base.BaseObject objCharacter) { return(false); }