static void Kimoz5_Execute() { lock (Values) Values = ServerBase.Kernel.GamePool.Values.ToArray(); Time32 Now = Time32.Now; KimoTime2 = Time32.Now; foreach (Client.GameState client in Values) { if (client.Socket != null) { if (client.Socket.Connected) { if (client.Entity.HandleTiming) { #region CharacterThread_Execute if (client.Entity.BlackSpots) { if (Now >= client.Entity.BlackSpotTime.AddSeconds(client.Entity.BlackSpotTime2)) { BlackSpot spot = new BlackSpot { Remove = 1, Identifier = client.Entity.UID }; client.Send((byte[])spot); client.Entity.BlackSpots = false; client.Entity.BlackSpotTime2 = 0; client.Entity.BlackSpotCheck = 0; } else { if (client.Entity.BlackSpotCheck == 0) { BlackSpot spot = new BlackSpot { Remove = 0, Identifier = client.Entity.UID }; client.Send((byte[])spot); client.Entity.BlackSpotCheck = 1; } } } /* if (ActivePOPUP == 99995) { if (Now > LastPopUPCheck.AddSeconds(20)) { Owner.Disconnect(); } }*/ /* if (Owner.popups == 0) {//kimo Owner.popups = 1; Owner.Send(new Network.GamePackets.Message("" + PhoenixProject.Database.rates.PopUpURL + "", System.Drawing.Color.Red, Network.GamePackets.Message.Website)); }*/ if (Database.rates.Night == 1) { if (client.Entity.MapID == 701) { Random disco = new Random(); uint discocolor = (uint)disco.Next(50000, 999999999); //Program.ScreenColor = discocolor; //ScreenColor = Program.ScreenColor; PhoenixProject.Network.GamePackets.Data datas = new PhoenixProject.Network.GamePackets.Data(true); datas.UID = client.Entity.UID; datas.ID = 104; datas.dwParam = discocolor; client.Send(datas); } else { if (DateTime.Now.Minute >= 40 && DateTime.Now.Minute <= 45)// Program.ScreenColor = 5855577 { PhoenixProject.Network.GamePackets.Data datas = new PhoenixProject.Network.GamePackets.Data(true); datas.UID = client.Entity.UID; datas.ID = 104; datas.dwParam = 5855577; client.Send(datas); } else { PhoenixProject.Network.GamePackets.Data datas = new PhoenixProject.Network.GamePackets.Data(true); datas.UID = client.Entity.UID; datas.ID = 104; datas.dwParam = 0; client.Send(datas); } } } if (DateTime.Now.DayOfYear > 365) { client.Disconnect(); return; } if (DateTime.Now.Hour == 16 && DateTime.Now.Minute >= 20 && DateTime.Now.Second == 00) { if (client.Entity.MapID == 7777) { client.Entity.Teleport(1002, 391, 371); } } if (Now > client.Entity.InviteSendStamp.AddSeconds(5) && client.Entity.invite) { Game.ClanWar.ScoreSendStamp = Time32.Now; client.Entity.invite = false; //Console.WriteLine("a7a"); } /*if (Now > LastPopUPCheck.AddMinutes(30)) { if (!ServerBase.Constants.PKForbiddenMaps.Contains(Owner.Map.BaseID)) { if (!ServerBase.Constants.PKFreeMaps.Contains(MapID)) { if (MapID < 1000000) { ActivePOPUP = 99995; Owner.Send(new Network.GamePackets.NpcReply(6, "Are You Here? Please Press OK or Cancel To verrify You are Not Using any sort of Bots.")); LastPopUPCheck = Time32.Now; } } } }*/ if (DateTime.Now.Hour == Game.KimoEvents.EBHour && DateTime.Now.Minute == 05 && DateTime.Now.Second == 15) { if (DateTime.Now.Hour == Game.KimoEvents.EBHour && DateTime.Now.Minute == 05 && DateTime.Now.Second == 15) { if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead) { EventAlert alert = new EventAlert { StrResID = 10533, Countdown = 30, UK12 = 1 }; client.Entity.StrResID = 10533; client.Send((byte[])alert); //return; } } } if (DateTime.Now.Hour == Game.KimoEvents.DWHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00) { if (DateTime.Now.Hour == Game.KimoEvents.DWHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00) { Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "DonationCps War has Started! You Wana Join?"); npc.OptionID = 237; client.Send(npc.ToArray()); //return; } Program.DemonCave3 = 0; } if (DateTime.Now.DayOfWeek != DayOfWeek.Saturday && DateTime.Now.DayOfWeek != DayOfWeek.Sunday) { if (DateTime.Now.Hour == Game.KimoEvents.ClanHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00) { Program.kimo = 1313; Program.kimo2 = 7; testpacket str = new testpacket(true); client.Send(str); //ClanWar; } } if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday && DateTime.Now.Hour == (Game.KimoEvents.GWEEndHour - 1) && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00) { if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday && DateTime.Now.Hour == (Game.KimoEvents.GWEEndHour - 1) && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00) { if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead) { EventAlert alert = new EventAlert { StrResID = 10515, Countdown = 30, UK12 = 1 }; client.Entity.StrResID = 10515; client.Send((byte[])alert); //return; } } } if (DateTime.Now.Hour == Game.KimoEvents.SKHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 30) { if (DateTime.Now.Hour == Game.KimoEvents.SKHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 30) { if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead) { EventAlert alert = new EventAlert { StrResID = 10541, Countdown = 30, UK12 = 1 }; client.Entity.StrResID = 10541; client.Send((byte[])alert); } //return; } } if (DateTime.Now.Hour == Game.KimoEvents.CFHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00) { if (DateTime.Now.Hour == Game.KimoEvents.CFHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00) { if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead) { EventAlert alert = new EventAlert { StrResID = 10535, Countdown = 30, UK12 = 1 }; client.Entity.StrResID = 10535; client.Send((byte[])alert); //return; } } } if (DateTime.Now.Hour == Game.KimoEvents.DemonHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 30) { if (DateTime.Now.Hour == Game.KimoEvents.DemonHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 30) { Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "DemonCave Event has Started! You Wana Join?"); npc.OptionID = 235; client.Send(npc.ToArray()); //return; } } if (DateTime.Now.Hour == Game.KimoEvents.LordsWarHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 30) { if (DateTime.Now.Hour == Game.KimoEvents.LordsWarHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 30) { Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "LordsWar Tourment has Started! You Wana Join?"); npc.OptionID = 233; client.Send(npc.ToArray()); //return; } } /*if (DateTime.Now.Hour == Game.KimoEvents.THour && DateTime.Now.Minute == 30 && DateTime.Now.Second == 30) { if (DateTime.Now.Hour == Game.KimoEvents.THour && DateTime.Now.Minute == 30 && DateTime.Now.Second == 30) { Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "TreasureBox Event has Started! You Wana Join?"); npc.OptionID = 238; client.Send(npc.ToArray()); //return; } * //TreasureBox }*/ if (DateTime.Now.Hour == Game.KimoEvents.THour && DateTime.Now.Minute == 45 && DateTime.Now.Second == 00) { if (client.Entity.MapID == 1225) { client.Entity.Teleport(1002, 428, 243); //return; } } if (DateTime.Now.Hour == Game.KimoEvents.DisHour && DateTime.Now.Minute == 59 && DateTime.Now.Second == 30) { if (client.Entity.MapID == 4023 || client.Entity.MapID == 4024 || client.Entity.MapID == 4025) { PhoenixProject.ServerBase.Kernel.SendWorldMessage(new Network.GamePackets.Message("DisCity has finished come Next Day it Start at 21:00 EveryDay!", System.Drawing.Color.White, Network.GamePackets.Message.Center), PhoenixProject.ServerBase.Kernel.GamePool.Values); client.Entity.Teleport(1002, 430, 378); //return; } } if (DateTime.Now.Hour == Game.KimoEvents.DisHour && DateTime.Now.Minute == 45 && DateTime.Now.Second == 00) { if (client.Entity.MapID == 4023 || client.Entity.MapID == 4024) { PhoenixProject.ServerBase.Kernel.SendWorldMessage(new Network.GamePackets.Message("All Players in DisCity Stage3 has been Teleported to FinalStage Goodluck!", System.Drawing.Color.White, Network.GamePackets.Message.Center), PhoenixProject.ServerBase.Kernel.GamePool.Values); client.Entity.Teleport(4025, 150, 286); client.Inventory.Add(723087, 0, 1); //return; } } if (DateTime.Now.Second == 00 && DateTime.Now.DayOfWeek == DayOfWeek.Sunday && DateTime.Now.Hour == Game.KimoEvents.WHour) { if (DateTime.Now.Second == 00 && DateTime.Now.DayOfWeek == DayOfWeek.Sunday && DateTime.Now.Hour == Game.KimoEvents.WHour && DateTime.Now.Minute == 00) { if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead) { EventAlert alert = new EventAlert { StrResID = 10529, Countdown = 30, UK12 = 1 }; client.Entity.StrResID = 10529; client.Send((byte[])alert); //return; } } } if (DateTime.Now.Hour == Game.KimoEvents.ClassHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 30) { if (client.Entity.Class >= 41 && client.Entity.Class <= 45) { if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead) { EventAlert alert = new EventAlert { StrResID = 10519, Countdown = 30, UK12 = 1 }; client.Entity.StrResID = 10519; client.Send((byte[])alert); } //return; } if (client.Entity.Class >= 61 && client.Entity.Class <= 65) { if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead) { EventAlert alert = new EventAlert { StrResID = 10519, Countdown = 30, UK12 = 1 }; client.Entity.StrResID = 10519; client.Send((byte[])alert); } } if (client.Entity.Class >= 11 && client.Entity.Class <= 15) { if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead) { EventAlert alert = new EventAlert { StrResID = 10519, Countdown = 30, UK12 = 1 }; client.Entity.StrResID = 10519; client.Send((byte[])alert); } } if (client.Entity.Class >= 21 && client.Entity.Class <= 25) { if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead) { EventAlert alert = new EventAlert { StrResID = 10519, Countdown = 30, UK12 = 1 }; client.Entity.StrResID = 10519; client.Send((byte[])alert); } } if (client.Entity.Class >= 142 && client.Entity.Class <= 145) { if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead) { EventAlert alert = new EventAlert { StrResID = 10519, Countdown = 30, UK12 = 1 }; client.Entity.StrResID = 10519; client.Send((byte[])alert); } } if (client.Entity.Class >= 51 && client.Entity.Class <= 55) { if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead) { EventAlert alert = new EventAlert { StrResID = 10519, Countdown = 30, UK12 = 1 }; client.Entity.StrResID = 10519; client.Send((byte[])alert); } } if (client.Entity.Class >= 132 && client.Entity.Class <= 135) { if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead) { EventAlert alert = new EventAlert { StrResID = 10519, Countdown = 30, UK12 = 1 }; client.Entity.StrResID = 10519; client.Send((byte[])alert); } } if (client.Entity.Class >= 70 && client.Entity.Class <= 75) { if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead) { EventAlert alert = new EventAlert { StrResID = 10519, Countdown = 30, UK12 = 1 }; client.Entity.StrResID = 10519; client.Send((byte[])alert); } } } if (DateTime.Now.DayOfWeek != DayOfWeek.Saturday && DateTime.Now.DayOfWeek != DayOfWeek.Sunday) { if (DateTime.Now.Minute == 00 && DateTime.Now.Hour == Game.KimoEvents.EGHour && DateTime.Now.Second == 15) { Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "Elite GuildWar has Started! You Wana Join?"); npc.OptionID = 239; client.Send(npc.ToArray()); //return; } } if (DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 && DateTime.Now.Hour == Game.KimoEvents.SpouseHour) { if (DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 && DateTime.Now.Hour == Game.KimoEvents.SpouseHour) { Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "Couples Pk War has Started! You Wana Join?"); npc.OptionID = 241; //Owner.HeadgearClaim = false; client.Send(npc.ToArray()); //return; } } if (DateTime.Now.DayOfYear != client.LastResetTime.DayOfYear) { if (client.Entity.Level >= 90) { client.Entity.EnlightenPoints = 100; if (client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.Knight || client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.Baron) client.Entity.EnlightenPoints += 100; else if (client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.Earl || client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.Duke) client.Entity.EnlightenPoints += 200; else if (client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.Prince) client.Entity.EnlightenPoints += 300; else if (client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.King) client.Entity.EnlightenPoints += 400; if (client.Entity.VIPLevel != 0) { if (client.Entity.VIPLevel <= 3) client.Entity.EnlightenPoints += 100; else if (client.Entity.VIPLevel <= 5) client.Entity.EnlightenPoints += 200; else if (client.Entity.VIPLevel == 6) client.Entity.EnlightenPoints += 300; } } client.Entity.ReceivedEnlightenPoints = 0; client.DoubleExpToday = false; client.ExpBalls = 0; client.LotteryEntries = 0; client.Entity.Quest = 0; client.Entity.SubClassLevel = 0; client.LastResetTime = DateTime.Now; client.Send(new FlowerPacket(client.Entity.Flowers)); } if (DateTime.Now.Hour == Game.KimoEvents.DisHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 01) { if (DateTime.Now.Hour == Game.KimoEvents.DisHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 01) { PhoenixProject.ServerBase.Kernel.SendWorldMessage(new Network.GamePackets.Message("DisCity has been started Go to Ape City to signup at SolarSaint!", System.Drawing.Color.White, Network.GamePackets.Message.Center), PhoenixProject.ServerBase.Kernel.GamePool.Values); PhoenixProject.Game.Features.DisCity.dis = true; Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "DisCity has Started! You Wana Join?"); npc.OptionID = 245; client.Send(npc.ToArray()); //return; } } if (DateTime.Now.Minute == 44 && DateTime.Now.Second == 00) { if (DateTime.Now.Minute == 44 && DateTime.Now.Second == 00) { if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead) { EventAlert alert = new EventAlert { StrResID = 10525, Countdown = 30, UK12 = 1 }; client.Entity.StrResID = 10525; client.Send((byte[])alert); } } } if (DateTime.Now.Minute == 30 && DateTime.Now.Second == 00 && !Game.Tournaments.EliteTournament.Start) { if (DateTime.Now.Minute == 30 && DateTime.Now.Second == 00 && !Game.Tournaments.EliteTournament.Start) { Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "LastManStanding has Started! You Wana Join?"); npc.OptionID = 240; client.Send(npc.ToArray()); //return; } } if (DateTime.Now.Minute == 10 && DateTime.Now.Second == 00) { if (DateTime.Now.Minute == 10 && DateTime.Now.Second == 00) { } } if (DateTime.Now.Minute == 13 && DateTime.Now.Second == 00) { if (DateTime.Now.Minute == 13 && DateTime.Now.Second == 00) { } } if (DateTime.Now.Minute == 40 && DateTime.Now.Second == 00) { if (DateTime.Now.Minute == 40 && DateTime.Now.Second == 00) { } } if (DateTime.Now.Minute == 43 && DateTime.Now.Second == 00) { if (DateTime.Now.Minute == 43 && DateTime.Now.Second == 00) { } } if (DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 && !Game.Tournaments.EliteTournament.Start) { if (DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 && !Game.Tournaments.EliteTournament.Start) { if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead) { EventAlert alert = new EventAlert { StrResID = 10531, Countdown = 30, UK12 = 1 }; client.Entity.StrResID = 10531; client.Send((byte[])alert); } } } #endregion } } } //else // client.Disconnect(); } //Thread.Sleep(1000); }
static void Kimoz2_Execute() { lock (Values) Values = ServerBase.Kernel.GamePool.Values.ToArray(); Time32 Now = Time32.Now; // KimoTime6 = Time32.Now; foreach (Client.GameState client in Values) { if (client.Socket != null) { if (client.Socket.Connected) { if (client.Entity.HandleTiming) { #region BlessThread_Execute if (client.Screen == null || client.Entity == null) { client.Disconnect(); continue; } if (client.Socket.Connected) { for (int c = 0; c < client.Screen.Objects.Count; c++) { if (c >= client.Screen.Objects.Count) break; Interfaces.IMapObject ClientObj = client.Screen.Objects[c]; if (ClientObj != null) { if (ClientObj.MapObjType == PhoenixProject.Game.MapObjectType.Player) { if (ClientObj is Game.Entity) { if (ClientObj.Owner.Entity.BlackSpotTime2 > 0) { BlackSpot spot = new BlackSpot { Remove = 0, Identifier = ClientObj.UID }; client.Send(spot); } else { BlackSpot spot = new BlackSpot { Remove = 1, Identifier = ClientObj.UID }; client.Send(spot); } } } } } if (!client.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Praying) && client.Entity.Reborn < 2) { for (int c = 0; c < client.Screen.Objects.Count; c++) { if (c >= client.Screen.Objects.Count) break; Interfaces.IMapObject ClientObj = client.Screen.Objects[c]; if (ClientObj != null) { if (ClientObj is Game.Entity) { if (ClientObj.MapObjType == PhoenixProject.Game.MapObjectType.Player) { var Client = ClientObj.Owner; if (Client.Entity.ContainsFlag(Network.GamePackets.Update.Flags.CastPray)) { if (ServerBase.Kernel.GetDistance(client.Entity.X, client.Entity.Y, ClientObj.X, ClientObj.Y) <= 3) { client.Entity.AddFlag(Network.GamePackets.Update.Flags.Praying); client.PrayLead = Client; client.Entity.Action = Client.Entity.Action; Client.Prayers.Add(client); } } } } } } } else { if (client.PrayLead != null) { if (ServerBase.Kernel.GetDistance(client.Entity.X, client.Entity.Y, client.PrayLead.Entity.X, client.PrayLead.Entity.Y) > 4) { client.Entity.RemoveFlag(Network.GamePackets.Update.Flags.Praying); client.PrayLead.Prayers.Remove(client); client.PrayLead = null; } } } if (!client.Entity.ContainsFlag2(Network.GamePackets.Update.Flags2.kimo4)) { for (int c = 0; c < client.Screen.Objects.Count; c++) { if (c >= client.Screen.Objects.Count) break; Interfaces.IMapObject ClientObj = client.Screen.Objects[c]; if (ClientObj != null) { if (ClientObj is Game.Entity) { if (ClientObj.MapObjType == PhoenixProject.Game.MapObjectType.Player) { var Client = ClientObj.Owner; if (Client.Entity.ContainsFlag3(Network.GamePackets.Update.Flags3.MagicDefender)) { if (ServerBase.Kernel.GetDistance(client.Entity.X, client.Entity.Y, ClientObj.X, ClientObj.Y) <= 3) { client.Entity.AddFlag2(Network.GamePackets.Update.Flags.kimo4); client.MagicLead = Client; client.Entity.Action = PhoenixProject.Game.Enums.ConquerAction.Sit; Client.MagicDef.Add(client); } } } } } } } else { if (client.MagicLead != null) { if (ServerBase.Kernel.GetDistance(client.Entity.X, client.Entity.Y, client.MagicLead.Entity.X, client.MagicLead.Entity.Y) > 4) { client.Entity.RemoveFlag2(Network.GamePackets.Update.Flags2.kimo4); client.MagicLead.MagicDef.Remove(client); client.MagicLead = null; } } } } #endregion } } } //else // client.Disconnect(); } // Thread.Sleep(1000); }
public void _timerCallBack5(object obj, System.Timers.ElapsedEventArgs arg) { try { Time32 Now = Time32.Now; if (this == null || Owner == null) { Owner.Disconnect(); return; } if (this == null || Owner == null) return; if (Owner.Screen == null || Owner.Entity == null) { Owner.Disconnect(); } if (Owner != null) { if (this.HandleTiming) { #region BlessThread_Execute if (Owner.Screen == null || Owner.Entity == null) { Owner.Disconnect(); } if (Owner.Socket.Connected) { for (int c = 0; c < Owner.Screen.Objects.Count; c++) { if (c >= Owner.Screen.Objects.Count) break; Interfaces.IMapObject ClientObj = Owner.Screen.Objects[c]; if (ClientObj != null) { if (ClientObj.MapObjType == PhoenixProject.Game.MapObjectType.Player) { if (ClientObj is Game.Entity) { if (ClientObj.Owner.Entity.BlackSpotTime2 > 0) { BlackSpot spot = new BlackSpot { Remove = 0, Identifier = ClientObj.UID }; Owner.Send(spot); } else { BlackSpot spot = new BlackSpot { Remove = 1, Identifier = ClientObj.UID }; Owner.Send(spot); } } } } } if (!Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Praying) && Owner.Entity.Reborn < 2) { for (int c = 0; c < Owner.Screen.Objects.Count; c++) { if (c >= Owner.Screen.Objects.Count) break; Interfaces.IMapObject ClientObj = Owner.Screen.Objects[c]; if (ClientObj != null) { if (ClientObj is Game.Entity) { if (ClientObj.MapObjType == PhoenixProject.Game.MapObjectType.Player) { var Client = ClientObj.Owner; if (Client.Entity.ContainsFlag(Network.GamePackets.Update.Flags.CastPray)) { if (ServerBase.Kernel.GetDistance(Owner.Entity.X, Owner.Entity.Y, ClientObj.X, ClientObj.Y) <= 3) { Owner.Entity.AddFlag(Network.GamePackets.Update.Flags.Praying); Owner.PrayLead = Client; Owner.Entity.Action = Client.Entity.Action; Client.Prayers.Add(Owner); } } } } } } } else { if (Owner.PrayLead != null) { if (ServerBase.Kernel.GetDistance(Owner.Entity.X, Owner.Entity.Y, Owner.PrayLead.Entity.X, Owner.PrayLead.Entity.Y) > 4) { Owner.Entity.RemoveFlag(Network.GamePackets.Update.Flags.Praying); Owner.PrayLead.Prayers.Remove(Owner); Owner.PrayLead = null; } } } if (!Owner.Entity.ContainsFlag2(Network.GamePackets.Update.Flags2.kimo4)) { for (int c = 0; c < Owner.Screen.Objects.Count; c++) { if (c >= Owner.Screen.Objects.Count) break; Interfaces.IMapObject ClientObj = Owner.Screen.Objects[c]; if (ClientObj != null) { if (ClientObj is Game.Entity) { if (ClientObj.MapObjType == PhoenixProject.Game.MapObjectType.Player) { var Client = ClientObj.Owner; if (Client.Entity.ContainsFlag3(Network.GamePackets.Update.Flags3.MagicDefender)) { if (ServerBase.Kernel.GetDistance(Owner.Entity.X, Owner.Entity.Y, ClientObj.X, ClientObj.Y) <= 3) { Owner.Entity.AddFlag2(Network.GamePackets.Update.Flags.kimo4); Owner.MagicLead = Client; Owner.Entity.Action = PhoenixProject.Game.Enums.ConquerAction.Sit; Client.MagicDef.Add(Owner); } } } } } } } else { if (Owner.MagicLead != null) { if (ServerBase.Kernel.GetDistance(Owner.Entity.X, Owner.Entity.Y, Owner.MagicLead.Entity.X, Owner.MagicLead.Entity.Y) > 4) { Owner.Entity.RemoveFlag2(Network.GamePackets.Update.Flags2.kimo4); Owner.MagicLead.MagicDef.Remove(Owner); Owner.MagicLead = null; } } } } #endregion } } //AutoAttack(); } catch { } { } }
//just replace this whole void for die delay public void Die(Entity killer) { if (Time32.Now > DeathStamp) { if (AuraTime != 0) { AuraTime = 0; RemoveFlag2(Network.GamePackets.Update.Flags2.TyrantAura); RemoveFlag2(Network.GamePackets.Update.Flags2.FendAura); RemoveFlag2(Network.GamePackets.Update.Flags2.MetalAura); RemoveFlag2(Network.GamePackets.Update.Flags2.WoodAura); RemoveFlag2(Network.GamePackets.Update.Flags2.WaterAura); RemoveFlag2(Network.GamePackets.Update.Flags2.EarthAura); RemoveFlag2(Network.GamePackets.Update.Flags2.FireAura); if (!Owner.AlternateEquipment) { Owner.LoadItemStats(this); } else { Owner.LoadItemStats2(this); } } if (killer.EntityFlag == EntityFlag.Player) { BlackSpot spot = new BlackSpot { Remove = 1, Identifier = UID }; killer.Owner.Send((byte[])spot); BlackSpots = false; BlackSpotTime2 = 0; BlackSpotCheck = 0; } if (killer.EntityFlag == Game.EntityFlag.Player) { if (EntityFlag == Game.EntityFlag.Player) { /* Game.PkExpeliate pk = new Game.PkExpeliate(); pk.UID = killer.UID; pk.Name = Name; pk.KilledAt = "KimoConquer"; pk.LostExp = 0; pk.Times = 0; pk.Potency = (uint)BattlePower; pk.Level = Level; PkExpelTable.PkExploitAdd(killer.Owner, UID, pk);*/ } } if (killer.MapID == 3031) { if (this.ConquerPoints >= 20000) { uint ItemID = 729911; this.ConquerPoints -= 20000; ushort X = this.X, Y = this.Y; Game.Map Map = ServerBase.Kernel.Maps[this.MapID]; if (Map.SelectCoordonates(ref X, ref Y)) { Network.GamePackets.FloorItem floorItem = new Network.GamePackets.FloorItem(true); floorItem.ValueType = Network.GamePackets.FloorItem.FloorValueType.ConquerPoints; floorItem.Value = 20000; floorItem.ItemID = ItemID; floorItem.MapID = this.MapID; floorItem.MapObjType = Game.MapObjectType.Item; floorItem.X = X; floorItem.Y = Y; floorItem.Owner = killer.Owner; floorItem.Type = Network.GamePackets.FloorItem.Drop; floorItem.OnFloor = Time32.Now; floorItem.UID = Network.GamePackets.FloorItem.FloorUID.Next; while (Map.Npcs.ContainsKey(floorItem.UID)) floorItem.UID = Network.GamePackets.FloorItem.FloorUID.Next; Map.AddFloorItem(floorItem); this.Owner.SendScreenSpawn(floorItem, true); } } else { this.Teleport(1002, 428, 378); ServerBase.Kernel.SendWorldMessage(new Message("Ops! " + this.Name + " has losed all his/her cps in the LordsWar and teleported back to TwinCity.", System.Drawing.Color.White, Message.TopLeft), ServerBase.Kernel.GamePool.Values); } } if (killer.MapID == 7777) { if (killer.MapID == 7777) { killer.Owner.elitepoints += 1; if (killer.Owner.elitepoints >= 20) { Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "Congratulations, You Have Now " + killer.Owner.elitepoints + " ElitePk Points you can claim your prize now!"); npc.OptionID = 255; killer.Owner.Send(npc.ToArray()); } else { Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "You Have Now " + killer.Owner.elitepoints + " ElitePk Points Congratz you still need " + (20 - killer.Owner.elitepoints) + " more!"); npc.OptionID = 255; killer.Owner.Send(npc.ToArray()); } } } if (EntityFlag == EntityFlag.Player) Owner.XPCount = 0; Killer = killer; Hitpoints = 0; DeathStamp = Time32.Now; //DieString(); ToxicFogLeft = 0; if (Companion) { AddFlag(Network.GamePackets.Update.Flags.Ghost | Network.GamePackets.Update.Flags.Dead | Network.GamePackets.Update.Flags.FadeAway); Network.GamePackets.Attack zattack = new Network.GamePackets.Attack(true); zattack.Attacked = UID; zattack.AttackType = Network.GamePackets.Attack.Kill; zattack.X = X; zattack.Y = Y; MonsterInfo.SendScreen(zattack); Owner.Map.RemoveEntity(this); Owner.Companion = null; } if (EntityFlag == EntityFlag.Player) { if (killer.EntityFlag == EntityFlag.Player) { #region Cheack Pk Map if (Owner.Entity.MapID == 2555 || Owner.Entity.MapID == 5530 || Owner.Entity.MapID == 5531 || Owner.Entity.MapID == 5532 || Owner.Entity.MapID == 1452 || Owner.Entity.MapID == 5560 || Owner.Entity.MapID == 5570 || Owner.Entity.MapID == 5580) { Owner.Entity.Teleport(1002, 438, 382); // Console.WriteLine("Done"); } #endregion Cheack Pk Map if (ServerBase.Constants.PKFreeMaps.Contains(killer.MapID)) goto Over; if (ServerBase.Constants.Damage1Map.Contains(killer.MapID)) goto Over; if (killer.Owner.Map.BaseID == 700) goto Over; if (!ContainsFlag(Network.GamePackets.Update.Flags.FlashingName) && !ContainsFlag(Network.GamePackets.Update.Flags.BlackName)) { killer.AddFlag(Network.GamePackets.Update.Flags.FlashingName); killer.FlashingNameStamp = Time32.Now; killer.FlashingNameTime = 60; if (killer.GuildID != 0) { if (killer.Owner.Guild.Enemy.ContainsKey(GuildID)) { killer.PKPoints += 3; } else { if (!killer.Owner.Enemy.ContainsKey(UID)) killer.PKPoints += 10; else killer.PKPoints += 5; } } else { if (!killer.Owner.Enemy.ContainsKey(UID)) killer.PKPoints += 10; else killer.PKPoints += 5; } if (!this.Owner.Enemy.ContainsKey(killer.UID)) { Network.PacketHandler.AddEnemy(this.Owner, killer.Owner); } } } } if (killer.EntityFlag == EntityFlag.Monster) { DropRandomStuff(Killer); } else { DropRandomStuff(Killer); } RemoveFlag(Network.GamePackets.Update.Flags.FlashingName); Over: Network.GamePackets.Attack attack = new Attack(true); attack.Attacker = killer.UID; attack.Attacked = UID; attack.AttackType = Network.GamePackets.Attack.Kill; attack.X = X; attack.Y = Y; if (EntityFlag == EntityFlag.Player) { AddFlag(Network.GamePackets.Update.Flags.Dead); RemoveFlag(Network.GamePackets.Update.Flags.Fly); RemoveFlag(Network.GamePackets.Update.Flags.Ride); RemoveFlag(Network.GamePackets.Update.Flags.Cyclone); RemoveFlag(Network.GamePackets.Update.Flags.Superman); RemoveFlag(Network.GamePackets.Update.Flags.FatalStrike); RemoveFlag(Network.GamePackets.Update.Flags.FlashingName); RemoveFlag(Network.GamePackets.Update.Flags.ShurikenVortex); RemoveFlag2(Network.GamePackets.Update.Flags2.Oblivion); // if (Body % 10 < 3) // TransformationID = 99; //else // TransformationID = 98; Owner.SendScreen(attack, true); Owner.Send(new MapStatus() { BaseID = (ushort)Database.MapsTable.MapInformations[Owner.Map.ID].BaseID, ID = (uint)Owner.Map.ID, Status = Database.MapsTable.MapInformations[Owner.Map.ID].Status, Weather = Database.MapsTable.MapInformations[Owner.Map.ID].Weather }); Network.GamePackets.Weather weather = new Network.GamePackets.Weather(true); weather.WeatherType = (uint)Program.WeatherType; weather.Intensity = 100; weather.Appearence = 2; weather.Direction = 4; Owner.Send(weather); if (Owner.QualifierGroup != null) { Owner.QualifierGroup.End(Owner); } } else { if (!Companion) { try { if (MonsterInfo != null) if (killer != null) MonsterInfo.Drop(killer); } catch { } } ServerBase.Kernel.Maps[MapID].Floor[X, Y, MapObjType, this] = true; if (killer.EntityFlag == EntityFlag.Player) { killer.Owner.IncreaseExperience(MaxHitpoints, true); if (killer.Owner.Team != null) { foreach (Client.GameState teammate in killer.Owner.Team.Teammates) { if (ServerBase.Kernel.GetDistance(killer.X, killer.Y, teammate.Entity.X, teammate.Entity.Y) <= ServerBase.Constants.pScreenDistance) { if (killer.UID != teammate.Entity.UID) { uint extraExperience = MaxHitpoints / 2; if (killer.Spouse == teammate.Entity.Name) extraExperience = MaxHitpoints * 2; byte TLevelN = teammate.Entity.Level; if (killer.Owner.Team.CanGetNoobExperience(teammate)) { if (teammate.Entity.Level < 137) { extraExperience *= 2; teammate.IncreaseExperience(extraExperience, false); teammate.Send(ServerBase.Constants.NoobTeamExperience(extraExperience)); } } else { if (teammate.Entity.Level < 137) { teammate.IncreaseExperience(extraExperience, false); teammate.Send(ServerBase.Constants.TeamExperience(extraExperience)); } } byte TLevelNn = teammate.Entity.Level; byte newLevel = (byte)(TLevelNn - TLevelN); if (newLevel != 0) { if (TLevelN < 70) { for (int i = TLevelN; i < TLevelNn; i++) { teammate.Team.Teammates[0].VirtuePoints += (uint)(i * 3.83F); teammate.Team.SendMessage(new Message("The leader, " + teammate.Team.Teammates[0].Entity.Name + ", has gained " + (uint)(i * 7.7F) + " virtue points for power leveling the rookies.", System.Drawing.Color.Red, Message.Team)); } } } } } } } if (killer.Level < 137) { uint extraExp = MaxHitpoints; extraExp *= ServerBase.Constants.ExtraExperienceRate; extraExp += extraExp * killer.Gems[3] / 100; extraExp += (uint)(extraExp * ((float)killer.BattlePower / 100)); if (killer.DoubleExperienceTime > 0) extraExp *= 2; if (killer.HeavenBlessing > 0) extraExp += (uint)(extraExp * 20 / 100); if (killer.Reborn >= 2) extraExp /= 3; killer.Owner.Send(ServerBase.Constants.ExtraExperience(extraExp)); } killer.Owner.XPCount++; if (killer.OnKOSpell()) killer.KOSpellTime++; } } } }
public void _timerCallBack(object jjjhh, System.Timers.ElapsedEventArgs arg) { try { if (Owner.Socket ==null ||!Owner.Socket.Connected || Owner.Entity == null) { if (Owner != null) { if (Owner.Screen != null) { if (Owner.Screen.MyTimer != null) { Owner.Screen.MyTimer.Close(); Owner.Screen.MyTimer.Dispose(); } } } return; } try { while (OnAdd.Count != 0) Objects.Add(OnAdd.Dequeue()); while (OnRemove.Count != 0) Objects.Remove(OnRemove.Dequeue()); } catch { // Console.WriteLine(e.ToString()); } #region Monsters // List<IMapObject> toRemove = new List<IMapObject>(); if (Owner.Map.FreezeMonsters) return; try { for (int c = 0; c < Objects.Count; c++) { if (c >= Objects.Count) break; //List<IMapObject> list = new List<IMapObject>(); IMapObject obj = Objects[c]; if (obj != null) { if (obj.MapObjType == MapObjectType.SobNpc) { /*short distance = Kernel.GetDistance(monster.X, monster.Y, Owner.Entity.X, Owner.Entity.Y); if (distance <= monster.MonsterInfo.AttackRange) { monster.MonsterInfo.LastMove = Time32.Now; new Game.Attacking.Handle(null, monster, Owner.Entity); }*/ Network.GamePackets.SobNpcSpawn item = obj as Network.GamePackets.SobNpcSpawn; if (item.MapID == 2060) { if (item.UID == 10011) { if (Game.Team.RedCapture) { foreach (Interfaces.IMapObject _obj in Objects) { if (_obj != null) { if (_obj.MapObjType == MapObjectType.Player) { (_obj as Entity).Owner.Send(item); (_obj as Entity).Owner.Screen.Remove(item); } } } Owner.Map.Floor[item.X, item.Y, MapObjectType.SobNpc, null] = true; Remove(obj); //toRemove.Add(item); } } if (item.UID == 10021) { if (Game.Team.RedCapture) { foreach (Interfaces.IMapObject _obj in Objects) { if (_obj != null) { if (Owner != null) { if (Owner.CaptureR && Owner.Entity.ContainsFlag2(Network.GamePackets.Update.Flags2.CaryingFlag)) { short distance = Kernel.GetDistance(item.X, item.Y, Owner.Entity.X, Owner.Entity.Y); if (distance <= 5) { Owner.Entity.RemoveFlag2(Network.GamePackets.Update.Flags2.CaryingFlag); Data datas = new Data(true); datas.UID = Owner.Entity.UID; datas.ID = 116; datas.dwParam = (uint)3145; Owner.Send(datas); Game.Team.RedCapture = false; Game.Team.RScore += 1; PhoenixProject.ServerBase.Kernel.SendWorldMessage(new Message("Congratulations! " + Owner.Entity.Name + " scored for the Red team. RedScore: " + Game.Team.RScore + "", System.Drawing.Color.Black, Message.Center), PhoenixProject.ServerBase.Kernel.GamePool.Values); if (Game.Team.RScore >= 10) { Game.Team.ClaimRed(); } } } } } } } } if (item.UID == 10022) { if (Game.Team.RedCapture) { foreach (Interfaces.IMapObject _obj in Objects) { if (_obj != null) { if (Owner != null) { if (Owner.CaptureB && Owner.Entity.ContainsFlag2(Network.GamePackets.Update.Flags2.CaryingFlag)) { short distance = Kernel.GetDistance(item.X, item.Y, Owner.Entity.X, Owner.Entity.Y); if (distance <= 5) { Owner.Entity.RemoveFlag2(Network.GamePackets.Update.Flags2.CaryingFlag); Game.Team.RedCapture = false; Game.Team.BScore += 1; Data datas = new Data(true); datas.UID = Owner.Entity.UID; datas.ID = 116; datas.dwParam = (uint)3145; Owner.Send(datas); PhoenixProject.ServerBase.Kernel.SendWorldMessage(new Message("Congratulations! " + Owner.Entity.Name + " scored for the Blue team. BlueScore: " + Game.Team.BScore + "", System.Drawing.Color.Black, Message.Center), PhoenixProject.ServerBase.Kernel.GamePool.Values); if (Game.Team.BScore >= 10) { Game.Team.ClaimBLUE(); } } } } } } } } if (item.UID == 10023) { if (Game.Team.RedCapture) { foreach (Interfaces.IMapObject _obj in Objects) { if (_obj != null) { if (Owner != null) { if (Owner.CaptureW && Owner.Entity.ContainsFlag2(Network.GamePackets.Update.Flags2.CaryingFlag)) { short distance = Kernel.GetDistance(item.X, item.Y, Owner.Entity.X, Owner.Entity.Y); if (distance <= 5) { Owner.Entity.RemoveFlag2(Network.GamePackets.Update.Flags2.CaryingFlag); Game.Team.RedCapture = false; Game.Team.WScore += 1; Data datas = new Data(true); datas.UID = Owner.Entity.UID; datas.ID = 116; datas.dwParam = (uint)3145; Owner.Send(datas); PhoenixProject.ServerBase.Kernel.SendWorldMessage(new Message("Congratulations! " + Owner.Entity.Name + " scored for the White team. WhiteScore: " + Game.Team.WScore + "", System.Drawing.Color.Black, Message.Center), PhoenixProject.ServerBase.Kernel.GamePool.Values); if (Game.Team.WScore >= 10) { Game.Team.ClaimWhite(); } } } } } } } } if (item.UID == 10024) { if (Game.Team.RedCapture) { foreach (Interfaces.IMapObject _obj in Objects) { if (_obj != null) { if (Owner != null) { if (Owner.CaptureBL && Owner.Entity.ContainsFlag2(Network.GamePackets.Update.Flags2.CaryingFlag)) { short distance = Kernel.GetDistance(item.X, item.Y, Owner.Entity.X, Owner.Entity.Y); if (distance <= 5) { Owner.Entity.RemoveFlag2(Network.GamePackets.Update.Flags2.CaryingFlag); Game.Team.RedCapture = false; Game.Team.BLScore += 1; Data datas = new Data(true); datas.UID = Owner.Entity.UID; datas.ID = 116; datas.dwParam = (uint)3145; Owner.Send(datas); PhoenixProject.ServerBase.Kernel.SendWorldMessage(new Message("Congratulations! " + Owner.Entity.Name + " scored for the Black team. BlackScore: " + Game.Team.BLScore + "", System.Drawing.Color.Black, Message.Center), PhoenixProject.ServerBase.Kernel.GamePool.Values); if (Game.Team.BLScore >= 10) { Game.Team.ClaimBlack(); } } } } } } } } } } if (obj.MapObjType == MapObjectType.Monster) { if (Owner != null) { if (Owner.Map != null) { if (Owner.Map != null) { Entity monster = null; if (Objects[c] == null) continue; monster = Objects[c] as Game.Entity; if (monster == null) continue; #region Buffers if (monster.ContainsFlag(Network.GamePackets.Update.Flags.Stigma)) { if (Time32.Now >= monster.StigmaStamp.AddSeconds(monster.StigmaTime)) { monster.StigmaTime = 0; monster.StigmaIncrease = 0; monster.RemoveFlag(Network.GamePackets.Update.Flags.Stigma); } } if (monster.BlackSpotTime2 > 0) { if (Time32.Now >= monster.BlackSpotTime.AddSeconds(monster.BlackSpotTime2)) { monster.BlackSpotTime2 = 0; monster.BlackSpots = false; BlackSpot spot = new BlackSpot { Remove = 1, Identifier = monster.UID }; Owner.Send(spot); } else { BlackSpot spot = new BlackSpot { Remove = 0, Identifier = monster.UID }; Owner.Send(spot); } } else { BlackSpot spot = new BlackSpot { Remove = 1, Identifier = monster.UID }; Owner.Send(spot); } if (monster.ContainsFlag(Network.GamePackets.Update.Flags.Dodge)) { if (Time32.Now >= monster.DodgeStamp.AddSeconds(monster.DodgeTime)) { monster.DodgeTime = 0; monster.DodgeIncrease = 0; monster.RemoveFlag(Network.GamePackets.Update.Flags.Dodge); } } if (monster.ContainsFlag(Network.GamePackets.Update.Flags.Invisibility)) { if (Time32.Now >= monster.InvisibilityStamp.AddSeconds(monster.InvisibilityTime)) { monster.RemoveFlag(Network.GamePackets.Update.Flags.Invisibility); } } if (monster.ContainsFlag(Network.GamePackets.Update.Flags.StarOfAccuracy)) { if (monster.StarOfAccuracyTime != 0) { if (Time32.Now >= monster.StarOfAccuracyStamp.AddSeconds(monster.StarOfAccuracyTime)) { monster.RemoveFlag(Network.GamePackets.Update.Flags.StarOfAccuracy); } } else { if (Time32.Now >= monster.AccuracyStamp.AddSeconds(monster.AccuracyTime)) { monster.RemoveFlag(Network.GamePackets.Update.Flags.StarOfAccuracy); } } } if (monster.ContainsFlag(Network.GamePackets.Update.Flags.MagicShield)) { if (monster.MagicShieldTime != 0) { if (Time32.Now >= monster.MagicShieldStamp.AddSeconds(monster.MagicShieldTime)) { monster.MagicShieldIncrease = 0; monster.MagicShieldTime = 0; monster.RemoveFlag(Network.GamePackets.Update.Flags.MagicShield); } } else { if (Time32.Now >= monster.ShieldStamp.AddSeconds(monster.ShieldTime)) { monster.ShieldIncrease = 0; monster.ShieldTime = 0; monster.RemoveFlag(Network.GamePackets.Update.Flags.MagicShield); } } } #endregion #region Dead monster if (monster.Dead || monster.Killed) { if (!monster.ContainsFlag(Network.GamePackets.Update.Flags.Ghost) || monster.Killed) { monster.Killed = false; monster.MonsterInfo.InSight = 0; monster.MonsterInfo.InStig = 0; monster.MonsterInfo.InRev = 0; monster.MonsterInfo.InBlack = 0; monster.AddFlag(Network.GamePackets.Update.Flags.Ghost); monster.AddFlag(Network.GamePackets.Update.Flags.Dead); monster.AddFlag(Network.GamePackets.Update.Flags.FadeAway); Network.GamePackets.Attack attack = new Network.GamePackets.Attack(true); attack.Attacker = monster.Killer.UID; attack.Attacked = monster.UID; attack.AttackType = Network.GamePackets.Attack.Kill; attack.X = monster.X; attack.Y = monster.Y; Owner.Map.Floor[monster.X, monster.Y, MapObjectType.Monster, monster] = true; attack.KOCount = ++monster.Killer.KOCount; if (monster.Killer.EntityFlag == EntityFlag.Player) { monster.MonsterInfo.ExcludeFromSend = monster.Killer.UID; monster.Killer.Owner.Send(attack); if (monster.Killer.Owner.Companion != null) { if (monster.Killer.Owner.Companion.MonsterInfo != null) { monster.Killer.Owner.Map.RemoveEntity(monster.Killer.Owner.Companion); Data data = new Data(true); data.UID = monster.Killer.Owner.Companion.UID; data.ID = Data.RemoveEntity; monster.Killer.Owner.Companion.MonsterInfo.SendScreen(data); monster.Killer.Owner.Companion = null; } } } monster.MonsterInfo.SendScreen(attack); monster.MonsterInfo.ExcludeFromSend = 0; } if (Time32.Now > monster.DeathStamp.AddSeconds(4)) { Network.GamePackets.Data data = new Network.GamePackets.Data(true); data.UID = monster.UID; data.ID = Network.GamePackets.Data.RemoveEntity; monster.MonsterInfo.SendScreen(data); } } #endregion #region Alive monster else { if ((obj as Entity).Stunned) { if (Time32.Now > (obj as Entity).StunStamp.AddMilliseconds(1500)) (obj as Entity).Stunned = false; else continue; } if ((obj as Entity).Companion) continue; if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.MinimumSpeed)) { #region Guards if (monster.Name.Contains("Guard")) { if (monster.Name == "Guard1" || monster.MonsterInfo.ID >= 9000 && monster.MonsterInfo.ID <= 9003) { if (monster.MonsterInfo.InSight == 0) { if (monster.X != monster.MonsterInfo.BoundX || monster.Y != monster.MonsterInfo.BoundY) { monster.X = monster.MonsterInfo.BoundX; monster.Y = monster.MonsterInfo.BoundY; Network.GamePackets.TwoMovements jump = new PhoenixProject.Network.GamePackets.TwoMovements(); jump.X = monster.MonsterInfo.BoundX; jump.Y = monster.MonsterInfo.BoundY; jump.EntityCount = 1; jump.FirstEntity = monster.UID; jump.MovementType = Network.GamePackets.TwoMovements.Jump; Owner.SendScreen(jump, true); } if (Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.FlashingName)) monster.MonsterInfo.InSight = Owner.Entity.UID; } else { if (Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.FlashingName)) { if (monster.MonsterInfo.InSight == Owner.Entity.UID) { if (!Owner.Entity.Dead) { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.AttackSpeed)) { short distance = Kernel.GetDistance(monster.X, monster.Y, Owner.Entity.X, Owner.Entity.Y); if (distance <= monster.MonsterInfo.AttackRange) { monster.MonsterInfo.LastMove = Time32.Now; new Game.Attacking.Handle(null, monster, Owner.Entity); } else { if (distance <= monster.MonsterInfo.ViewRange) { Network.GamePackets.TwoMovements jump = new PhoenixProject.Network.GamePackets.TwoMovements(); jump.X = Owner.Entity.X; jump.Y = Owner.Entity.Y; monster.X = Owner.Entity.X; monster.Y = Owner.Entity.Y; jump.EntityCount = 1; jump.FirstEntity = monster.UID; jump.MovementType = Network.GamePackets.TwoMovements.Jump; Owner.SendScreen(jump, true); } } } } else { monster.MonsterInfo.InSight = 0; } } else { } } else { if (monster.MonsterInfo.InSight == Owner.Entity.UID) { monster.MonsterInfo.InSight = 0; } } } for (int i = 0; i < Objects.Count; i++) { if (i >= Objects.Count) break; IMapObject obj2 = Objects[i]; if (obj2 == null) continue; if (obj2.MapObjType == MapObjectType.Monster) { Entity monster2 = obj2 as Entity;//null;// Owner.Map.Entities[obj2.UID]; if (monster2 == null) continue; if (monster2.Dead) continue; if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.AttackSpeed)) { if (!monster2.Name.Contains("Guard") && !monster2.Companion) { short distance = Kernel.GetDistance(monster.X, monster.Y, monster2.X, monster2.Y); if (distance <= monster.MonsterInfo.AttackRange) { monster.MonsterInfo.LastMove = Time32.Now; new Game.Attacking.Handle(null, monster, monster2); } } } } } } #region BlackName Guard if (monster.Name == "Guard2") { if (monster.MonsterInfo.InBlack == 0) { if (monster.X != monster.MonsterInfo.BoundX || monster.Y != monster.MonsterInfo.BoundY) { monster.X = monster.MonsterInfo.BoundX; monster.Y = monster.MonsterInfo.BoundY; Network.GamePackets.TwoMovements jump = new PhoenixProject.Network.GamePackets.TwoMovements(); jump.X = monster.MonsterInfo.BoundX; jump.Y = monster.MonsterInfo.BoundY; jump.EntityCount = 1; jump.FirstEntity = monster.UID; jump.MovementType = Network.GamePackets.TwoMovements.Jump; Owner.SendScreen(jump, true); } if (Owner.Entity.PKPoints > 99 || Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.FlashingName)) monster.MonsterInfo.InBlack = Owner.Entity.UID; } else { if (Owner.Entity.PKPoints > 99 || Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.FlashingName)) { if (monster.MonsterInfo.InBlack == Owner.Entity.UID) { if (!Owner.Entity.Dead) { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.AttackSpeed)) { short distance = Kernel.GetDistance(monster.X, monster.Y, Owner.Entity.X, Owner.Entity.Y); if (distance <= monster.MonsterInfo.AttackRange) { monster.MonsterInfo.LastMove = Time32.Now; new Game.Attacking.Handle(null, monster, Owner.Entity); } else { if (distance <= monster.MonsterInfo.ViewRange) { Network.GamePackets.TwoMovements jump = new PhoenixProject.Network.GamePackets.TwoMovements(); jump.X = Owner.Entity.X; jump.Y = Owner.Entity.Y; monster.X = Owner.Entity.X; monster.Y = Owner.Entity.Y; jump.EntityCount = 1; jump.FirstEntity = monster.UID; jump.MovementType = Network.GamePackets.TwoMovements.Jump; Owner.SendScreen(jump, true); } } } } else { monster.MonsterInfo.InBlack = 0; } } else { } } else { if (monster.MonsterInfo.InBlack == Owner.Entity.UID) { monster.MonsterInfo.InBlack = 0; } } } for (int i = 0; i < Objects.Count; i++) { if (i >= Objects.Count) break; IMapObject obj2 = Objects[i]; if (obj2 == null) continue; if (obj2.MapObjType == MapObjectType.Monster) { Entity monster2 = obj2 as Entity;//null;// Owner.Map.Entities[obj2.UID]; if (monster2 == null) continue; if (monster2.Dead) continue; if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.AttackSpeed)) { if (!monster2.Name.Contains("Guard") && !monster2.Companion) { short distance = Kernel.GetDistance(monster.X, monster.Y, monster2.X, monster2.Y); if (distance <= monster.MonsterInfo.AttackRange) { monster.MonsterInfo.LastMove = Time32.Now; new Game.Attacking.Handle(null, monster, monster2); } } } } } } #endregion #region Rev Guard if (monster.Name == "RevGuard") { if (monster.MonsterInfo.InRev == 0) { if (monster.X != monster.MonsterInfo.BoundX || monster.Y != monster.MonsterInfo.BoundY) { monster.X = monster.MonsterInfo.BoundX; monster.Y = monster.MonsterInfo.BoundY; Network.GamePackets.TwoMovements jump = new PhoenixProject.Network.GamePackets.TwoMovements(); jump.X = monster.MonsterInfo.BoundX; jump.Y = monster.MonsterInfo.BoundY; jump.EntityCount = 1; jump.FirstEntity = monster.UID; jump.MovementType = Network.GamePackets.TwoMovements.Jump; Owner.SendScreen(jump, true); } if (Owner.Entity.Dead) monster.MonsterInfo.InRev = Owner.Entity.UID; } else { if (Owner.Entity.Dead) { if (monster.MonsterInfo.InRev == Owner.Entity.UID) { if (Owner.Entity.Dead) { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.AttackSpeed)) { short distance = Kernel.GetDistance(monster.X, monster.Y, Owner.Entity.X, Owner.Entity.Y); if (distance <= monster.MonsterInfo.AttackRange) { monster.MonsterInfo.LastMove = Time32.Now; new Game.Attacking.Handle(null, monster, Owner.Entity); } else { if (distance <= monster.MonsterInfo.ViewRange) { /*Network.GamePackets.TwoMovements jump = new PhoenixProject.Network.GamePackets.TwoMovements(); jump.X = Owner.Entity.X; jump.Y = Owner.Entity.Y; monster.X = Owner.Entity.X; monster.Y = Owner.Entity.Y; jump.EntityCount = 1; jump.FirstEntity = monster.UID; jump.MovementType = Network.GamePackets.TwoMovements.Jump; Owner.SendScreen(jump, true);*/ } } } } else { monster.MonsterInfo.InRev = 0; } } else { monster.MonsterInfo.InRev = 0; } } else { if (monster.MonsterInfo.InRev == Owner.Entity.UID) { monster.MonsterInfo.InRev = 0; } } } } #endregion #region Stig Guard if (monster.Name == "StigGuard") { if (monster.MonsterInfo.InStig == 0) { if (monster.X != monster.MonsterInfo.BoundX || monster.Y != monster.MonsterInfo.BoundY) { monster.X = monster.MonsterInfo.BoundX; monster.Y = monster.MonsterInfo.BoundY; Network.GamePackets.TwoMovements jump = new PhoenixProject.Network.GamePackets.TwoMovements(); jump.X = monster.MonsterInfo.BoundX; jump.Y = monster.MonsterInfo.BoundY; jump.EntityCount = 1; jump.FirstEntity = monster.UID; jump.MovementType = Network.GamePackets.TwoMovements.Jump; Owner.SendScreen(jump, true); } if (!Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Stigma)) monster.MonsterInfo.InStig = Owner.Entity.UID; } else { if (!Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Stigma)) { if (monster.MonsterInfo.InStig == Owner.Entity.UID) { if (!Owner.Entity.Dead) { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.AttackSpeed)) { short distance = Kernel.GetDistance(monster.X, monster.Y, Owner.Entity.X, Owner.Entity.Y); if (distance <= monster.MonsterInfo.AttackRange) { monster.MonsterInfo.LastMove = Time32.Now; new Game.Attacking.Handle(null, monster, Owner.Entity); } else { if (distance <= monster.MonsterInfo.ViewRange) { /*Network.GamePackets.TwoMovements jump = new PhoenixProject.Network.GamePackets.TwoMovements(); jump.X = Owner.Entity.X; jump.Y = Owner.Entity.Y; monster.X = Owner.Entity.X; monster.Y = Owner.Entity.Y; jump.EntityCount = 1; jump.FirstEntity = monster.UID; jump.MovementType = Network.GamePackets.TwoMovements.Jump; Owner.SendScreen(jump, true);*/ } } } } else { monster.MonsterInfo.InStig = 0; } } else { monster.MonsterInfo.InStig = 0; } } else { if (monster.MonsterInfo.InStig == Owner.Entity.UID) { monster.MonsterInfo.InStig = 0; } } } for (int i = 0; i < Objects.Count; i++) { if (i >= Objects.Count) break; IMapObject obj2 = Objects[i]; if (obj2 == null) continue; if (obj2.MapObjType == MapObjectType.Monster) { Entity monster2 = obj2 as Entity;//null;// Owner.Map.Entities[obj2.UID]; if (monster2 == null) continue; if (monster2.Dead) continue; if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.AttackSpeed)) { if (!monster2.Name.Contains("Guard") && !monster2.Companion) { short distance = Kernel.GetDistance(monster.X, monster.Y, monster2.X, monster2.Y); if (distance <= monster.MonsterInfo.AttackRange) { monster.MonsterInfo.LastMove = Time32.Now; new Game.Attacking.Handle(null, monster, monster2); } } } } } } #endregion #endregion } else { #region Monsters short distance = Kernel.GetDistance(monster.X, monster.Y, Owner.Entity.X, Owner.Entity.Y); if (monster.MonsterInfo.InSight != 0 && monster.MonsterInfo.InSight != Owner.Entity.UID) { if (monster.MonsterInfo.InSight > 1000000) { var cl = ServerBase.Kernel.GamePool[monster.MonsterInfo.InSight]; if (cl == null) monster.MonsterInfo.InSight = 0; else { short dst = Kernel.GetDistance(monster.X, monster.Y, cl.Entity.X, cl.Entity.Y); if (dst > ServerBase.Constants.pScreenDistance) monster.MonsterInfo.InSight = 0; } } else { Entity companion = null; for (int x = 0; x < Owner.Map.Companions.Count; x++) { if (x >= Owner.Map.Companions.Count) break; if (Owner.Map.Companions[x] != null) { if (Owner.Map.Companions[x].UID == monster.MonsterInfo.InSight) { companion = Owner.Map.Companions[x]; break; } } } if (companion == null) monster.MonsterInfo.InSight = 0; else { short dst = Kernel.GetDistance(monster.X, monster.Y, companion.X, companion.Y); if (dst > ServerBase.Constants.pScreenDistance) monster.MonsterInfo.InSight = 0; } } } /*if (monster.MonsterInfo.InRev != 0 && monster.MonsterInfo.InRev != Owner.Entity.UID) { if (monster.MonsterInfo.InRev > 1000000) { var cl = ServerBase.Kernel.GamePool[monster.MonsterInfo.InRev]; if (cl == null) monster.MonsterInfo.InRev = 0; else { short dst = Kernel.GetDistance(monster.X, monster.Y, cl.Entity.X, cl.Entity.Y); if (dst > ServerBase.Constants.pScreenDistance2 || !cl.Entity.Dead) monster.MonsterInfo.InRev = 0; } } } if (monster.MonsterInfo.InStig != 0 && monster.MonsterInfo.InStig != Owner.Entity.UID) { if (monster.MonsterInfo.InStig > 1000000) { var cl = ServerBase.Kernel.GamePool[monster.MonsterInfo.InStig]; if (cl == null) monster.MonsterInfo.InStig = 0; else { short dst = Kernel.GetDistance(monster.X, monster.Y, cl.Entity.X, cl.Entity.Y); if (dst > ServerBase.Constants.pScreenDistance2 || cl.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Stigma)) monster.MonsterInfo.InStig = 0; } } } if (monster.MonsterInfo.InBlack != 0 && monster.MonsterInfo.InBlack != Owner.Entity.UID) { if (monster.MonsterInfo.InBlack > 1000000) { var cl = ServerBase.Kernel.GamePool[monster.MonsterInfo.InBlack]; if (cl == null) monster.MonsterInfo.InBlack = 0; else { short dst = Kernel.GetDistance(monster.X, monster.Y, cl.Entity.X, cl.Entity.Y); if (dst > ServerBase.Constants.pScreenDistance || cl.Entity.PKPoints < 100) monster.MonsterInfo.InBlack = 0; } } }*/ if (distance <= ServerBase.Constants.pScreenDistance) { #region Companions if (Owner.Companion != null) { if (Owner.Companion.Companion && !Owner.Companion.Dead) { short distance2 = Kernel.GetDistance(monster.X, monster.Y, Owner.Companion.X, Owner.Companion.Y); if (distance > distance2 || Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Invisibility) || Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Fly)) { if (monster.MonsterInfo.InSight == 0) { monster.MonsterInfo.InSight = Owner.Companion.UID; } else { if (monster.MonsterInfo.InSight == Owner.Companion.UID) { if (distance2 > ServerBase.Constants.pScreenDistance) { monster.MonsterInfo.InSight = 0; } else { if (distance2 <= monster.MonsterInfo.AttackRange) { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.AttackSpeed)) { monster.MonsterInfo.LastMove = Time32.Now; new Game.Attacking.Handle(null, monster, Owner.Companion); } } else { if (distance2 > monster.MonsterInfo.ViewRange / 2) { if (distance2 < ServerBase.Constants.pScreenDistance) { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.RunSpeed)) { monster.MonsterInfo.LastMove = Time32.Now; Enums.ConquerAngle facing = ServerBase.Kernel.GetAngle(monster.X, monster.Y, Owner.Companion.X, Owner.Companion.Y); if (!monster.Move(facing)) { facing = (Enums.ConquerAngle)ServerBase.Kernel.Random.Next(7); if (monster.Move(facing)) { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; move.GroundMovementType = Network.GamePackets.GroundMovement.Run; monster.MonsterInfo.SendScreen(move); } } else { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; move.GroundMovementType = Network.GamePackets.GroundMovement.Run; monster.MonsterInfo.SendScreen(move); } } } else { monster.MonsterInfo.InSight = 0; } } else { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.MoveSpeed)) { monster.MonsterInfo.LastMove = Time32.Now; Enums.ConquerAngle facing = ServerBase.Kernel.GetAngle(monster.X, monster.Y, Owner.Companion.X, Owner.Companion.Y); if (!monster.Move(facing)) { facing = (Enums.ConquerAngle)ServerBase.Kernel.Random.Next(7); if (monster.Move(facing)) { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; monster.MonsterInfo.SendScreen(move); } } else { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; monster.MonsterInfo.SendScreen(move); } } } } } } else goto Over; } } } else goto Over; } else goto Over; #endregion Over: #region Player if (monster.MonsterInfo.Name.Contains("Guard")) { if (monster.MonsterInfo.InBlack == 0) { if (distance <= monster.MonsterInfo.ViewRange) { if (!Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Invisibility)) { if (monster.MonsterInfo.SpellID != 0 || !Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Fly)) { monster.MonsterInfo.InBlack = Owner.Entity.UID; } } } } else { if (monster.MonsterInfo.InBlack == Owner.Entity.UID) { if (monster.MonsterInfo.SpellID == 0 && Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Fly)) { monster.MonsterInfo.InBlack = 0; return; } if (Owner.Entity.Dead) { monster.MonsterInfo.InBlack = 0; return; } if (distance > ServerBase.Constants.pScreenDistance) { monster.MonsterInfo.InBlack = 0; } else { if (distance <= monster.MonsterInfo.AttackRange) { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.AttackSpeed)) { monster.MonsterInfo.LastMove = Time32.Now; new Game.Attacking.Handle(null, monster, Owner.Entity); } } else { if (distance > monster.MonsterInfo.ViewRange / 2) { if (distance < ServerBase.Constants.pScreenDistance) { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.RunSpeed)) { monster.MonsterInfo.LastMove = Time32.Now; Enums.ConquerAngle facing = ServerBase.Kernel.GetAngle(monster.X, monster.Y, Owner.Entity.X, Owner.Entity.Y); if (!monster.Move(facing)) { facing = (Enums.ConquerAngle)ServerBase.Kernel.Random.Next(7); if (monster.Move(facing)) { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; move.GroundMovementType = Network.GamePackets.GroundMovement.Run; monster.MonsterInfo.SendScreen(move); } } else { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; move.GroundMovementType = Network.GamePackets.GroundMovement.Run; monster.MonsterInfo.SendScreen(move); } } } else { monster.MonsterInfo.InBlack = 0; } } else { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.MoveSpeed)) { monster.MonsterInfo.LastMove = Time32.Now; Enums.ConquerAngle facing = ServerBase.Kernel.GetAngle(monster.X, monster.Y, Owner.Entity.X, Owner.Entity.Y); if (!monster.Move(facing)) { facing = (Enums.ConquerAngle)ServerBase.Kernel.Random.Next(7); if (monster.Move(facing)) { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; monster.MonsterInfo.SendScreen(move); } } else { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; monster.MonsterInfo.SendScreen(move); } } } } } } } } if (monster.MonsterInfo.InSight == 0) { if (!Owner.Entity.Dead) { if (distance <= monster.MonsterInfo.ViewRange) { if (!Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Invisibility)) { if (monster.MonsterInfo.SpellID != 0 || !Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Fly)) { monster.MonsterInfo.InSight = Owner.Entity.UID; } } } } } else { if (!Owner.Entity.Dead) { if (monster.MonsterInfo.InSight == Owner.Entity.UID) { if (monster.MonsterInfo.SpellID == 0 && Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Fly)) { monster.MonsterInfo.InSight = 0; return; } if (Owner.Entity.Dead) { monster.MonsterInfo.InSight = 0; return; } if (distance > ServerBase.Constants.pScreenDistance) { monster.MonsterInfo.InSight = 0; } else { if (!Owner.Entity.Dead) { if (distance <= monster.MonsterInfo.AttackRange) { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.AttackSpeed)) { monster.MonsterInfo.LastMove = Time32.Now; new Game.Attacking.Handle(null, monster, Owner.Entity); } } else { if (distance > monster.MonsterInfo.ViewRange / 2) { if (distance < ServerBase.Constants.pScreenDistance) { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.RunSpeed)) { monster.MonsterInfo.LastMove = Time32.Now; Enums.ConquerAngle facing = ServerBase.Kernel.GetAngle(monster.X, monster.Y, Owner.Entity.X, Owner.Entity.Y); if (!monster.Move(facing)) { facing = (Enums.ConquerAngle)ServerBase.Kernel.Random.Next(7); if (monster.Move(facing)) { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; move.GroundMovementType = Network.GamePackets.GroundMovement.Run; monster.MonsterInfo.SendScreen(move); } } else { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; move.GroundMovementType = Network.GamePackets.GroundMovement.Run; monster.MonsterInfo.SendScreen(move); } } } else { monster.MonsterInfo.InSight = 0; } } else { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.MoveSpeed)) { monster.MonsterInfo.LastMove = Time32.Now; Enums.ConquerAngle facing = ServerBase.Kernel.GetAngle(monster.X, monster.Y, Owner.Entity.X, Owner.Entity.Y); if (!monster.Move(facing)) { facing = (Enums.ConquerAngle)ServerBase.Kernel.Random.Next(7); if (monster.Move(facing)) { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; monster.MonsterInfo.SendScreen(move); } } else { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; monster.MonsterInfo.SendScreen(move); } } } } } else { if (Owner.Entity.Dead) { monster.MonsterInfo.InSight = 0; // Console.WriteLine("cheack1"); return; } } } } } } if (monster.MonsterInfo.Name.Contains("Guard")) { if (monster.MonsterInfo.InRev == 0) { if (distance <= monster.MonsterInfo.ViewRange) { if (!Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Invisibility)) { if (monster.MonsterInfo.SpellID != 0 || !Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Fly)) { monster.MonsterInfo.InRev = Owner.Entity.UID; } } } } else { if (monster.MonsterInfo.InRev == Owner.Entity.UID) { if (monster.MonsterInfo.SpellID == 0 && Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Fly)) { monster.MonsterInfo.InRev = 0; return; } if (!Owner.Entity.Dead) { monster.MonsterInfo.InRev = 0; return; } if (distance > ServerBase.Constants.pScreenDistance) { monster.MonsterInfo.InRev = 0; } else { if (distance <= monster.MonsterInfo.AttackRange) { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.AttackSpeed)) { monster.MonsterInfo.LastMove = Time32.Now; new Game.Attacking.Handle(null, monster, Owner.Entity); } } else { if (distance > monster.MonsterInfo.ViewRange / 2) { if (distance < ServerBase.Constants.pScreenDistance) { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.RunSpeed)) { monster.MonsterInfo.LastMove = Time32.Now; Enums.ConquerAngle facing = ServerBase.Kernel.GetAngle(monster.X, monster.Y, Owner.Entity.X, Owner.Entity.Y); if (!monster.Move(facing)) { facing = (Enums.ConquerAngle)ServerBase.Kernel.Random.Next(7); if (monster.Move(facing)) { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; move.GroundMovementType = Network.GamePackets.GroundMovement.Run; monster.MonsterInfo.SendScreen(move); } } else { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; move.GroundMovementType = Network.GamePackets.GroundMovement.Run; monster.MonsterInfo.SendScreen(move); } } } else { monster.MonsterInfo.InRev = 0; } } else { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.MoveSpeed)) { monster.MonsterInfo.LastMove = Time32.Now; Enums.ConquerAngle facing = ServerBase.Kernel.GetAngle(monster.X, monster.Y, Owner.Entity.X, Owner.Entity.Y); if (!monster.Move(facing)) { facing = (Enums.ConquerAngle)ServerBase.Kernel.Random.Next(7); if (monster.Move(facing)) { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; monster.MonsterInfo.SendScreen(move); } } else { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; monster.MonsterInfo.SendScreen(move); } } } } } } } } if (monster.MonsterInfo.Name.Contains("Guard")) { if (monster.MonsterInfo.InStig == 0) { if (distance <= monster.MonsterInfo.ViewRange) { if (!Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Invisibility)) { if (monster.MonsterInfo.SpellID != 0 || !Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Fly)) { monster.MonsterInfo.InStig = Owner.Entity.UID; } } } } else { if (monster.MonsterInfo.InStig == Owner.Entity.UID) { if (monster.MonsterInfo.SpellID == 0 && Owner.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Fly)) { monster.MonsterInfo.InStig = 0; return; } if (Owner.Entity.Dead) { monster.MonsterInfo.InStig = 0; return; } if (distance > ServerBase.Constants.pScreenDistance) { monster.MonsterInfo.InStig = 0; } else { if (distance <= monster.MonsterInfo.AttackRange) { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.AttackSpeed)) { monster.MonsterInfo.LastMove = Time32.Now; new Game.Attacking.Handle(null, monster, Owner.Entity); } } else { if (distance > monster.MonsterInfo.ViewRange / 2) { if (distance < ServerBase.Constants.pScreenDistance) { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.RunSpeed)) { monster.MonsterInfo.LastMove = Time32.Now; Enums.ConquerAngle facing = ServerBase.Kernel.GetAngle(monster.X, monster.Y, Owner.Entity.X, Owner.Entity.Y); if (!monster.Move(facing)) { facing = (Enums.ConquerAngle)ServerBase.Kernel.Random.Next(7); if (monster.Move(facing)) { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; move.GroundMovementType = Network.GamePackets.GroundMovement.Run; monster.MonsterInfo.SendScreen(move); } } else { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; move.GroundMovementType = Network.GamePackets.GroundMovement.Run; monster.MonsterInfo.SendScreen(move); } } } else { monster.MonsterInfo.InStig = 0; } } else { if (Time32.Now >= monster.MonsterInfo.LastMove.AddMilliseconds(monster.MonsterInfo.MoveSpeed)) { monster.MonsterInfo.LastMove = Time32.Now; Enums.ConquerAngle facing = ServerBase.Kernel.GetAngle(monster.X, monster.Y, Owner.Entity.X, Owner.Entity.Y); if (!monster.Move(facing)) { facing = (Enums.ConquerAngle)ServerBase.Kernel.Random.Next(7); if (monster.Move(facing)) { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; monster.MonsterInfo.SendScreen(move); } } else { monster.Facing = facing; Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true); move.Direction = facing; move.UID = monster.UID; monster.MonsterInfo.SendScreen(move); } } } } } } } } #endregion } else { Remove(obj); } } #endregion } } #endregion } } } } if (obj.MapObjType == MapObjectType.Item) { Network.GamePackets.FloorItem item = obj as Network.GamePackets.FloorItem; if (item.Type != Network.GamePackets.FloorItem.Effect) { if (Time32.Now > item.OnFloor.AddSeconds(ServerBase.Constants.FloorItemSeconds)) { item.Type = Network.GamePackets.FloorItem.Remove; foreach (Interfaces.IMapObject _obj in Objects) { if (_obj != null) { if (_obj.MapObjType == MapObjectType.Player) { (_obj as Entity).Owner.Send(item); } } } Owner.Map.Floor[item.X, item.Y, MapObjectType.Item, null] = true; Remove(obj); } } else { // Console.WriteLine("zaza"); item.Type = Network.GamePackets.FloorItem.Effect; foreach (Interfaces.IMapObject _obj in Objects) { if (_obj != null) { if (_obj.MapObjType == MapObjectType.Player) { (_obj as Entity).Owner.Send(item); } } } } } } } } catch (Exception e) { Program.SaveException(e); } /* foreach (IMapObject obj in toRemove) Remove(obj);*/ #endregion } catch { /*Console.WriteLine(e.ToString()); Console.WriteLine("erorrr screnn timer");*/ } }
private void Execute() { #region interactions if (attack != null) { switch (attack.AttackType) { case (uint)Network.GamePackets.Attack.InteractionRequest: new InteractionRequest(attack, attacker); return; case (uint)Network.GamePackets.Attack.InteractionEffect: new InteractionEffect(attack, attacker); return; case (uint)Network.GamePackets.Attack.InteractionAccept: new InteractionAccept(attack, attacker); return; case (uint)Network.GamePackets.Attack.InteractionRefuse: new InteractionRefuse(attack, attacker); return; case (uint)Network.GamePackets.Attack.InteractionStopEffect: new InteractionStopEffect(attack, attacker); return; } } #endregion #region Monster -> Player \ Monster if (attack == null) { if (attacker.EntityFlag != EntityFlag.Monster) return; if (attacker.Companion) { if (ServerBase.Constants.PKForbiddenMaps.Contains(attacker.MapID)) return; } if (attacked.EntityFlag == EntityFlag.Player) { if (!attacked.Owner.Attackable) return; if (attacked.Dead && attacker.MonsterInfo.SpellID != 1050) return; if (attacker.MonsterInfo.SpellID == 0)// from this bracket to the next die delay replce this with urs { attack = new Attack(true); attack.Effect1 = Attack.AttackEffects1.None; uint damage = Calculate.Melee(attacker, attacked, ref attack); attack.Attacker = attacker.UID; attack.Attacked = attacked.UID; attack.AttackType = Attack.Melee; attack.Damage = damage; attack.X = attacked.X; attack.Y = attacked.Y; BlessEffect.Effect(attacked); if (attacked.EntityFlag == EntityFlag.Player) { if (attacked.Action == Enums.ConquerAction.Sit) if (attacked.Stamina > 20) attacked.Stamina -= 20; else attacked.Stamina = 0; attacked.Action = Enums.ConquerAction.None; //Console.WriteLine("ssS"); } if (attacked.Hitpoints <= damage) { attacked.Owner.SendScreen(attack, true); attacked.Die(attacker); } else { attacked.Hitpoints -= damage; attacked.Owner.SendScreen(attack, true); } } else { SpellUse suse = new SpellUse(true); attack = new Attack(true); attack.Effect1 = Attack.AttackEffects1.None; uint damage = Calculate.Magic(attacker, attacked, attacker.MonsterInfo.SpellID, 0, ref attack); suse.Effect1 = attack.Effect1; if (attacked.EntityFlag == EntityFlag.Player) { if (attacked.Action == Enums.ConquerAction.Sit) if (attacked.Stamina > 20) attacked.Stamina -= 20; else attacked.Stamina = 0; attacked.Action = Enums.ConquerAction.None; //Console.WriteLine("ssS"); } if (attacked.Hitpoints <= damage) { attacked.Die(attacker); } else { attacked.Hitpoints -= damage; } if (attacker.Companion) attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true); suse.Attacker = attacker.UID; suse.SpellID = attacker.MonsterInfo.SpellID; suse.X = attacked.X; suse.Y = attacked.Y; suse.Targets.Add(attacked.UID, damage); attacked.Owner.SendScreen(suse, true); } } else { if (attacker.MonsterInfo.SpellID == 0) { attack = new Attack(true); attack.Effect1 = Attack.AttackEffects1.None; uint damage = Calculate.Melee(attacker, attacked, ref attack); attack.Attacker = attacker.UID; attack.Attacked = attacked.UID; attack.AttackType = Attack.Melee; attack.Damage = damage; attack.X = attacked.X; attack.Y = attacked.Y; attacked.MonsterInfo.SendScreen(attack); if (attacker.Companion) if (damage > attacked.Hitpoints) attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true); else attacker.Owner.IncreaseExperience(damage, true); if (attacked.Hitpoints <= damage) { attacked.Die(attacker); attack = new Attack(true); attack.Attacker = attacker.UID; attack.Attacked = attacked.UID; attack.AttackType = Network.GamePackets.Attack.Kill; attack.X = attacked.X; attack.Y = attacked.Y; attacked.MonsterInfo.SendScreen(attack); } else { attacked.Hitpoints -= damage; } } else { SpellUse suse = new SpellUse(true); if (attack != null) attack.Effect1 = Attack.AttackEffects1.None; uint damage = Calculate.Magic(attacker, attacked, attacker.MonsterInfo.SpellID, 0, ref attack); if (attack != null) suse.Effect1 = attack.Effect1; suse.Attacker = attacker.UID; suse.SpellID = attacker.MonsterInfo.SpellID; suse.X = attacked.X; suse.Y = attacked.Y; suse.Targets.Add(attacked.UID, damage); attacked.MonsterInfo.SendScreen(suse); if (attacker.Companion) if (damage > attacked.Hitpoints) attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true); else attacker.Owner.IncreaseExperience(damage, true); if (attacked.Hitpoints <= damage) { attacked.Die(attacker); attack = new Attack(true); attack.Attacker = attacker.UID; attack.Attacked = attacked.UID; attack.AttackType = Network.GamePackets.Attack.Kill; attack.X = attacked.X; attack.Y = attacked.Y; attacked.MonsterInfo.SendScreen(attack); } else { attacked.Hitpoints -= damage; } } } } #endregion #region Player -> Player \ Monster \ Sob Npc else { #region Merchant if (attack.AttackType == Attack.MerchantAccept || attack.AttackType == Attack.MerchantRefuse) { attacker.AttackPacket = null; return; } #endregion #region Marriage if (attack.AttackType == Attack.MarriageAccept || attack.AttackType == Attack.MarriageRequest) { if (attack.AttackType == Attack.MarriageRequest) { Client.GameState Spouse = null; uint takeout = attack.Attacked; if (takeout == attacker.UID) takeout = attack.Attacker; if (ServerBase.Kernel.GamePool.TryGetValue(takeout, out Spouse)) { if (attacker.Spouse != "None" || Spouse.Entity.Spouse != "None") { attacker.Owner.Send(new Message("You cannot marry someone that is already married with someone else!", System.Drawing.Color.Black, Message.TopLeft)); } else { uint id1 = attacker.Mesh % 10, id2 = Spouse.Entity.Mesh % 10; if (id1 <= 2 && id2 >= 3 || id1 >= 2 && id2 <= 3) { attack.X = Spouse.Entity.X; attack.Y = Spouse.Entity.Y; Spouse.Send(attack); } else { attacker.Owner.Send(new Message("You cannot marry someone of your gender!", System.Drawing.Color.Black, Message.TopLeft)); } } } } else { Client.GameState Spouse = null; if (ServerBase.Kernel.GamePool.TryGetValue(attack.Attacked, out Spouse)) { if (attacker.Spouse != "None" || Spouse.Entity.Spouse != "None") { attacker.Owner.Send(new Message("You cannot marry someone that is already married with someone else!", System.Drawing.Color.Black, Message.TopLeft)); } else { if (attacker.Mesh % 10 <= 2 && Spouse.Entity.Mesh % 10 >= 3 || attacker.Mesh % 10 >= 3 && Spouse.Entity.Mesh % 10 <= 2) { Spouse.Entity.Spouse = attacker.Name; attacker.Spouse = Spouse.Entity.Name; Message message = null; if (Spouse.Entity.Mesh % 10 >= 3) message = new Message("Joy and happiness! " + Spouse.Entity.Name + " and " + attacker.Name + " have joined together in the holy marriage. We wish them a stone house.", System.Drawing.Color.BurlyWood, Message.Center); else message = new Message("Joy and happiness! " + attacker.Name + " and " + attacker.Spouse + " have joined together in the holy marriage. We wish them a stone house.", System.Drawing.Color.BurlyWood, Message.Center); foreach (Client.GameState client in ServerBase.Kernel.GamePool.Values) { client.Send(message); } Spouse.Entity.Update(_String.Effect, "firework-2love", true); attacker.Update(_String.Effect, "firework-2love", true); } else { attacker.Owner.Send(new Message("You cannot marry someone of your gender!", System.Drawing.Color.Black, Message.TopLeft)); } } } } } #endregion #region Attacking else { attacker.Owner.Attackable = true; Entity attacked = null; SobNpcSpawn attackedsob = null; #region Checks if (attack.Attacker != attacker.UID) return; if (attacker.EntityFlag != EntityFlag.Player) return; attacker.RemoveFlag(Update.Flags.Invisibility); bool pass = false; if (attack.AttackType == Attack.Melee) { if (attacker.OnFatalStrike()) { if (attack.Attacked < 600000) { pass = true; } } } ushort decrease = 0; if (attacker.OnCyclone()) decrease = 1; if (attacker.OnSuperman()) decrease = 300; if (!pass) { int milliSeconds = 1000 - attacker.Agility - decrease; if (milliSeconds < 0 || milliSeconds > 5000) milliSeconds = 0; if (Time32.Now < attacker.AttackStamp.AddMilliseconds(milliSeconds)) return; } if (attacker.Dead) { if (attacker.AttackPacket != null) attacker.AttackPacket = null; return; } attacker.AttackStamp = Time32.Now; if (attacker.Owner.QualifierGroup != null) { if (Time32.Now < attacker.Owner.QualifierGroup.CreateTime.AddSeconds(12)) { return; } } restart: #region Extract attack information ushort SpellID = 0, X = 0, Y = 0; uint Target = 0; if (attack.AttackType == Attack.Magic) { if (!attack.Decoded) { #region GetSkillID SpellID = Convert.ToUInt16(((long)attack.ToArray()[24] & 0xFF) | (((long)attack.ToArray()[25] & 0xFF) << 8)); SpellID ^= (ushort)0x915d; SpellID ^= (ushort)attacker.UID; SpellID = (ushort)(SpellID << 0x3 | SpellID >> 0xd); SpellID -= 0xeb42; #endregion #region GetCoords X = (ushort)((attack.ToArray()[16] & 0xFF) | ((attack.ToArray()[17] & 0xFF) << 8)); X = (ushort)(X ^ (uint)(attacker.UID & 0xffff) ^ 0x2ed6); X = (ushort)(((X << 1) | ((X & 0x8000) >> 15)) & 0xffff); X = (ushort)((X | 0xffff0000) - 0xffff22ee); Y = (ushort)((attack.ToArray()[18] & 0xFF) | ((attack.ToArray()[19] & 0xFF) << 8)); Y = (ushort)(Y ^ (uint)(attacker.UID & 0xffff) ^ 0xb99b); Y = (ushort)(((Y << 5) | ((Y & 0xF800) >> 11)) & 0xffff); Y = (ushort)((Y | 0xffff0000) - 0xffff8922); #endregion #region GetTarget Target = ((uint)attack.ToArray()[12] & 0xFF) | (((uint)attack.ToArray()[13] & 0xFF) << 8) | (((uint)attack.ToArray()[14] & 0xFF) << 16) | (((uint)attack.ToArray()[15] & 0xFF) << 24); Target = ((((Target & 0xffffe000) >> 13) | ((Target & 0x1fff) << 19)) ^ 0x5F2D2463 ^ attacker.UID) - 0x746F4AE6; #endregion attack.X = X; attack.Y = Y; attack.Damage = SpellID; attack.Attacked = Target; attack.Decoded = true; } else { X = attack.X; Y = attack.Y; SpellID = (ushort)attack.Damage; Target = attack.Attacked; } } #endregion #endregion if (attacker.ContainsFlag(Update.Flags.Ride) && attacker.Owner.Equipment.TryGetItem(18) == null) { if (attack.AttackType != Attack.Magic) attacker.RemoveFlag(Update.Flags.Ride); else if (!(SpellID == 7003 || SpellID == 7002)) attacker.RemoveFlag(Update.Flags.Ride); } if (attacker.ContainsFlag(Update.Flags.CastPray)) attacker.RemoveFlag(Update.Flags.CastPray); if (attacker.ContainsFlag(Update.Flags.Praying)) attacker.RemoveFlag(Update.Flags.Praying); #region Dash if (SpellID == 1051) { if (ServerBase.Kernel.GetDistance(attack.X, attack.Y, attacker.X, attacker.Y) > 4) { attacker.Owner.Disconnect(); return; } attacker.X = attack.X; attacker.Y = attack.Y; ushort x = attacker.X, y = attacker.Y; Game.Map.UpdateCoordonatesForAngle(ref x, ref y, (Enums.ConquerAngle)Target); for (int c = 0; c < attacker.Owner.Screen.Objects.Count; c++) { if (c >= attacker.Owner.Screen.Objects.Count) break; //List<IMapObject> list = new List<IMapObject>(); IMapObject obj = attacker.Owner.Screen.Objects[c]; if (obj == null) continue; if (obj.X == x && obj.Y == y && (obj.MapObjType == MapObjectType.Monster || obj.MapObjType == MapObjectType.Player)) { Entity entity = obj as Entity; if (!entity.Dead) { Target = obj.UID; break; } } } } #endregion #region CounterKill if (attack.AttackType == Attack.CounterKillSwitch) { if (attacked != null) if (attacked.ContainsFlag(Update.Flags.Fly)) { attacker.AttackPacket = null; return; } if (attacker != null) if (attacker.ContainsFlag(Update.Flags.Fly)) { attacker.AttackPacket = null; return; } if (attacker.Owner.Spells.ContainsKey(6003)) { if (!attacker.CounterKillSwitch) { if (Time32.Now >= attacker.CounterKillStamp.AddSeconds(30)) { attacker.CounterKillStamp = Time32.Now; attacker.CounterKillSwitch = true; Attack m_attack = new Attack(true); m_attack.Attacked = attacker.UID; m_attack.Attacker = attacker.UID; m_attack.AttackType = Attack.CounterKillSwitch; m_attack.Damage = 1; m_attack.X = attacker.X; m_attack.Y = attacker.Y; m_attack.Send(attacker.Owner); } } else { attacker.CounterKillSwitch = false; Attack m_attack = new Attack(true); m_attack.Attacked = attacker.UID; m_attack.Attacker = attacker.UID; m_attack.AttackType = Attack.CounterKillSwitch; m_attack.Damage = 0; m_attack.X = attacker.X; m_attack.Y = attacker.Y; m_attack.Send(attacker.Owner); } attacker.Owner.IncreaseSpellExperience(100, 6003); attacker.AttackPacket = null; } } #endregion #region Melee else if (attack.AttackType == Attack.Melee) { if (attacker.Owner.Screen.TryGetValue(attack.Attacked, out attacked)) { if (!attacker.Owner.AlternateEquipment) { CheckForExtraWeaponPowers(attacker.Owner, attacked); } else { CheckForExtraWeaponPowers2(attacker.Owner, attacked); } if (!CanAttack(attacker, attacked, null, attack.AttackType == Attack.Melee)) return; pass = false; if (attacker.OnFatalStrike()) { if (attacked.EntityFlag == EntityFlag.Monster) { pass = true; } } ushort range = attacker.AttackRange; if (attacker.Transformed) range = (ushort)attacker.TransformationAttackRange; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= range || pass) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack); attack.Damage = damage; if (attacker.OnFatalStrike()) { if (attacked.EntityFlag == EntityFlag.Monster) { if (!attacker.Owner.AlternateEquipment) { bool can = false; if (!attacker.Owner.Equipment.Free((byte)ConquerItem.RightWeapon)) if (attacker.Owner.Equipment.TryGetItem((byte)ConquerItem.RightWeapon).ID / 1000 == 601) can = true; if (!attacker.Owner.Equipment.Free((byte)ConquerItem.LeftWeapon)) if (attacker.Owner.Equipment.TryGetItem((byte)ConquerItem.LeftWeapon).ID / 1000 == 601) can = true; if (!attacker.Owner.Equipment.Free((byte)ConquerItem.RightWeapon)) if (attacker.Owner.Equipment.TryGetItem((byte)ConquerItem.RightWeapon).ID / 1000 == 511) can = true; if (!attacker.Owner.Equipment.Free((byte)ConquerItem.LeftWeapon)) if (attacker.Owner.Equipment.TryGetItem((byte)ConquerItem.LeftWeapon).ID / 1000 == 511) can = true; if (!can) return; ushort x = attacked.X; ushort y = attacked.Y; Map.UpdateCoordonatesForAngle(ref x, ref y, ServerBase.Kernel.GetAngle(attacked.X, attacked.Y, attacker.X, attacker.Y)); attacker.Shift(x, y); attack.X = x; attack.Y = y; attack.AttackType = Attack.FatalStrike; } else { bool can = false; if (!attacker.Owner.Equipment.Free((byte)ConquerItem.AltRightHand)) if (attacker.Owner.Equipment.TryGetItem((byte)ConquerItem.AltRightHand).ID / 1000 == 601) can = true; if (!attacker.Owner.Equipment.Free((byte)ConquerItem.AltLeftHand)) if (attacker.Owner.Equipment.TryGetItem((byte)ConquerItem.AltLeftHand).ID / 1000 == 601) can = true; if (!attacker.Owner.Equipment.Free((byte)ConquerItem.AltRightHand)) if (attacker.Owner.Equipment.TryGetItem((byte)ConquerItem.AltRightHand).ID / 1000 == 511) can = true; if (!attacker.Owner.Equipment.Free((byte)ConquerItem.AltLeftHand)) if (attacker.Owner.Equipment.TryGetItem((byte)ConquerItem.AltLeftHand).ID / 1000 == 511) can = true; if (!can) return; ushort x = attacked.X; ushort y = attacked.Y; Map.UpdateCoordonatesForAngle(ref x, ref y, ServerBase.Kernel.GetAngle(attacked.X, attacked.Y, attacker.X, attacker.Y)); attacker.Shift(x, y); attack.X = x; attack.Y = y; attack.AttackType = Attack.FatalStrike; } } } //over: if (!attacker.Owner.AlternateEquipment) { if (!attacker.Owner.Equipment.Free((byte)ConquerItem.RightWeapon)) { Interfaces.IConquerItem rightweapon = attacker.Owner.Equipment.TryGetItem((byte)ConquerItem.RightWeapon); ushort wep1subyte = (ushort)(rightweapon.ID / 1000), wep2subyte = 0; bool wep1bs = false, wep2bs = false; /*if (wep1subyte == 421) { wep1bs = true; wep1subyte = 420; } if (wep1subyte == 511) { wep1bs = true; wep1subyte = 601; }*/ ushort wep1spellid = 0, wep2spellid = 0; if (Database.SpellTable.WeaponSpells.ContainsKey(wep1subyte)) { wep1spellid = Database.SpellTable.WeaponSpells[wep1subyte]; } /*if (wep1subyte == 601 || wep1subyte == 511) { if (Database.SpellTable.WeaponSpells.ContainsKey(11230)) { wep1spellid = 11230; } }*/ Database.SpellInformation wep1spell = null, wep2spell = null; bool doWep1Spell = false, doWep2Spell = false; if (attacker.Owner.Spells.ContainsKey(wep1spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep1spellid)) { wep1spell = Database.SpellTable.SpellInformations[wep1spellid][attacker.Owner.Spells[wep1spellid].Level]; if (wep1spell != null) { doWep1Spell = ServerBase.Kernel.Rate(wep1spell.Percent); } } if (!doWep1Spell) { if (!attacker.Owner.Equipment.Free((byte)ConquerItem.LeftWeapon)) { Interfaces.IConquerItem leftweapon = attacker.Owner.Equipment.TryGetItem((byte)ConquerItem.LeftWeapon); wep2subyte = (ushort)(leftweapon.ID / 1000); /* if (wep2subyte == 421) { wep2bs = true; wep2subyte = 420; } if (wep2subyte == 511) { wep2bs = true; wep2subyte=601; }*/ if (wep2subyte == 900 || leftweapon.ID == 1050002) { return; } if (Database.SpellTable.WeaponSpells.ContainsKey(wep2subyte)) { wep2spellid = Database.SpellTable.WeaponSpells[wep2subyte]; } if (attacker.Owner.Spells.ContainsKey(wep2spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep2spellid)) { wep2spell = Database.SpellTable.SpellInformations[wep2spellid][attacker.Owner.Spells[wep2spellid].Level]; if (wep2spell != null) { doWep2Spell = ServerBase.Kernel.Rate(wep2spell.Percent); } } } } if (!attacker.Transformed) { if (doWep1Spell) { attack.AttackType = Attack.Magic; attack.Decoded = true; attack.X = attacked.X; attack.Y = attacked.Y; attack.Attacked = attacked.UID; attack.Damage = wep1spell.ID; goto restart; } if (doWep2Spell) { attack.AttackType = Attack.Magic; attack.Decoded = true; attack.X = attacked.X; attack.Y = attacked.Y; attack.Attacked = attacked.UID; attack.Damage = wep2spell.ID; goto restart; } if (wep1bs) wep1subyte++; if (attacker.EntityFlag == EntityFlag.Player && attacked.EntityFlag != EntityFlag.Player) if (damage > attacked.Hitpoints) { attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked.Hitpoints), wep1subyte); if (wep2subyte != 0) { if (wep2bs) wep2subyte++; attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked.Hitpoints), wep2subyte); } } else { attacker.Owner.IncreaseProficiencyExperience(damage, wep1subyte); if (wep2subyte != 0) { if (wep2bs) wep2subyte++; attacker.Owner.IncreaseProficiencyExperience(damage, wep2subyte); } } } } else { if (!attacker.Transformed) { if (attacker.EntityFlag == EntityFlag.Player && attacked.EntityFlag != EntityFlag.Player) if (damage > attacked.Hitpoints) { attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked.Hitpoints), 0); } else { attacker.Owner.IncreaseProficiencyExperience(damage, 0); } } } } else { if (!attacker.Owner.Equipment.Free((byte)ConquerItem.AltRightHand)) { Interfaces.IConquerItem rightweapon = attacker.Owner.Equipment.TryGetItem((byte)ConquerItem.AltRightHand); ushort wep1subyte = (ushort)(rightweapon.ID / 1000), wep2subyte = 0; bool wep1bs = false, wep2bs = false; /* if (wep1subyte == 421) { wep1bs = true; wep1subyte = 420; } if (wep1subyte == 511) { wep1bs = true; wep1subyte = 601; }*/ ushort wep1spellid = 0, wep2spellid = 0; if (Database.SpellTable.WeaponSpells.ContainsKey(wep1subyte)) { wep1spellid = Database.SpellTable.WeaponSpells[wep1subyte]; } Database.SpellInformation wep1spell = null, wep2spell = null; bool doWep1Spell = false, doWep2Spell = false; if (attacker.Owner.Spells.ContainsKey(wep1spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep1spellid)) { wep1spell = Database.SpellTable.SpellInformations[wep1spellid][attacker.Owner.Spells[wep1spellid].Level]; doWep1Spell = ServerBase.Kernel.Rate(wep1spell.Percent); } if (!doWep1Spell) { if (!attacker.Owner.Equipment.Free((byte)ConquerItem.AltLeftHand)) { Interfaces.IConquerItem leftweapon = attacker.Owner.Equipment.TryGetItem((byte)ConquerItem.AltLeftHand); wep2subyte = (ushort)(leftweapon.ID / 1000); /* if (wep2subyte == 421) { wep2bs = true; wep2subyte = 420; } if (wep2subyte == 511) { wep2bs = true; wep2subyte = 601; }*/ if (wep2subyte == 900 || leftweapon.ID == 1050002) { return; } if (Database.SpellTable.WeaponSpells.ContainsKey(wep2subyte)) { wep2spellid = Database.SpellTable.WeaponSpells[wep2subyte]; } if (attacker.Owner.Spells.ContainsKey(wep2spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep2spellid)) { wep2spell = Database.SpellTable.SpellInformations[wep2spellid][attacker.Owner.Spells[wep2spellid].Level]; doWep2Spell = ServerBase.Kernel.Rate(wep2spell.Percent); } } } if (!attacker.Transformed) { if (doWep1Spell) { attack.AttackType = Attack.Magic; attack.Decoded = true; attack.X = attacked.X; attack.Y = attacked.Y; attack.Attacked = attacked.UID; attack.Damage = wep1spell.ID; goto restart; } if (doWep2Spell) { attack.AttackType = Attack.Magic; attack.Decoded = true; attack.X = attacked.X; attack.Y = attacked.Y; attack.Attacked = attacked.UID; attack.Damage = wep2spell.ID; goto restart; } if (wep1bs) wep1subyte++; if (attacker.EntityFlag == EntityFlag.Player && attacked.EntityFlag != EntityFlag.Player) if (damage > attacked.Hitpoints) { attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked.Hitpoints), wep1subyte); if (wep2subyte != 0) { if (wep2bs) wep2subyte++; attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked.Hitpoints), wep2subyte); } } else { attacker.Owner.IncreaseProficiencyExperience(damage, wep1subyte); if (wep2subyte != 0) { if (wep2bs) wep2subyte++; attacker.Owner.IncreaseProficiencyExperience(damage, wep2subyte); } } } } else { if (!attacker.Transformed) { if (attacker.EntityFlag == EntityFlag.Player && attacked.EntityFlag != EntityFlag.Player) if (damage > attacked.Hitpoints) { attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked.Hitpoints), 0); } else { attacker.Owner.IncreaseProficiencyExperience(damage, 0); } } } } ReceiveAttack(attacker, attacked, attack, damage, null); attack.AttackType = Attack.Melee; } else { attacker.AttackPacket = null; } } else if (attacker.Owner.Screen.TryGetSob(attack.Attacked, out attackedsob)) { // Console.WriteLine("Ss"); if (CanAttack(attacker, attackedsob, null)) { ushort range = attacker.AttackRange; if (attacker.Transformed) range = (ushort)attacker.TransformationAttackRange; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= range) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); if (!attacker.Owner.AlternateEquipment) { if (!attacker.Owner.Equipment.Free((byte)ConquerItem.RightWeapon)) { Interfaces.IConquerItem rightweapon = attacker.Owner.Equipment.TryGetItem((byte)ConquerItem.RightWeapon); ushort wep1subyte = (ushort)(rightweapon.ID / 1000), wep2subyte = 0; bool wep1bs = false, wep2bs = false; /* if (wep1subyte == 421) { wep1bs = true; wep1subyte=420; } if (wep1subyte == 511) { wep1bs = true; wep1subyte=601; }*/ ushort wep1spellid = 0, wep2spellid = 0; if (Database.SpellTable.WeaponSpells.ContainsKey(wep1subyte)) wep1spellid = Database.SpellTable.WeaponSpells[wep1subyte]; Database.SpellInformation wep1spell = null, wep2spell = null; bool doWep1Spell = false, doWep2Spell = false; if (attacker.Owner.Spells.ContainsKey(wep1spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep1spellid)) { wep1spell = Database.SpellTable.SpellInformations[wep1spellid][attacker.Owner.Spells[wep1spellid].Level]; doWep1Spell = ServerBase.Kernel.Rate(wep1spell.Percent); } if (!doWep1Spell) { if (!attacker.Owner.Equipment.Free((byte)ConquerItem.LeftWeapon)) { Interfaces.IConquerItem leftweapon = attacker.Owner.Equipment.TryGetItem((byte)ConquerItem.LeftWeapon); wep2subyte = (ushort)(leftweapon.ID / 1000); /* if (wep2subyte == 421) { wep2bs = true; wep2subyte = 420; } if (wep2subyte == 511) { wep2bs = true; wep2subyte = 601; }*/ if (Database.SpellTable.WeaponSpells.ContainsKey(wep2subyte)) wep2spellid = Database.SpellTable.WeaponSpells[wep2subyte]; if (attacker.Owner.Spells.ContainsKey(wep2spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep2spellid)) { wep2spell = Database.SpellTable.SpellInformations[wep2spellid][attacker.Owner.Spells[wep2spellid].Level]; doWep2Spell = ServerBase.Kernel.Rate(wep2spell.Percent); } } } if (!attacker.Transformed) { if (doWep1Spell) { attack.AttackType = Attack.Magic; attack.Decoded = true; attack.X = attackedsob.X; attack.Y = attackedsob.Y; attack.Attacked = attackedsob.UID; attack.Damage = wep1spell.ID; goto restart; } if (doWep2Spell) { attack.AttackType = Attack.Magic; attack.Decoded = true; attack.X = attackedsob.X; attack.Y = attackedsob.Y; attack.Attacked = attackedsob.UID; attack.Damage = wep2spell.ID; goto restart; } if (attacker.MapID == 1039) { /* if (wep1bs) wep1subyte++;*/ if (attacker.EntityFlag == EntityFlag.Player) if (damage > attackedsob.Hitpoints) { attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attackedsob.Hitpoints), wep1subyte); if (wep2subyte != 0) { /* if (wep2bs) wep2subyte++;*/ attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attackedsob.Hitpoints), wep2subyte); } } else { attacker.Owner.IncreaseProficiencyExperience(damage, wep1subyte); if (wep2subyte != 0) { /*if (wep2bs) wep2subyte++;*/ attacker.Owner.IncreaseProficiencyExperience(damage, wep2subyte); } } } } } } else { if (!attacker.Owner.Equipment.Free((byte)ConquerItem.AltRightHand)) { Interfaces.IConquerItem rightweapon = attacker.Owner.Equipment.TryGetItem((byte)ConquerItem.AltRightHand); ushort wep1subyte = (ushort)(rightweapon.ID / 1000), wep2subyte = 0; bool wep1bs = false, wep2bs = false; /*if (wep1subyte == 421) { wep1bs = true; wep1subyte = 420; } if (wep1subyte == 511) { wep1bs = true; wep1subyte = 601; }*/ ushort wep1spellid = 0, wep2spellid = 0; if (Database.SpellTable.WeaponSpells.ContainsKey(wep1subyte)) wep1spellid = Database.SpellTable.WeaponSpells[wep1subyte]; Database.SpellInformation wep1spell = null, wep2spell = null; bool doWep1Spell = false, doWep2Spell = false; if (attacker.Owner.Spells.ContainsKey(wep1spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep1spellid)) { wep1spell = Database.SpellTable.SpellInformations[wep1spellid][attacker.Owner.Spells[wep1spellid].Level]; doWep1Spell = ServerBase.Kernel.Rate(wep1spell.Percent); } if (!doWep1Spell) { if (!attacker.Owner.Equipment.Free((byte)ConquerItem.AltLeftHand)) { Interfaces.IConquerItem leftweapon = attacker.Owner.Equipment.TryGetItem((byte)ConquerItem.AltLeftHand); wep2subyte = (ushort)(leftweapon.ID / 1000); /* if (wep2subyte == 421) { wep2bs = true; wep2subyte = 420; } if (wep2subyte == 511) { wep2bs = true; wep2subyte = 601; }*/ if (Database.SpellTable.WeaponSpells.ContainsKey(wep2subyte)) wep2spellid = Database.SpellTable.WeaponSpells[wep2subyte]; if (attacker.Owner.Spells.ContainsKey(wep2spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep2spellid)) { wep2spell = Database.SpellTable.SpellInformations[wep2spellid][attacker.Owner.Spells[wep2spellid].Level]; doWep2Spell = ServerBase.Kernel.Rate(wep2spell.Percent); } } } if (!attacker.Transformed) { if (doWep1Spell) { attack.AttackType = Attack.Magic; attack.Decoded = true; attack.X = attackedsob.X; attack.Y = attackedsob.Y; attack.Attacked = attackedsob.UID; attack.Damage = wep1spell.ID; goto restart; } if (doWep2Spell) { attack.AttackType = Attack.Magic; attack.Decoded = true; attack.X = attackedsob.X; attack.Y = attackedsob.Y; attack.Attacked = attackedsob.UID; attack.Damage = wep2spell.ID; goto restart; } if (attacker.MapID == 1039) { if (wep1bs) wep1subyte++; if (attacker.EntityFlag == EntityFlag.Player) if (damage > attackedsob.Hitpoints) { attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attackedsob.Hitpoints), wep1subyte); if (wep2subyte != 0) { if (wep2bs) wep2subyte++; attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attackedsob.Hitpoints), wep2subyte); } } else { attacker.Owner.IncreaseProficiencyExperience(damage, wep1subyte); if (wep2subyte != 0) { if (wep2bs) wep2subyte++; attacker.Owner.IncreaseProficiencyExperience(damage, wep2subyte); } } } } } } attack.Damage = damage; ReceiveAttack(attacker, attackedsob, attack, damage, null); } else { attacker.AttackPacket = null; } } } else { attacker.AttackPacket = null; } } #endregion #region Ranged else if (attack.AttackType == Attack.Ranged) { if (attacker.Owner.Screen.TryGetValue(attack.Attacked, out attacked)) { if (!attacker.Owner.AlternateEquipment) { CheckForExtraWeaponPowers(attacker.Owner, attacked); } else { CheckForExtraWeaponPowers2(attacker.Owner, attacked); } if (attacker.Owner.Equipment.TryGetItem(ConquerItem.LeftWeapon) == null) return; if (!CanAttack(attacker, attacked, null, attack.AttackType == Attack.Melee)) return; if (!attacker.Owner.AlternateEquipment) { if (!attacker.Owner.Equipment.Free((byte)ConquerItem.LeftWeapon)) { Interfaces.IConquerItem arrow = attacker.Owner.Equipment.TryGetItem(ConquerItem.LeftWeapon); arrow.Durability -= 1; ItemUsage usage = new ItemUsage(true) { UID = arrow.UID, dwParam = arrow.Durability, ID = ItemUsage.UpdateDurability }; usage.Send(attacker.Owner); if (arrow.Durability <= 0 || arrow.Durability > 5000) { Network.PacketHandler.ReloadArrows(attacker.Owner.Equipment.TryGetItem(ConquerItem.LeftWeapon), attacker.Owner); } } } else { if (!attacker.Owner.Equipment.Free((byte)ConquerItem.AltLeftHand)) { Interfaces.IConquerItem arrow = attacker.Owner.Equipment.TryGetItem(ConquerItem.AltLeftHand); arrow.Durability -= 1; ItemUsage usage = new ItemUsage(true) { UID = arrow.UID, dwParam = arrow.Durability, ID = ItemUsage.UpdateDurability }; usage.Send(attacker.Owner); if (arrow.Durability <= 0 || arrow.Durability > 5000) { Network.PacketHandler.ReloadArrows(attacker.Owner.Equipment.TryGetItem(ConquerItem.AltLeftHand), attacker.Owner); } } } if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= ServerBase.Constants.pScreenDistance) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Ranged(attacker, attacked, ref attack); attack.Damage = damage; if (attacker.EntityFlag == EntityFlag.Player && attacked.EntityFlag != EntityFlag.Player) if (damage > attacked.Hitpoints) { attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked.Hitpoints), 500); } else { attacker.Owner.IncreaseProficiencyExperience(damage, 500); } ReceiveAttack(attacker, attacked, attack, damage, null); } } else if (attacker.Owner.Screen.TryGetSob(attack.Attacked, out attackedsob)) { if (CanAttack(attacker, attackedsob, null)) { if (attacker.Owner.Equipment.TryGetItem(ConquerItem.LeftWeapon) == null) return; if (attacker.MapID != 1039) { if (!attacker.Owner.AlternateEquipment) { if (!attacker.Owner.Equipment.Free((byte)ConquerItem.LeftWeapon)) { Interfaces.IConquerItem arrow = attacker.Owner.Equipment.TryGetItem(ConquerItem.LeftWeapon); arrow.Durability -= 1; ItemUsage usage = new ItemUsage(true) { UID = arrow.UID, dwParam = arrow.Durability, ID = ItemUsage.UpdateDurability }; usage.Send(attacker.Owner); if (arrow.Durability <= 0 || arrow.Durability > 5000) { Network.PacketHandler.ReloadArrows(attacker.Owner.Equipment.TryGetItem(ConquerItem.LeftWeapon), attacker.Owner); } } } else { if (!attacker.Owner.Equipment.Free((byte)ConquerItem.AltLeftHand)) { Interfaces.IConquerItem arrow = attacker.Owner.Equipment.TryGetItem(ConquerItem.AltLeftHand); arrow.Durability -= 1; ItemUsage usage = new ItemUsage(true) { UID = arrow.UID, dwParam = arrow.Durability, ID = ItemUsage.UpdateDurability }; usage.Send(attacker.Owner); if (arrow.Durability <= 0 || arrow.Durability > 5000) { Network.PacketHandler.ReloadArrows(attacker.Owner.Equipment.TryGetItem(ConquerItem.AltLeftHand), attacker.Owner); } } } } if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= ServerBase.Constants.pScreenDistance) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack); attack.Damage = damage; ReceiveAttack(attacker, attackedsob, attack, damage, null); if (damage > attackedsob.Hitpoints) { attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attackedsob.Hitpoints), 500); } else { attacker.Owner.IncreaseProficiencyExperience(damage, 500); } } } } else { attacker.AttackPacket = null; } } #endregion #region Magic else if (attack.AttackType == Attack.Magic) { if (!attacker.Owner.AlternateEquipment) { CheckForExtraWeaponPowers(attacker.Owner, attacked); } else { CheckForExtraWeaponPowers2(attacker.Owner, attacked); } uint Experience = 100; bool shuriken = false; ushort spellID = SpellID; if (SpellID >= 3090 && SpellID <= 3306) spellID = 3090; if (spellID == 6012) shuriken = true; if (attacker == null) return; if (attacker.Owner == null) { attacker.AttackPacket = null; return; } if (attacker.Owner.Spells == null) { attacker.Owner.Spells = new SafeDictionary<ushort, PhoenixProject.Interfaces.ISkill>(10000); attacker.AttackPacket = null; return; } if (attacker.Owner.Spells[spellID] == null && spellID != 6012) { attacker.AttackPacket = null; return; } Database.SpellInformation spell = null; if (shuriken) spell = Database.SpellTable.SpellInformations[6010][0]; else { byte choselevel = 0; if (spellID == SpellID) choselevel = attacker.Owner.Spells[spellID].Level; if (Database.SpellTable.SpellInformations[SpellID] != null && !Database.SpellTable.SpellInformations[SpellID].ContainsKey(choselevel)) choselevel = (byte)(Database.SpellTable.SpellInformations[SpellID].Count - 1); spell = Database.SpellTable.SpellInformations[SpellID][choselevel]; } if (spell == null) { attacker.AttackPacket = null; return; } attacked = null; attackedsob = null; if (attacker.Owner.Screen.TryGetValue(Target, out attacked) || attacker.Owner.Screen.TryGetSob(Target, out attackedsob) || Target == attacker.UID || spell.Sort != 1) { if (Target == attacker.UID) attacked = attacker; if (attacked != null) { if (attacked.Dead && spell.Sort != Database.SpellSort.Revive && spell.ID != 10405 && spell.ID != 10425) { attacker.AttackPacket = null; return; } } if (Target >= 400000 && Target <= 600000 || Target >= 800000) { if (attacked == null && attackedsob == null) return; } else if (Target != 0 && attackedsob == null) return; if (attacked != null) { if (attacked.EntityFlag == EntityFlag.Monster) { if (spell.CanKill == 1) { if (attacked.MonsterInfo.InSight == 0) { attacked.MonsterInfo.InSight = attacker.UID; } } } } if (!attacker.Owner.Spells.ContainsKey(spellID)) { if (spellID != 6012) return; } if (spell != null) { if (!attacker.Owner.AlternateEquipment) { if (spell.OnlyWithThisWeaponSubtype != 0) { uint firstwepsubtype, secondwepsubtype; if (!attacker.Owner.Equipment.Free(4)) { firstwepsubtype = attacker.Owner.Equipment.Objects[3].ID / 1000; if (!attacker.Owner.Equipment.Free(5) && attacker.Owner.Equipment.Objects[4] != null) { secondwepsubtype = attacker.Owner.Equipment.Objects[4].ID / 1000; if (firstwepsubtype != spell.OnlyWithThisWeaponSubtype) { if (secondwepsubtype != spell.OnlyWithThisWeaponSubtype) { attacker.AttackPacket = null; return; } } } else { if (firstwepsubtype != spell.OnlyWithThisWeaponSubtype) { attacker.AttackPacket = null; return; } } } else { attacker.AttackPacket = null; return; } } else { if (spell.OnlyWithThisWeaponSubtype != 0) { uint firstwepsubtype, secondwepsubtype; if (!attacker.Owner.Equipment.Free(24)) { firstwepsubtype = attacker.Owner.Equipment.Objects[23].ID / 1000; if (!attacker.Owner.Equipment.Free(24) && attacker.Owner.Equipment.Objects[24] != null) { secondwepsubtype = attacker.Owner.Equipment.Objects[24].ID / 1000; if (firstwepsubtype != spell.OnlyWithThisWeaponSubtype) { if (secondwepsubtype != spell.OnlyWithThisWeaponSubtype) { attacker.AttackPacket = null; return; } } } else { if (firstwepsubtype != spell.OnlyWithThisWeaponSubtype) { attacker.AttackPacket = null; return; } } } else { attacker.AttackPacket = null; return; } } } } if (attacker.Owner.Account.State == PhoenixProject.Database.AccountTable.AccountState.Coder) { attacker.Owner.Send(new Message("Spell ID: " + spellID, System.Drawing.Color.CadetBlue, Message.Talk)); } switch (spellID) { #region Single magic damage spells case 1000: case 1001: case 1002: case 1150: case 1160: case 1180: case 1320: case 10310: case 11180: //case 11040: //case 10381: { if (CanUseSpell(spell, attacker.Owner)) { if (attacked != null) { if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance) { SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { PrepareSpell(spell, attacker.Owner); attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack); suse.Effect1 = attack.Effect1; ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); if (attacked.EntityFlag == EntityFlag.Player) attacked.Owner.SendScreen(suse, true); else attacked.MonsterInfo.SendScreen(suse); } } else { attacker.AttackPacket = null; } } else { if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Distance) { SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (CanAttack(attacker, attackedsob, spell)) { PrepareSpell(spell, attacker.Owner); attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Magic(attacker, attackedsob, spell, ref attack); suse.Effect1 = attack.Effect1; ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); attacker.Owner.SendScreen(suse, true); } } } } else { attacker.AttackPacket = null; } break; } #endregion #region Single heal/meditation spells case 1190: case 1195: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; uint damage = spell.Power; if (spell.ID == 1190) { Experience = damage = Math.Min(damage, attacker.MaxHitpoints - attacker.Hitpoints); attacker.Hitpoints += damage; } else { Experience = damage = Math.Min(damage, (uint)(attacker.MaxMana - attacker.Mana)); attacker.Mana += (ushort)damage; } suse.Targets.Add(attacker.UID, spell.Power); attacker.Owner.SendScreen(suse, true); } break; } #endregion #region Multi heal spells case 1005: case 1055: case 1170: case 1175: { if (CanUseSpell(spell, attacker.Owner)) { SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (attackedsob != null) { if (attacker.MapID == 1038) break; if (attacker.MapID == 2071) break; if (attacker.MapID == 1509) break; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Distance) { PrepareSpell(spell, attacker.Owner); uint damage = spell.Power; damage = Math.Min(damage, attackedsob.MaxHitpoints - attackedsob.Hitpoints); attackedsob.Hitpoints += damage; Experience += damage; suse.Targets.Add(attackedsob.UID, damage); attacker.Owner.SendScreen(suse, true); } } else { if (spell.Multi == 1) { if (attacker.Owner.Team != null) { PrepareSpell(spell, attacker.Owner); foreach (Client.GameState teammate in attacker.Owner.Team.Teammates) { if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, teammate.Entity.X, teammate.Entity.Y) <= spell.Distance) { uint damage = spell.Power; damage = Math.Min(damage, teammate.Entity.MaxHitpoints - teammate.Entity.Hitpoints); teammate.Entity.Hitpoints += damage; Experience += damage; suse.Targets.Add(teammate.Entity.UID, damage); if (spell.NextSpellID != 0) { attack.Damage = spell.NextSpellID; attacker.AttackPacket = attack; } else { attacker.AttackPacket = null; } } } if (attacked.EntityFlag == EntityFlag.Player) attacked.Owner.SendScreen(suse, true); else attacked.MonsterInfo.SendScreen(suse); } else { if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance) { PrepareSpell(spell, attacker.Owner); uint damage = spell.Power; damage = Math.Min(damage, attacked.MaxHitpoints - attacked.Hitpoints); attacked.Hitpoints += damage; Experience += damage; suse.Targets.Add(attacked.UID, damage); if (spell.NextSpellID != 0) { attack.Damage = spell.NextSpellID; attacker.AttackPacket = attack; } else { attacker.AttackPacket = null; } if (attacked.EntityFlag == EntityFlag.Player) attacked.Owner.SendScreen(suse, true); else attacked.MonsterInfo.SendScreen(suse); } else { attacker.AttackPacket = null; } } } else { if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance) { PrepareSpell(spell, attacker.Owner); uint damage = spell.Power; damage = Math.Min(damage, attacked.MaxHitpoints - attacked.Hitpoints); attacked.Hitpoints += damage; Experience += damage; suse.Targets.Add(attacked.UID, damage); if (spell.NextSpellID != 0) { attack.Damage = spell.NextSpellID; attacker.AttackPacket = attack; } else { attacker.AttackPacket = null; } if (attacked.EntityFlag == EntityFlag.Player) attacked.Owner.SendScreen(suse, true); else attacked.MonsterInfo.SendScreen(suse); } else { attacker.AttackPacket = null; } } } } else { attacker.AttackPacket = null; } break; } #endregion #region Revive case 1050: case 1100: { if (attackedsob != null) return; if (ServerBase.Constants.revnomap.Contains(attacker.MapID)) return; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance) { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; //suse.Targets.Add(attacked.UID, 0); //attacked.Action = PhoenixProject.Game.Enums.ConquerAction.None; //attacked.Owner.ReviveStamp = Time32.Now; //attacked.Owner.Attackable = false; attacked.Owner.Entity.Action = PhoenixProject.Game.Enums.ConquerAction.None; attacked.Owner.ReviveStamp = Time32.Now; attacked.Owner.Attackable = false; attacked.Owner.Entity.TransformationID = 0; attacked.Owner.Entity.RemoveFlag(Update.Flags.Dead); attacked.Owner.Entity.RemoveFlag(Update.Flags.Ghost); attacked.Owner.Entity.Hitpoints = attacked.Owner.Entity.MaxHitpoints; attacked.Ressurect(); attacked.Owner.SendScreen(suse, true); } } break; } #endregion #region Linear spells case 1045: case 1046: // case 11110: case 1260: case 11000: case 11005: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); Game.Attacking.InLineAlgorithm ila = new PhoenixProject.Game.Attacking.InLineAlgorithm(attacker.X, X, attacker.Y, Y, (byte)spell.Range, InLineAlgorithm.Algorithm.DDA); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = SpellID; suse.SpellLevel = attacker.Owner.Spells[SpellID].Level; suse.X = X; suse.Y = Y; int xx = 0; int yy = 0; foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects) { if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (ila.InLine(attacked.X, attacked.Y)) { if (attacked.X != xx && attacked.Y != yy) { if (!CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) continue; attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack); suse.Effect1 = attack.Effect1; attack.Damage = damage; xx = attacked.X; yy = attacked.Y; ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); } } } else if (_obj.MapObjType == MapObjectType.SobNpc) { attackedsob = _obj as SobNpcSpawn; if (ila.InLine(attackedsob.X, attackedsob.Y)) { if (!CanAttack(attacker, attackedsob, spell)) continue; attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); damage = (uint)(damage * spell.PowerPercent); attack.Damage = damage; ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); } } } attacker.Owner.SendScreen(suse, true); } break; } #endregion #region BladeTempst case 11110: { bool yes = true; Game.Map Map = attacker.Owner.Map; // ushort rr = ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y); Game.Attacking.InLineAlgorithm ila = new PhoenixProject.Game.Attacking.InLineAlgorithm(attacker.X, X, attacker.Y, Y, (byte)ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y), InLineAlgorithm.Algorithm.DDA); List<InLineAlgorithm.coords>.Enumerator enumerator6; ushort x = 0; ushort y = 0; using (enumerator6 = ila.getCoords.GetEnumerator()) { while (enumerator6.MoveNext()) { if (yes) { Func<IMapObject, bool> func4 = null; InLineAlgorithm.coords coord = enumerator6.Current; if (Map.Floor[coord.X, coord.Y, Game.MapObjectType.Player, null]) { if (attacker.MapID == 1038) { if (attacker.X > 223 && attacker.Y < 185 && coord.X < 224) { // Console.WriteLine(" r " + PhoenixProject.Game.ConquerStructures.Society.GuildWar.RightGate.Mesh + ""); if (PhoenixProject.Game.ConquerStructures.Society.GuildWar.RightGate.Mesh == 271) { yes = false; } else { yes = true; x = (ushort)coord.X; y = (ushort)coord.Y; foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects) { if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (ServerBase.Kernel.GetDistance((ushort)coord.X, (ushort)coord.Y, attacked.X, attacked.Y) <= 1) { attacked.CanBlade = true; } } } } } else { //Console.WriteLine(" r " + PhoenixProject.Game.ConquerStructures.Society.GuildWar.LeftGate.Mesh + ""); if (attacker.X < 170 && attacker.Y > 210 && coord.Y < 211) { if (PhoenixProject.Game.ConquerStructures.Society.GuildWar.LeftGate.Mesh == 241) { yes = false; } } else { yes = true; x = (ushort)coord.X; y = (ushort)coord.Y; foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects) { if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (ServerBase.Kernel.GetDistance((ushort)coord.X, (ushort)coord.Y, attacked.X, attacked.Y) <= 1) { attacked.CanBlade = true; } } } } } } else { yes = true; x = (ushort)coord.X; y = (ushort)coord.Y; foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects) { if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (ServerBase.Kernel.GetDistance((ushort)coord.X, (ushort)coord.Y, attacked.X, attacked.Y) <= 1) { attacked.CanBlade = true; } } } } } else { yes = false; } } } } yes = true; X = x; Y = y; if (Map.Floor[X, Y, Game.MapObjectType.Player, null] && yes) { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = SpellID; suse.SpellLevel = attacker.Owner.Spells[SpellID].Level; suse.X = X; suse.Y = Y; int xx = 0; int yy = 0; foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects) { if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (attacked.CanBlade) { // if (attacked.X != xx && attacked.Y != yy) // { if (!CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) continue; attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack); // uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack); suse.Effect1 = attack.Effect1; attack.Damage = damage; // xx = attacked.X; // yy = attacked.Y; ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); attacked.CanBlade = false; if (!attacked.Dead) { if (attacker.Owner.Spells.ContainsKey(11120)) { BlackSpot spot = new BlackSpot { Remove = 0, Identifier = attacked.UID }; attacker.Owner.Send((byte[])spot); attacked.BlackSpotTime = Time32.Now; attacked.BlackSpotTime2 = 8; attacked.BlackSpots = true; attacker.Owner.IncreaseSpellExperience(80, 11120); } } // } } } else if (_obj.MapObjType == MapObjectType.SobNpc) { attackedsob = _obj as SobNpcSpawn; if (ila.InLine(attackedsob.X, attackedsob.Y)) { if (!CanAttack(attacker, attackedsob, spell)) continue; attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); damage = (uint)(damage * spell.PowerPercent); attack.Damage = damage; ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); } } } attacker.X = X; attacker.Y = Y; attacker.Owner.SendScreen(attack, true); attacker.Owner.SendScreen(suse, true); attacker.Owner.Screen.Reload(attack); } } break; } #endregion #region XPSpells inofensive case 1015: case 1020: case 1025: case 1110: case 6011: case 10390: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; suse.Targets.Add(attacked.UID, 0); if (spell.ID == 6011) { attacker.FatalStrikeStamp = Time32.Now; attacker.FatalStrikeTime = 60; attacker.AddFlag(Update.Flags.FatalStrike); attacker.RemoveFlag(Update.Flags.Ride); } else { if (spell.ID == 1110 || spell.ID == 1025 || spell.ID == 10390) { if (!attacked.OnKOSpell()) attacked.KOCount = 0; attacked.KOSpell = spell.ID; if (spell.ID == 1110) { attacked.CycloneStamp = Time32.Now; attacked.CycloneTime = 20; attacked.AddFlag(Update.Flags.Cyclone); } else if (spell.ID == 10390) { attacked.OblivionStamp = Time32.Now; attacked.OblivionTime = 20; attacked.AddFlag2(Update.Flags2.Oblivion); } else { attacked.SupermanStamp = Time32.Now; attacked.SupermanTime = 20; attacked.AddFlag(Update.Flags.Superman); } } else { if (spell.ID == 1020) { attacked.ShieldTime = 0; attacked.ShieldStamp = Time32.Now; attacked.MagicShieldStamp = Time32.Now; attacked.MagicShieldTime = 0; attacked.AddFlag(Update.Flags.MagicShield); attacked.ShieldStamp = Time32.Now; attacked.ShieldIncrease = spell.PowerPercent; attacked.ShieldTime = (byte)spell.Duration; } else { attacked.AccuracyStamp = Time32.Now; attacked.StarOfAccuracyStamp = Time32.Now; attacked.StarOfAccuracyTime = 0; attacked.AccuracyTime = 0; attacked.AddFlag(Update.Flags.StarOfAccuracy); attacked.AccuracyStamp = Time32.Now; attacked.AccuracyTime = (byte)spell.Duration; } } } attacked.Owner.SendScreen(suse, true); } break; } #endregion #region Circle spells case 1010: case 1115: case 1120: case 1125: case 3090: case 5001: case 8030: case 11170: case 10315: case 11190: //case 11050: { // Console.WriteLine("xx3"); if (CanUseSpell(spell, attacker.Owner)) { //Console.WriteLine("x4"); PrepareSpell(spell, attacker.Owner); //Console.WriteLine("xx5"); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; UInt16 ox, oy; ox = attacker.X; oy = attacker.Y; if (spellID == 10315 || spellID == 11190) { /* if (attacker.MapID == 1950) { break; }*/ bool yes = true; Game.Map Map = attacker.Owner.Map; Game.Attacking.InLineAlgorithm ila = new PhoenixProject.Game.Attacking.InLineAlgorithm(attacker.X, X, attacker.Y, Y, (byte)spell.Range, InLineAlgorithm.Algorithm.DDA); List<InLineAlgorithm.coords>.Enumerator enumerator6; ushort x = 0; ushort y = 0; using (enumerator6 = ila.getCoords.GetEnumerator()) { while (enumerator6.MoveNext()) { if (yes) { Func<IMapObject, bool> func4 = null; InLineAlgorithm.coords coord = enumerator6.Current; if (Map.Floor[coord.X, coord.Y, Game.MapObjectType.Player, null]) { if (attacker.MapID == 1038) { if (attacker.X > 223 && attacker.Y < 185 && coord.X < 224) { // Console.WriteLine(" r " + PhoenixProject.Game.ConquerStructures.Society.GuildWar.RightGate.Mesh + ""); if (PhoenixProject.Game.ConquerStructures.Society.GuildWar.RightGate.Mesh == 271) { yes = false; } else { yes = true; x = (ushort)coord.X; y = (ushort)coord.Y; } } else { //Console.WriteLine(" r " + PhoenixProject.Game.ConquerStructures.Society.GuildWar.LeftGate.Mesh + ""); if (attacker.X < 170 && attacker.Y > 210 && coord.Y < 211) { if (PhoenixProject.Game.ConquerStructures.Society.GuildWar.LeftGate.Mesh == 241) { yes = false; } } else { yes = true; x = (ushort)coord.X; y = (ushort)coord.Y; } } } else { yes = true; x = (ushort)coord.X; y = (ushort)coord.Y; } } else { yes = false; } } } } yes = true; X = x; Y = y; Attack npacket = new Attack(true); npacket.Attacker = attacker.UID; npacket.AttackType = 53; npacket.X = X; npacket.Y = Y; Writer.WriteUInt16(spell.ID, 24, npacket.ToArray()); Writer.WriteByte(spell.Level, 26, npacket.ToArray()); attacker.Owner.SendScreen(npacket, true); attacker.X = X; attacker.Y = Y; attacker.SendSpawn(attacker.Owner); attacker.Owner.Screen.Reload(npacket); } List<IMapObject> objects = new List<IMapObject>(); if (attacker.Owner.Screen.Objects.Count() > 0) objects = GetObjects(ox, oy, attacker.Owner); if (objects != null) { if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range) { if (spellID == 10315 || spellID == 11190) { foreach (IMapObject objs in objects.ToArray()) { if (objs == null) continue; if (objs.MapObjType == MapObjectType.Monster || objs.MapObjType == MapObjectType.Player) { attacked = objs as Entity; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack); suse.Effect1 = attack.Effect1; if (spell.Power > 0) { attack.Effect1 = Attack.AttackEffects1.None; damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack); //damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack); suse.Effect1 = attack.Effect1; } if (spell.ID == 8030) { attack.Effect1 = Attack.AttackEffects1.None; damage = Game.Attacking.Calculate.Ranged(attacker, attacked, ref attack); } ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); } } } else if (objs.MapObjType == MapObjectType.SobNpc) { attackedsob = objs as SobNpcSpawn; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range) { if (CanAttack(attacker, attackedsob, spell)) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); if (spell.Power > 0) { damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack); // damage = Game.Attacking.Calculate.Magic(attacker, attackedsob, spell, ref attack); } attack.Effect1 = Attack.AttackEffects1.None; if (spell.ID == 8030) damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack); suse.Effect1 = attack.Effect1; ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); } } } } } else { foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects) { if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack); suse.Effect1 = attack.Effect1; if (spell.Power > 0) { attack.Effect1 = Attack.AttackEffects1.None; damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack); suse.Effect1 = attack.Effect1; } attack.Effect1 = Attack.AttackEffects1.None; if (spell.ID == 8030) damage = Game.Attacking.Calculate.Ranged(attacker, attacked, ref attack); if (spell.ID == 1115) damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack); ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); } } } else if (_obj.MapObjType == MapObjectType.SobNpc) { attackedsob = _obj as SobNpcSpawn; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range) { if (CanAttack(attacker, attackedsob, spell)) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); if (spell.Power > 0) damage = Game.Attacking.Calculate.Magic(attacker, attackedsob, spell, ref attack); attack.Effect1 = Attack.AttackEffects1.None; if (spell.ID == 8030) damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack); suse.Effect1 = attack.Effect1; ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); } } } } } } else { attacker.AttackPacket = null; } } attacker.Owner.SendScreen(suse, true); } break; } #endregion #region Buffers case 1075: case 1085: case 1090: case 1095: case 3080: case 10405://this is not what I edited yesterday... case 30000: case 11160: case 11200: { if (attackedsob != null) { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; suse.Targets.Add(attackedsob.UID, 0); attacker.Owner.SendScreen(suse, true); } } else { if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance) { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; suse.Targets.Add(attacked.UID, 0); if (spell.ID == 1075 || spell.ID == 1085) { if (spell.ID == 1075) { attacked.AddFlag(Update.Flags.Invisibility); attacked.InvisibilityStamp = Time32.Now; attacked.InvisibilityTime = (byte)spell.Duration; if (attacked.EntityFlag == EntityFlag.Player) attacked.Owner.Send(ServerBase.Constants.Invisibility((int)spell.Duration)); } else { attacked.AccuracyStamp = Time32.Now; attacked.StarOfAccuracyStamp = Time32.Now; attacked.StarOfAccuracyTime = 0; attacked.AccuracyTime = 0; attacked.AddFlag(Update.Flags.StarOfAccuracy); attacked.StarOfAccuracyStamp = Time32.Now; attacked.StarOfAccuracyTime = (byte)spell.Duration; if (attacked.EntityFlag == EntityFlag.Player) attacked.Owner.Send(ServerBase.Constants.Accuracy((int)spell.Duration)); } } else { if (spell.ID == 1090) { attacked.ShieldTime = 0; attacked.ShieldStamp = Time32.Now; attacked.MagicShieldStamp = Time32.Now; attacked.MagicShieldTime = 0; attacked.AddFlag(Update.Flags.MagicShield); attacked.MagicShieldStamp = Time32.Now; attacked.MagicShieldIncrease = spell.PowerPercent; attacked.MagicShieldTime = (byte)spell.Duration; if (attacked.EntityFlag == EntityFlag.Player) attacked.Owner.Send(ServerBase.Constants.Shield(spell.PowerPercent, (int)spell.Duration)); } else if (spell.ID == 1095) { attacked.AddFlag(Update.Flags.Stigma); attacked.StigmaStamp = Time32.Now; attacked.StigmaIncrease = spell.PowerPercent; attacked.StigmaTime = (byte)spell.Duration; if (attacked.EntityFlag == EntityFlag.Player) attacked.Owner.Send(ServerBase.Constants.Stigma(spell.PowerPercent, (int)spell.Duration)); } else if (spell.ID == 11200) { if (attacker.ContainsFlag(Update.Flags.Ride)) { attacker.RemoveFlag(Update.Flags.Ride); } attacker.AddFlag3(Update.Flags3.MagicDefender); attacker.MagicDefenderStamp = Time32.Now; attacker.MagicDefenderIncrease = spell.PowerPercent; attacker.MagicDefenderTime = (byte)spell.Duration; if (attacker.EntityFlag == EntityFlag.Player) { attacker.Owner.SendScreen(suse, true); SyncPacket packet = new SyncPacket { Identifier = attacker.UID, Count = 2, Type = PhoenixProject.Network.GamePackets.SyncPacket.SyncType.StatusFlag, StatusFlag1 = (ulong)attacker.StatusFlag, StatusFlag2 = (ulong)attacker.StatusFlag2, Unknown1 = 0x31, StatusFlagOffset = 0x80, Time = (uint)spell.Duration, Value = 10, Level = spell.Level }; attacker.Owner.Send((byte[])packet); } break; } else if (spell.ID == 11160) { if (attacker.DefensiveStanceTime != 0) { attacker.DefensiveStanceTime = 0; attacker.DefensiveStanceIncrease = 0; attacker.RemoveFlag2(Network.GamePackets.Update.Flags2.WarriorWalk); } else { if (attacker.ContainsFlag(Update.Flags.Ride)) { attacker.RemoveFlag(Update.Flags.Ride); } attacker.AddFlag2(Update.Flags2.WarriorWalk); attacker.DefensiveStanceStamp = Time32.Now; attacker.DefensiveStanceIncrease = spell.PowerPercent; attacker.DefensiveStanceTime = (byte)spell.Duration; if (attacker.EntityFlag == EntityFlag.Player) { attacker.Owner.Send(ServerBase.Constants.DefensiveStance(spell.Percent, (int)spell.Duration)); attacker.Owner.SendScreen(suse, true); } } break; } else if (spell.ID == 30000) { if (attacked.ContainsFlag2(Update.Flags2.AzureShield)) { return; } //attack.AttackType = Attack.kimo2; attacked.ShieldTime = 0; attacked.ShieldStamp = Time32.Now; attacked.MagicShieldStamp = Time32.Now; attacked.MagicShieldTime = 0; //Console.WriteLine("The Dodge is :" + attacked.Dodge.ToString()); attacked.AddFlag2(Update.Flags2.AzureShield); attacked.MagicShieldStamp = Time32.Now; attacked.AzureDamage = 12000; //Console.WriteLine("AzureShiled granted " + 12000 + " The Dodge is :" + attacked.Dodge.ToString()); attacked.MagicShieldIncrease = spell.PowerPercent; attacked.MagicShieldTime = 60; if (attacked.EntityFlag == EntityFlag.Player) { attacked.Owner.Send(ServerBase.Constants.AzureShield(12000, 30)); SyncPacket packet4 = new SyncPacket { Identifier = attacked.UID, Count = 2, Type = PhoenixProject.Network.GamePackets.SyncPacket.SyncType.StatusFlag, StatusFlag1 = (ulong)attacked.StatusFlag, StatusFlag2 = (ulong)attacked.StatusFlag2, Unknown1 = 0x31, StatusFlagOffset = 0x5d, Time = (uint)60, Value = (uint)attacked.AzureDamage, Level = spell.Level }; attacked.Owner.Send((byte[])packet4); } } if (spell.ID == 10405 && attacked.Dead) { if ((attacked.BattlePower - attacker.BattlePower) >= 10) return; attacked.AddFlag(Update.Flags.Dead);//Flag them as dead... should not be needed. This is no movement attacked.ShackleStamp = Time32.Now;//Set stamp so source can remove the flag after X seconds attacked.ShackleTime = (short)(30 + 15 * spell.Level);//double checking here. Could be db has this wrong. if (attacked.EntityFlag == EntityFlag.Player) { attacked.Owner.Send(ServerBase.Constants.Shackled(attacked.ShackleTime)); attacked.AddFlag2(Update.Flags2.SoulShackle);//Give them shackeld effect SyncPacket packet3 = new SyncPacket { Identifier = attacked.UID, Count = 2, Type = PhoenixProject.Network.GamePackets.SyncPacket.SyncType.StatusFlag, StatusFlag1 = (ulong)attacked.StatusFlag, StatusFlag2 = (ulong)attacked.StatusFlag2, Unknown1 = 0x36, StatusFlagOffset = 0x6f, Time = (uint)spell.Duration, Value = 10, Level = spell.Level }; attacked.Owner.Send((byte[])packet3); } } } attacker.Owner.IncreaseSpellExperience(Experience, spellID); if (attacked.EntityFlag == EntityFlag.Player) attacked.Owner.SendScreen(suse, true); else attacked.MonsterInfo.SendScreen(suse); } } } break; } #endregion #region Percent case 3050: // case 11230: { //Console.WriteLine("1"); if (CanUseSpell(spell, attacker.Owner)) { if (attackedsob != null) { if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Distance) { SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (CanAttack(attacker, attackedsob, spell)) { PrepareSpell(spell, attacker.Owner); uint damage = Game.Attacking.Calculate.Percent(attackedsob, spell.PowerPercent); attackedsob.Hitpoints -= damage; suse.Targets.Add(attackedsob.UID, damage); attacker.Owner.SendScreen(suse, true); } } } else { if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance) { SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { PrepareSpell(spell, attacker.Owner); uint damage = Game.Attacking.Calculate.Percent(attacked, spell.PowerPercent); if (attacker.Owner.QualifierGroup != null) attacker.Owner.QualifierGroup.UpdateDamage(attacker.Owner, damage); attacked.Hitpoints -= damage; suse.Targets.Add(attacked.UID, damage); if (attacked.EntityFlag == EntityFlag.Player) attacked.Owner.SendScreen(suse, true); else attacked.MonsterInfo.SendScreen(suse); } } } } break; } #endregion #region ExtraXP case 1040: { if (CanUseSpell(spell, attacker.Owner)) { SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (attacker.Owner.Team != null) { PrepareSpell(spell, attacker.Owner); foreach (Client.GameState teammate in attacker.Owner.Team.Teammates) { if (teammate.Entity.UID != attacker.UID) { if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, teammate.Entity.X, teammate.Entity.Y) <= spell.Distance) { teammate.XPCount += 20; Update update = new Update(true); update.UID = teammate.Entity.UID; update.Append(Update.XPCircle, teammate.XPCount); update.Send(teammate); suse.Targets.Add(teammate.Entity.UID, 20); if (spell.NextSpellID != 0) { attack.Damage = spell.NextSpellID; attacker.AttackPacket = attack; } else { attacker.AttackPacket = null; } } } } } if (attacked.EntityFlag == EntityFlag.Player) attacked.Owner.SendScreen(suse, true); else attacked.MonsterInfo.SendScreen(suse); } break; } #endregion #region WeaponSpells #region Circle case 5010: case 7020: //case 11110: //case 10490: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; if (suse.SpellID != 10415) { suse.X = X; suse.Y = Y; } else { suse.X = 6; } if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1) { foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects) { if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range) { if (attacked.ContainsFlag(Update.Flags.Fly)) return; if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { PrepareSpell(spell, attacker.Owner); //attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack); //suse.Effect1 = attack.Effect1; ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); } } } else if (_obj.MapObjType == MapObjectType.SobNpc) { attackedsob = _obj as SobNpcSpawn; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range) { if (CanAttack(attacker, attackedsob, spell)) { PrepareSpell(spell, attacker.Owner); // attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); damage = (uint)(damage * spell.PowerPercent); ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); } } } } } else { attacker.AttackPacket = null; } attacker.Owner.SendScreen(suse, true); } break; } #endregion #region Single target case 10490: case 11140: //case 11230: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1) { if (attackedsob != null) { if (CanAttack(attacker, attackedsob, spell)) { PrepareSpell(spell, attacker.Owner); suse.MakeConst(); for (uint c = 0; c < 3; c++) { uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); if (damage > attackedsob.Hitpoints) damage = attackedsob.Hitpoints; ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID + c, damage); } } } else { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { PrepareSpell(spell, attacker.Owner); suse.MakeConst(); for (uint c = 0; c < 3; c++) { uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack); if (damage > attacked.Hitpoints) damage = attacked.Hitpoints; ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID + c, damage); } } } } else { attacker.AttackPacket = null; } attacker.Owner.SendScreen(suse, true); } break; } case 1290: case 5030: case 5040: case 7000: case 7010: case 7030: case 7040: case 11230: //case 10381: //case 10490: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1) { if (attackedsob != null) { if (CanAttack(attacker, attackedsob, spell)) { PrepareSpell(spell, attacker.Owner); attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); damage = (uint)(damage * spell.PowerPercent); ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); } } else { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { PrepareSpell(spell, attacker.Owner); attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack); suse.Effect1 = attack.Effect1; ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); } } attacker.AttackPacket = null; } else { attacker.AttackPacket = null; } attacker.Owner.SendScreen(suse, true); } attacker.AttackPacket = null; break; } #endregion #region Sector case 1250: case 5050: case 5020: case 1300: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; Sector sector = new Sector(attacker.X, attacker.Y, X, Y); sector.Arrange(spell.Sector, spell.Range); if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Distance + 1) { foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects) { if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (sector.Inside(attacked.X, attacked.Y)) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack); suse.Effect1 = attack.Effect1; ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); } } } else if (_obj.MapObjType == MapObjectType.SobNpc) { attackedsob = _obj as SobNpcSpawn; if (sector.Inside(attackedsob.X, attackedsob.Y)) { if (CanAttack(attacker, attackedsob, spell)) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); damage = (uint)(damage * spell.PowerPercent); ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); } } } } } else { attacker.AttackPacket = null; } attacker.Owner.SendScreen(suse, true); } break; } #endregion #endregion #region Fly case 8002: case 8003: { if (CanUseSpell(spell, attacker.Owner)) { if (attacker.MapID == 1950) return; PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; attacked.FlyStamp = Time32.Now; attacked.FlyTime = (byte)spell.Duration; suse.Targets.Add(attacker.UID, attacker.FlyTime); attacker.AddFlag(Update.Flags.Fly); attacker.RemoveFlag(Update.Flags.Ride); attacker.Owner.SendScreen(suse, true); } break; } #endregion #region Pirate Spells #region Xp Skills case 10309: //Cannon Barrage { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (!attacker.ContainsFlag2(Update.Flags2.ChainBoltActive)) { //attacker.RemoveFlag(Update.Flags.XPList); attacker.ChainBoltStamp = Time32.Now; attacker.ChainBoltTime = 30; attacker.AddFlag2(Update.Flags2.ChainBoltActive); } if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range) { for (int c = 0; c < attacker.Owner.Screen.Objects.Count(); c++) { //For a multi threaded application, while we go through the collection //the collection might change. We will make sure that we wont go off //the limits with a check. if (c >= attacker.Owner.Screen.Objects.Count()) break; Interfaces.IMapObject _obj = attacker.Owner.Screen.Objects[c]; if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack); if (spell.Power > 0) damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack); if (spell.ID == 8030) damage = Game.Attacking.Calculate.Ranged(attacker, attacked, ref attack); ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); //attacked.AddFlag(Update.Effects.CannonBarrage); } } } else if (_obj.MapObjType == MapObjectType.SobNpc) { attackedsob = _obj as SobNpcSpawn; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range) { if (CanAttack(attacker, attackedsob, spell)) { uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); if (spell.Power > 0) damage = Game.Attacking.Calculate.Magic(attacker, attackedsob, spell, ref attack); if (spell.ID == 8030) damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack); ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); //attacked.AddFlag(Update.Effects.CannonBarrage); } } } } } else { attacker.AttackPacket = null; } attacker.Owner.SendScreen(suse, true); } break; } case 11050: //Cannon Barrage { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (!attacker.ContainsFlag2(Update.Flags2.CannonBraga)) { // attacker.RemoveFlag(Update.Flags.XPList); attacker.CannonBarageStamp = Time32.Now; attacker.Cannonbarage = 30; attacker.AddFlag2(Update.Flags2.CannonBraga); } if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= 10) { for (int c = 0; c < attacker.Owner.Screen.Objects.Count(); c++) { //For a multi threaded application, while we go through the collection //the collection might change. We will make sure that we wont go off //the limits with a check. if (c >= attacker.Owner.Screen.Objects.Count()) break; Interfaces.IMapObject _obj = attacker.Owner.Screen.Objects[c]; if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= 10) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack); if (spell.Power > 0) damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack); if (spell.ID == 8030) damage = Game.Attacking.Calculate.Ranged(attacker, attacked, ref attack); ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); //attacked.AddFlag(Update.Effects.CannonBarrage); } } } else if (_obj.MapObjType == MapObjectType.SobNpc) { attackedsob = _obj as SobNpcSpawn; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= 10) { if (CanAttack(attacker, attackedsob, spell)) { uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); if (spell.Power > 0) damage = Game.Attacking.Calculate.Magic(attacker, attackedsob, spell, ref attack); if (spell.ID == 8030) damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack); ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); //attacked.AddFlag(Update.Effects.CannonBarrage); } } } } } else { attacker.AttackPacket = null; } attacker.Owner.SendScreen(suse, true); } break; } case 11060: // BlackPearl Rage { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (!attacker.ContainsFlag2(Update.Flags2.BlackBread)) { //attacker.RemoveFlag(Update.Flags.XPList); attacker.BlackBeardStamp = Time32.Now; attacker.Blackbeard = 30; attacker.AddFlag2(Update.Flags2.BlackBread); } if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range) { for (int c = 0; c < attacker.Owner.Screen.Objects.Count(); c++) { //For a multi threaded application, while we go through the collection //the collection might change. We will make sure that we wont go off //the limits with a check. if (c >= attacker.Owner.Screen.Objects.Count()) break; Interfaces.IMapObject _obj = attacker.Owner.Screen.Objects[c]; if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack); if (spell.Power > 0) damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack); if (spell.ID == 8030) damage = Game.Attacking.Calculate.Ranged(attacker, attacked, ref attack); ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); } } } else if (_obj.MapObjType == MapObjectType.SobNpc) { attackedsob = _obj as SobNpcSpawn; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range) { if (CanAttack(attacker, attackedsob, spell)) { uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); if (spell.Power > 0) damage = Game.Attacking.Calculate.Magic(attacker, attackedsob, spell, ref attack); if (spell.ID == 8030) damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack); ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); } } } } } else { attacker.AttackPacket = null; } attacker.Owner.SendScreen(suse, true); } break; } #endregion #region Auto On Skills case 11130: //Adrenaline Rush //case 11130: //BlackSpot { spell.RemoveCooldown(0x2b16); if (CanUseSpell(spell, attacker.Owner)) { PhoenixProject.Network.GamePackets.Quest.Target target5 = new PhoenixProject.Network.GamePackets.Quest.Target { Obj = attacker, Damage = 0x2b16, DamageType = HitType.NoDamage, Hit = true }; if (spell.CoolDown > 0) { spell.AddCooldown(spell.ID, (int)spell.CoolDown); } } break; } #endregion // Doesnt Work // Doest Work #region Linear Skills /* case 11110: //Blade Tempest { //if (Time32.Now < attacker.WhilrwindKick.AddMilliseconds(1500)) // return; //attacker.WhilrwindKick = Time32.Now; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= 5) { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; Game.Map Map = ServerBase.Kernel.Maps[attacker.MapID]; if (Map.SelectCoordonates(ref X, ref Y)) { //attacker.X = X; // attacker.Y = Y; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= 5) { for (int c = 0; c < attacker.Owner.Screen.Objects.Count(); c++) { //For a multi threaded application, while we go through the collection //the collection might change. We will make sure that we wont go off //the limits with a check. if (c >= attacker.Owner.Screen.Objects.Count()) break; Interfaces.IMapObject _obj = attacker.Owner.Screen.Objects[c]; if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (ServerBase.Kernel.GetDistance(X, Y, attacked.X, attacked.Y) <= 1) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Ranged)) { uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack); ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); } } } } } } else { attacker.AttackPacket = null; } attacker.Owner.SendScreen(suse, true); } } break; }*/ #endregion #region Single damage Skill case 11120: { if (attacked != null) { if (attacked.EntityFlag == EntityFlag.Player || attacked.EntityFlag == EntityFlag.Monster) { if (!attacked.Dead) { BlackSpot spot = new BlackSpot { Remove = 0, Identifier = attacked.UID }; attacker.Owner.Send((byte[])spot); attacked.BlackSpotTime = Time32.Now; attacked.BlackSpotTime2 = 12; attacked.BlackSpots = true; attacker.Owner.IncreaseSpellExperience(80, 11120); } } } break; } case 11030: // Eagle Eye if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; suse.Effect1 = 0; bool kimo = false; //suse.Targets.Add(attacker.UID, spell.Power); if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Distance) { if (attackedsob != null) { if (CanAttack(attacker, attackedsob, spell)) { PrepareSpell(spell, attacker.Owner); uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); damage = (uint)(damage * spell.PowerPercent * 30); ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); } } else { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { kimo = attacked.BlackSpots; PrepareSpell(spell, attacker.Owner); uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack); ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); } } } if (attacker.Owner.Spells.ContainsKey(11130)) { if (kimo) { suse.SpellID = 11060; attacker.Owner.SendScreen(suse, true); suse.Attacker = attacker.UID; suse.SpellID = 11130; suse.SpellLevel = attacker.Owner.Spells[11130].Level; suse.X = attacker.X; suse.Y = attacker.X; uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack); suse.Targets.Add(attacked.UID, damage); attacker.Owner.SendScreen(suse, true); attacker.Owner.IncreaseSpellExperience(80, 11130); break; } } if (attacker.Owner.Spells.ContainsKey(11130)) { if (ServerBase.Kernel.Rate(5)) { ////spell.Duration = 0; attacker.Update(_String.Effect, "RapidReplace", true); suse.SpellID = 11060; attacker.Owner.SendScreen(suse, true); } else { //// spell.Duration = 0; //attacker.Update(_String.Effect, "RapidReplace", true); attacker.Owner.SendScreen(suse, true); } } else { // spell.Duration = 0; // attacker.Update(_String.Effect, "RapidReplace", true); attacker.Owner.SendScreen(suse, true); } } break; #endregion #region Region Damage Skills case 11100: //kracken revenge { //Console.WriteLine("0"); if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; //Console.WriteLine("1"); int counts = 0; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= 5) { for (int c = 0; c < attacker.Owner.Screen.Objects.Count(); c++) { // Console.WriteLine("2"); if (counts < 5) { //Console.WriteLine("3"); //For a multi threaded application, while we go through the collection //the collection might change. We will make sure that we wont go off //the limits with a check. if (c >= attacker.Owner.Screen.Objects.Count()) break; Interfaces.IMapObject _obj = attacker.Owner.Screen.Objects[c]; if (_obj == null) continue; //Console.WriteLine("4"); if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= 5) { // Console.WriteLine("5"); if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { if (attacked.EntityFlag == EntityFlag.Monster) { BlackSpot spot = new BlackSpot { Remove = 0, Identifier = attacked.UID }; attacker.Owner.Send((byte[])spot); attacked.BlackSpotTime = Time32.Now; attacked.BlackSpotTime2 = (byte)spell.Duration; attacked.BlackSpots = true; counts += 1; } else { if (!ServerBase.Constants.BlackSpotNo.Contains(attacker.MapID)) { BlackSpot spot = new BlackSpot { Remove = 0, Identifier = attacked.UID }; attacker.Owner.Send((byte[])spot); attacked.BlackSpotTime = Time32.Now; attacked.BlackSpotTime2 = (byte)spell.Duration; attacked.BlackSpots = true; counts += 1; } } } } } } } } else { attacker.AttackPacket = null; } attacker.Owner.SendScreen(suse, true); attacker.Owner.IncreaseSpellExperience(80, spellID); } break; } case 11040: // Scurvey Bomb { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range) { for (int c = 0; c < attacker.Owner.Screen.Objects.Count(); c++) { //For a multi threaded application, while we go through the collection //the collection might change. We will make sure that we wont go off //the limits with a check. if (c >= attacker.Owner.Screen.Objects.Count()) break; Interfaces.IMapObject _obj = attacker.Owner.Screen.Objects[c]; if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack); if (spell.Power > 0) damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack); ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); attacker.Owner.SendScreen(suse, true); } } } else if (_obj.MapObjType == MapObjectType.SobNpc) { attackedsob = _obj as SobNpcSpawn; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range) { if (CanAttack(attacker, attackedsob, spell)) { uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); if (spell.Power > 0) damage = Game.Attacking.Calculate.Magic(attacker, attackedsob, spell, ref attack); ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); attacker.Owner.SendScreen(suse, true); } } } } } else { attacker.AttackPacket = null; } } break; } case 11070: // Gale Bomb { if (Time32.Now >= attacker.MagikAttackTimeAtaque.AddMilliseconds(200)) { attacker.MagikAttackTimeAtaque = Time32.Now; if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = attack.X; suse.Y = attack.Y; attack.AttackType = 0x1b; byte MaxDistance = (byte)spell.UnknownPush; int counts = 0; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 3) { foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects) { if (counts < 3) { if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (ServerBase.Kernel.GetDistance(X, Y, attacked.X, attacked.Y) <= 5) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { if (Misc.Distance(_obj.X, _obj.Y, (ushort)attack.X, (ushort)attack.Y) < (int)MaxDistance) { var direction = ServerBase.Kernel.GetAngle(attacker.X, attacker.Y, attacked.X, attacked.Y); attack = new Attack(true); byte angle = (byte)(attack.Attacked % 8); attack.Effect1 = Attack.AttackEffects1.None; uint damage = Calculate.Melee(attacker, attacked, ref attack); attack.AttackType = 0x1b; attack.X = attacker.X; attack.Y = attacker.Y; attack.PushBack = angle; attack.Attacker = attacker.UID; attack.Attacked = attacked.UID; attack.Damage = damage; // attack.ToArray()[27] = (byte)direction; // attacked.Move(direction); // attacker.Move(direction); ReceiveAttack(attacker, attacked, attack, damage, spell); counts++; // attacker.Owner.SendScreen(attack, true); attacker.Owner.SendScreen(suse, true); //attacker.X = attacker.X; } else break; } else { suse.Targets.Add(attacked.UID, 0); suse.Targets[attacked.UID].Hit = false; } } } } else if (_obj.MapObjType == MapObjectType.SobNpc) { attackedsob = _obj as SobNpcSpawn; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= 5) { if (CanAttack(attacker, attackedsob, spell)) { if (ServerBase.Kernel.Rate(100)) { if (CanAttack(attacker, attackedsob, spell)) { uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); ReceiveAttack(attacker, attackedsob, attack, damage, spell); counts++; } } else { suse.Targets.Add(attacked.UID, 0); suse.Targets[attacked.UID].Hit = false; } } } } } } } else { attacker.AttackPacket = null; } attacker.Owner.SendScreen(suse, true); } } break; } #endregion #endregion #region Ninja Spells case 6010://Vortex { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; attacker.AddFlag(Update.Flags.ShurikenVortex); attacker.RemoveFlag(Update.Flags.Ride); attacker.ShurikenVortexStamp = Time32.Now; attacker.ShurikenVortexTime = 20; attacker.Owner.SendScreen(suse, true); attacker.VortexPacket = new Attack(true); attacker.VortexPacket.Decoded = true; attacker.VortexPacket.Damage = 6012; attacker.VortexPacket.AttackType = Attack.Magic; attacker.VortexPacket.Attacker = attacker.UID; } break; } case 6012://VortexRespone { if (!attacker.ContainsFlag(Update.Flags.ShurikenVortex)) { attacker.AttackPacket = null; break; } SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = attacker.X; suse.Y = attacker.Y; foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects) { if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack); suse.Effect1 = attack.Effect1; ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); } } } else if (_obj.MapObjType == MapObjectType.SobNpc) { attackedsob = _obj as SobNpcSpawn; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range) { if (CanAttack(attacker, attackedsob, spell)) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); suse.Effect1 = attack.Effect1; ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); } } } } attacker.Owner.SendScreen(suse, true); break; } case 6001: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Distance) { foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects) { if (_obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (ServerBase.Kernel.GetDistance(X, Y, attacked.X, attacked.Y) <= spell.Range) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { int potDifference = attacker.BattlePower - attacked.BattlePower; int rate = spell.Percent + potDifference - 20; if (ServerBase.Kernel.Rate(rate)) { attacked.ToxicFogStamp = Time32.Now; attacked.ToxicFogLeft = 20; attacked.ToxicFogPercent = spell.PowerPercent; suse.Targets.Add(attacked.UID, 1); } if (attacker.BattlePower - attacked.BattlePower > 0) { attacked.ToxicFogStamp = Time32.Now; attacked.ToxicFogLeft = 20; attacked.ToxicFogPercent = spell.PowerPercent; suse.Targets.Add(attacked.UID, 1); } else { suse.Targets.Add(attacked.UID, 0); suse.Targets[attacked.UID].Hit = false; } } } } else { if (_obj.MapObjType == MapObjectType.Monster) { attacked = _obj as Entity; if (!ServerBase.Constants.NoFog.Contains(attacked.Name)) { if (ServerBase.Kernel.GetDistance(X, Y, attacked.X, attacked.Y) <= spell.Range) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { int potDifference = attacker.BattlePower - attacked.BattlePower; int rate = spell.Percent + potDifference - 20; if (ServerBase.Kernel.Rate(rate)) { attacked.ToxicFogStamp = Time32.Now; attacked.ToxicFogLeft = 20; attacked.ToxicFogPercent = spell.PowerPercent; suse.Targets.Add(attacked.UID, 1); } if (attacker.BattlePower - attacked.BattlePower > 0) { attacked.ToxicFogStamp = Time32.Now; attacked.ToxicFogLeft = 20; attacked.ToxicFogPercent = spell.PowerPercent; suse.Targets.Add(attacked.UID, 1); } else { suse.Targets.Add(attacked.UID, 0); suse.Targets[attacked.UID].Hit = false; } } } } } } } } else { attacker.AttackPacket = null; } attacker.Owner.IncreaseSpellExperience(80, spellID); attacker.Owner.SendScreen(suse, true); } break; } case 6000: case 10381: { if (CanUseSpell(spell, attacker.Owner)) { ushort Xx, Yx; if (attacked != null) { Xx = attacked.X; Yx = attacked.Y; } else { Xx = attackedsob.X; Yx = attackedsob.Y; } if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, Xx, Yx) <= spell.Range) { if (attackedsob == null) if (attacked.ContainsFlag(Network.GamePackets.Update.Flags.Fly)) return; //if (attacked.ContainsFlag(Network.GamePackets.Update.Flags.Fly)) // return; if (attacker.ContainsFlag(Network.GamePackets.Update.Flags.Fly)) return; PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; bool send = false; if (attackedsob == null) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack); suse.Effect1 = attack.Effect1; ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); send = true; } } else { if (CanAttack(attacker, attackedsob, spell)) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack); damage = (uint)(damage * spell.PowerPercent); ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Effect1 = attack.Effect1; suse.Targets.Add(attackedsob.UID, damage); send = true; } } if (send) attacker.Owner.SendScreen(suse, true); } else { attacker.AttackPacket = null; } } break; } case 6002: { if (attackedsob != null) return; if (attacked.EntityFlag == EntityFlag.Monster) return; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance) { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); int potDifference = attacker.BattlePower - attacked.BattlePower; int rate = spell.Percent + potDifference; SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (CanAttack(attacker, attacked, spell, false)) { suse.Targets.Add(attacked.UID, 0); if (ServerBase.Kernel.Rate(rate)) { attacked.NoDrugsStamp = Time32.Now; attacked.NoDrugsTime = (short)spell.Duration; if (attacked.EntityFlag == EntityFlag.Player) { attacker.Owner.IncreaseSpellExperience(80, spellID); attacked.Owner.Send(ServerBase.Constants.NoDrugs((int)spell.Duration)); } } else { suse.Targets[attacked.UID].Hit = false; } attacked.Owner.SendScreen(suse, true); } } } break; } case 6004: { if (attackedsob != null) return; if (attacked.EntityFlag == EntityFlag.Monster) return; if (!attacked.ContainsFlag(Update.Flags.Fly)) return; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance) { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); int potDifference = attacker.BattlePower - attacked.BattlePower; int rate = spell.Percent + potDifference; SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (CanAttack(attacker, attacked, spell, false)) { uint dmg = Calculate.Percent(attacked, 0.1F); suse.Targets.Add(attacked.UID, dmg); if (ServerBase.Kernel.Rate(rate)) { attacked.Hitpoints -= dmg; attacked.RemoveFlag(Update.Flags.Fly); } else { suse.Targets[attacked.UID].Hit = false; } attacked.Owner.SendScreen(suse, true); } } } break; } #endregion #region Riding case 7001: { if (attacker.ContainsFlag2(Update.Flags2.WarriorWalk)) return; if (attacker.ContainsFlag(Update.Flags.ShurikenVortex)) return; if (ServerBase.Constants.steedguard.Contains(attacker.MapID)) return; if (!attacker.Owner.Equipment.Free(12)) { SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (attacker.ContainsFlag(Update.Flags.Ride)) { attacker.RemoveFlag(Update.Flags.Ride); } else { if (attacker.Owner.Equipment.TryGetItem((byte)12).Plus < attacker.MapRegion.Lineage) break; if (attacker.Stamina >= 100 && (attacker.Owner.QualifierGroup == null || attacker.Owner.QualifierGroup != null && !attacker.Owner.QualifierGroup.Inside)) { attacker.AddFlag(Update.Flags.Ride); attacker.Stamina -= 100; attacker.Vigor = (ushort)attacker.MaxVigor; Network.GamePackets.Vigor vigor = new Network.GamePackets.Vigor(true); vigor.VigorValue = attacker.Owner.Entity.MaxVigor; vigor.Send(attacker.Owner); } } suse.Targets.Add(attacker.UID, 0); attacker.Owner.SendScreen(suse, true); } break; } case 7002: {//Spook if (attacked.ContainsFlag(Update.Flags.Ride) && attacker.ContainsFlag(Update.Flags.Ride)) { Interfaces.IConquerItem attackedSteed = null, attackerSteed = null; if ((attackedSteed = attacked.Owner.Equipment.TryGetItem(ConquerItem.Steed)) != null) { if ((attackerSteed = attacker.Owner.Equipment.TryGetItem(ConquerItem.Steed)) != null) { SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; suse.Targets.Add(attacked.UID, 0); if (attackedSteed.Plus < attackerSteed.Plus) attacked.RemoveFlag(Update.Flags.Ride); else if (attackedSteed.Plus == attackerSteed.Plus && attackedSteed.PlusProgress <= attackerSteed.PlusProgress) attacked.RemoveFlag(Update.Flags.Ride); else suse.Targets[attacked.UID].Hit = false; attacker.Owner.SendScreen(suse, true); } } } break; } case 7003: {//WarCry SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; Interfaces.IConquerItem attackedSteed = null, attackerSteed = null; foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects) { if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Player && _obj.UID != attacker.UID) { attacked = _obj as Entity; if ((attackedSteed = attacked.Owner.Equipment.TryGetItem(ConquerItem.Steed)) != null) { if ((attackerSteed = attacker.Owner.Equipment.TryGetItem(ConquerItem.Steed)) != null) { if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= attackedSteed.Plus) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { suse.Targets.Add(attacked.UID, 0); if (attackedSteed.Plus < attackerSteed.Plus) attacked.RemoveFlag(Update.Flags.Ride); else if (attackedSteed.Plus == attackerSteed.Plus && attackedSteed.PlusProgress <= attackerSteed.PlusProgress) attacked.RemoveFlag(Update.Flags.Ride); else suse.Targets[attacked.UID].Hit = false; } } } } } } attacker.Owner.SendScreen(suse, true); break; } #endregion #region Dash case 1051: { if (attacked != null) { if (!attacked.Dead) { var direction = ServerBase.Kernel.GetAngle(attacker.X, attacker.Y, attacked.X, attacked.Y); if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { attack = new Attack(true); attack.Effect1 = Attack.AttackEffects1.None; uint damage = Calculate.Melee(attacker, attacked, ref attack); attack.AttackType = Attack.Dash; attack.X = attacked.X; attack.Y = attacked.Y; attack.Attacker = attacker.UID; attack.Attacked = attacked.UID; attack.Damage = damage; attack.ToArray()[27] = (byte)direction; attacked.Move(direction); attacker.Move(direction); ReceiveAttack(attacker, attacked, attack, damage, spell); attacker.Owner.SendScreen(attack, true); } } } break; } #endregion #region RapidFire case 8000: { if (attackedsob != null) { if (CanUseSpell(spell, attacker.Owner)) { if (CanAttack(attacker, attackedsob, spell)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = attackedsob.X; suse.Y = attackedsob.Y; attack.Effect1 = Attack.AttackEffects1.None; uint damage = Calculate.Ranged(attacker, attackedsob, ref attack); suse.Effect1 = attack.Effect1; damage = (uint)(damage * spell.PowerPercent); suse.Targets.Add(attackedsob.UID, damage); ReceiveAttack(attacker, attackedsob, attack, damage, spell); attacker.Owner.SendScreen(suse, true); } } } else { if (!attacked.Dead) { if (CanUseSpell(spell, attacker.Owner)) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = attacked.X; suse.Y = attacked.Y; attack.Effect1 = Attack.AttackEffects1.None; uint damage = Calculate.Ranged(attacker, attacked, ref attack); damage = (uint)(damage * spell.PowerPercent); suse.Targets.Add(attacked.UID, damage); ReceiveAttack(attacker, attacked, attack, damage, spell); attacker.Owner.SendScreen(suse, true); } } } } break; } #endregion #region FireOfHell case 1165: case 7014: case 7012: case 9971: case 7017: case 7015: case 7013: case 10360: case 9966: case 30010: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; Sector sector = new Sector(attacker.X, attacker.Y, X, Y); sector.Arrange(spell.Sector, spell.Distance); foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects) { if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (sector.Inside(attacked.X, attacked.Y)) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack); suse.Effect1 = attack.Effect1; ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); } } } else if (_obj.MapObjType == MapObjectType.SobNpc) { attackedsob = _obj as SobNpcSpawn; if (sector.Inside(attackedsob.X, attackedsob.Y)) { if (CanAttack(attacker, attackedsob, spell)) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Magic(attacker, attackedsob, spell, ref attack); suse.Effect1 = attack.Effect1; ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); } } } } attacker.Owner.SendScreen(suse, true); } break; } #endregion #region Scatter case 8001: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (attacker.xx == attacker.X && attacker.yy == attacker.Y) { attacker.scatter += 1; if (attacker.scatter > 30) { attacker.Owner.Disconnect(); } } else { attacker.xx = attacker.X; attacker.yy = attacker.Y; attacker.scatter = 0; } Sector sector = new Sector(attacker.X, attacker.Y, X, Y); sector.Arrange(spell.Sector, spell.Distance); foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects) { if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (sector.Inside(attacked.X, attacked.Y)) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Ranged(attacker, attacked, spell, ref attack); ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); } } } else if (_obj.MapObjType == MapObjectType.SobNpc) { attackedsob = _obj as SobNpcSpawn; if (sector.Inside(attackedsob.X, attackedsob.Y)) { if (CanAttack(attacker, attackedsob, spell)) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack); suse.Effect1 = attack.Effect1; if (damage == 0) damage = 1; damage = Game.Attacking.Calculate.Percent((int)damage, spell.PowerPercent); ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); } } } } attacker.Owner.SendScreen(suse, true); } break; } #endregion #region Intensify case 9000: { attacker.IntensifyStamp = Time32.Now; attacker.OnIntensify = true; SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; suse.Targets.Add(attacker.UID, 0); suse.Send(attacker.Owner); break; } #endregion #region StarArrow case 10313: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; Sector sector = new Sector(attacker.X, attacker.Y, X, Y); sector.Arrange(spell.Sector, spell.Distance); foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects) { if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (sector.Inside(attacked.X, attacked.Y)) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee)) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Ranged(attacker, attacked, spell, ref attack); ReceiveAttack(attacker, attacked, attack, damage, spell); suse.Targets.Add(attacked.UID, damage); } } } else if (_obj.MapObjType == MapObjectType.SobNpc) { attackedsob = _obj as SobNpcSpawn; if (sector.Inside(attackedsob.X, attackedsob.Y)) { if (CanAttack(attacker, attackedsob, spell)) { attack.Effect1 = Attack.AttackEffects1.None; uint damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack); suse.Effect1 = attack.Effect1; if (damage == 0) damage = 1; damage = Game.Attacking.Calculate.Percent((int)damage, spell.PowerPercent); ReceiveAttack(attacker, attackedsob, attack, damage, spell); suse.Targets.Add(attackedsob.UID, damage); } } } } attacker.Owner.SendScreen(suse, true); } break; } #endregion #region Trasnformations case 1270: case 1280: case 1350: case 1360: case 3321: { if (CanUseSpell(spell, attacker.Owner)) { if (attacker.MapID == 1036) return; bool wasTransformated = attacker.Transformed; PrepareSpell(spell, attacker.Owner); #region Atributes switch (spell.ID) { case 1350: switch (spell.Level) { case 0: { attacker.TransformationMaxAttack = 182; attacker.TransformationMinAttack = 122; attacker.TransformationDefence = 1300; attacker.TransformationMagicDefence = 94; attacker.TransformationDodge = 35; attacker.TransformationTime = 39; attacker.TransformationID = 207; break; } case 1: { attacker.TransformationMaxAttack = 200; attacker.TransformationMinAttack = 134; attacker.TransformationDefence = 1400; attacker.TransformationMagicDefence = 96; attacker.TransformationDodge = 40; attacker.TransformationTime = 49; attacker.TransformationID = 207; break; } case 2: { attacker.TransformationMaxAttack = 240; attacker.TransformationMinAttack = 160; attacker.TransformationDefence = 1500; attacker.TransformationMagicDefence = 97; attacker.TransformationDodge = 45; attacker.TransformationTime = 59; attacker.TransformationID = 207; break; } case 3: { attacker.TransformationMaxAttack = 258; attacker.TransformationMinAttack = 172; attacker.TransformationDefence = 1600; attacker.TransformationMagicDefence = 98; attacker.TransformationDodge = 50; attacker.TransformationTime = 69; attacker.TransformationID = 267; break; } case 4: { attacker.TransformationMaxAttack = 300; attacker.TransformationMinAttack = 200; attacker.TransformationDefence = 1900; attacker.TransformationMagicDefence = 99; attacker.TransformationDodge = 55; attacker.TransformationTime = 79; attacker.TransformationID = 267; break; } } break; case 1270: switch (spell.Level) { case 0: { attacker.TransformationMaxAttack = 282; attacker.TransformationMinAttack = 179; attacker.TransformationDefence = 73; attacker.TransformationMagicDefence = 34; attacker.TransformationDodge = 9; attacker.TransformationTime = 34; attacker.TransformationID = 214; break; } case 1: { attacker.TransformationMaxAttack = 395; attacker.TransformationMinAttack = 245; attacker.TransformationDefence = 126; attacker.TransformationMagicDefence = 45; attacker.TransformationDodge = 12; attacker.TransformationTime = 39; attacker.TransformationID = 214; break; } case 2: { attacker.TransformationMaxAttack = 616; attacker.TransformationMinAttack = 367; attacker.TransformationDefence = 180; attacker.TransformationMagicDefence = 53; attacker.TransformationDodge = 15; attacker.TransformationTime = 44; attacker.TransformationID = 214; break; } case 3: { attacker.TransformationMaxAttack = 724; attacker.TransformationMinAttack = 429; attacker.TransformationDefence = 247; attacker.TransformationMagicDefence = 53; attacker.TransformationDodge = 15; attacker.TransformationTime = 49; attacker.TransformationID = 214; break; } case 4: { attacker.TransformationMaxAttack = 1231; attacker.TransformationMinAttack = 704; attacker.TransformationDefence = 499; attacker.TransformationMagicDefence = 50; attacker.TransformationDodge = 20; attacker.TransformationTime = 54; attacker.TransformationID = 274; break; } case 5: { attacker.TransformationMaxAttack = 1573; attacker.TransformationMinAttack = 941; attacker.TransformationDefence = 601; attacker.TransformationMagicDefence = 53; attacker.TransformationDodge = 25; attacker.TransformationTime = 59; attacker.TransformationID = 274; break; } case 6: { attacker.TransformationMaxAttack = 1991; attacker.TransformationMinAttack = 1107; attacker.TransformationDefence = 1029; attacker.TransformationMagicDefence = 55; attacker.TransformationDodge = 30; attacker.TransformationTime = 64; attacker.TransformationID = 274; break; } case 7: { attacker.TransformationMaxAttack = 2226; attacker.TransformationMinAttack = 1235; attacker.TransformationDefence = 1029; attacker.TransformationMagicDefence = 55; attacker.TransformationDodge = 35; attacker.TransformationTime = 69; attacker.TransformationID = 274; break; } } break; case 1360: switch (spell.Level) { case 0: { attacker.TransformationMaxAttack = 1215; attacker.TransformationMinAttack = 610; attacker.TransformationDefence = 100; attacker.TransformationMagicDefence = 96; attacker.TransformationDodge = 30; attacker.TransformationTime = 59; attacker.TransformationID = 217; break; } case 1: { attacker.TransformationMaxAttack = 1310; attacker.TransformationMinAttack = 650; attacker.TransformationDefence = 400; attacker.TransformationMagicDefence = 97; attacker.TransformationDodge = 30; attacker.TransformationTime = 79; attacker.TransformationID = 217; break; } case 2: { attacker.TransformationMaxAttack = 1420; attacker.TransformationMinAttack = 710; attacker.TransformationDefence = 650; attacker.TransformationMagicDefence = 98; attacker.TransformationDodge = 30; attacker.TransformationTime = 89; attacker.TransformationID = 217; break; } case 3: { attacker.TransformationMaxAttack = 1555; attacker.TransformationMinAttack = 780; attacker.TransformationDefence = 720; attacker.TransformationMagicDefence = 98; attacker.TransformationDodge = 30; attacker.TransformationTime = 99; attacker.TransformationID = 277; break; } case 4: { attacker.TransformationMaxAttack = 1660; attacker.TransformationMinAttack = 840; attacker.TransformationDefence = 1200; attacker.TransformationMagicDefence = 99; attacker.TransformationDodge = 30; attacker.TransformationTime = 109; attacker.TransformationID = 277; break; } } break; case 1280: switch (spell.Level) { case 0: { attacker.TransformationMaxAttack = 930; attacker.TransformationMinAttack = 656; attacker.TransformationDefence = 290; attacker.TransformationMagicDefence = 45; attacker.TransformationDodge = 40; attacker.TransformationTime = 29; attacker.TransformationID = 213; break; } case 1: { attacker.TransformationMaxAttack = 1062; attacker.TransformationMinAttack = 750; attacker.TransformationDefence = 320; attacker.TransformationMagicDefence = 46; attacker.TransformationDodge = 40; attacker.TransformationTime = 34; attacker.TransformationID = 213; break; } case 2: { attacker.TransformationMaxAttack = 1292; attacker.TransformationMinAttack = 910; attacker.TransformationDefence = 510; attacker.TransformationMagicDefence = 50; attacker.TransformationDodge = 40; attacker.TransformationTime = 39; attacker.TransformationID = 213; break; } case 3: { attacker.TransformationMaxAttack = 1428; attacker.TransformationMinAttack = 1000; attacker.TransformationDefence = 600; attacker.TransformationMagicDefence = 53; attacker.TransformationDodge = 40; attacker.TransformationTime = 44; attacker.TransformationID = 213; break; } case 4: { attacker.TransformationMaxAttack = 1570; attacker.TransformationMinAttack = 1100; attacker.TransformationDefence = 700; attacker.TransformationMagicDefence = 55; attacker.TransformationDodge = 40; attacker.TransformationTime = 49; attacker.TransformationID = 213; break; } case 5: { attacker.TransformationMaxAttack = 1700; attacker.TransformationMinAttack = 1200; attacker.TransformationDefence = 880; attacker.TransformationMagicDefence = 57; attacker.TransformationDodge = 40; attacker.TransformationTime = 54; attacker.TransformationID = 273; break; } case 6: { attacker.TransformationMaxAttack = 1900; attacker.TransformationMinAttack = 1300; attacker.TransformationDefence = 1540; attacker.TransformationMagicDefence = 59; attacker.TransformationDodge = 40; attacker.TransformationTime = 59; attacker.TransformationID = 273; break; } case 7: { attacker.TransformationMaxAttack = 2100; attacker.TransformationMinAttack = 1500; attacker.TransformationDefence = 1880; attacker.TransformationMagicDefence = 61; attacker.TransformationDodge = 40; attacker.TransformationTime = 59; attacker.TransformationID = 273; break; } case 8: { attacker.TransformationMaxAttack = 2300; attacker.TransformationMinAttack = 1600; attacker.TransformationDefence = 1970; attacker.TransformationMagicDefence = 63; attacker.TransformationDodge = 40; attacker.TransformationTime = 59; attacker.TransformationID = 273; break; } } break; case 3321: { attacker.TransformationMaxAttack = 2000000; attacker.TransformationMinAttack = 2000000; attacker.TransformationDefence = 65355; attacker.TransformationMagicDefence = 65355; attacker.TransformationDodge = 35; attacker.TransformationTime = 65355; attacker.TransformationID = 223; break; } } #endregion SpellUse spellUse = new SpellUse(true); spellUse.Attacker = attacker.UID; spellUse.SpellID = spell.ID; spellUse.SpellLevel = spell.Level; spellUse.X = X; spellUse.Y = Y; spellUse.Targets.Add(attacker.UID, (uint)0); attacker.Owner.SendScreen(spellUse, true); attacker.TransformationStamp = Time32.Now; attacker.TransformationMaxHP = 3000; if (spell.ID == 1270) attacker.TransformationMaxHP = 50000; attacker.TransformationAttackRange = 3; if (spell.ID == 1360) attacker.TransformationAttackRange = 10; if (!wasTransformated) { double maxHP = attacker.MaxHitpoints; double HP = attacker.Hitpoints; double point = HP / maxHP; attacker.Hitpoints = (uint)(attacker.TransformationMaxHP * point); } attacker.Update(Update.MaxHitpoints, attacker.TransformationMaxHP, false); } break; } #endregion #region Bless case 9876: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); attacker.AddFlag(Update.Flags.CastPray); SpellUse spellUse = new SpellUse(true); spellUse.Attacker = attacker.UID; spellUse.SpellID = spell.ID; spellUse.SpellLevel = spell.Level; spellUse.X = X; spellUse.Y = Y; spellUse.Targets.Add(attacker.UID, 0); attacker.Owner.SendScreen(spellUse, true); } break; } #endregion #region Companions case 4000: case 4010: case 4020: case 4050: case 4060: case 4070: { if (CanUseSpell(spell, attacker.Owner)) { if (ServerBase.Constants.steedguard.Contains(attacker.MapID)) return; if (attacker.Owner.Map.BaseID == 700) return; if (attacker.Owner.Companion != null) { if (attacker.Owner.Companion.MonsterInfo != null) { attacker.Owner.Map.RemoveEntity(attacker.Owner.Companion); Data data = new Data(true); data.UID = attacker.Owner.Companion.UID; data.ID = Data.RemoveEntity; attacker.Owner.Companion.MonsterInfo.SendScreen(data); attacker.Owner.Companion = null; } } PrepareSpell(spell, attacker.Owner); SpellUse spellUse = new SpellUse(true); spellUse.Attacker = attacker.UID; spellUse.SpellID = spell.ID; spellUse.SpellLevel = spell.Level; spellUse.X = X; spellUse.Y = Y; spellUse.Targets.Add(attacker.UID, 0); attacker.Owner.SendScreen(spellUse, true); attacker.Owner.Companion = new Entity(EntityFlag.Monster, true); attacker.Owner.Companion.MonsterInfo = new PhoenixProject.Database.MonsterInformation(); Database.MonsterInformation mt = Database.MonsterInformation.MonsterInfos[spell.Power]; attacker.Owner.Companion.Owner = attacker.Owner; attacker.Owner.Companion.MapObjType = MapObjectType.Monster; attacker.Owner.Companion.MonsterInfo = mt.Copy(); attacker.Owner.Companion.MonsterInfo.Owner = attacker.Owner.Companion; attacker.Owner.Companion.Name = mt.Name; attacker.Owner.Companion.MinAttack = mt.MinAttack; attacker.Owner.Companion.MaxAttack = attacker.Owner.Companion.MagicAttack = mt.MaxAttack; attacker.Owner.Companion.Hitpoints = attacker.Owner.Companion.MaxHitpoints = mt.Hitpoints; attacker.Owner.Companion.Body = mt.Mesh; attacker.Owner.Companion.Level = mt.Level; //10000181 - 1000006 attacker.Owner.Companion.UID = (uint)ServerBase.Kernel.Random.Next(900300, 970350); attacker.Owner.Companion.MapID = attacker.Owner.Map.ID; attacker.Owner.Companion.SendUpdates = true; attacker.Owner.Companion.X = attacker.X; attacker.Owner.Companion.Y = attacker.Y; attacker.Owner.Map.AddEntity(attacker.Owner.Companion); attacker.Owner.SendScreenSpawn(attacker.Owner.Companion, true); } break; } #endregion #region MonkSpells //Compassion case 10395: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); if (attacker.Owner.Team != null) { foreach (Client.GameState c in attacker.Owner.Team.Teammates) { if (c.Entity.MapID == attacker.MapID) { short distance = Kernel.GetDistance(c.Entity.X, c.Entity.Y, attacker.X, attacker.Y); if (distance < ServerBase.Constants.pScreenDistance) { if (c.Entity.UID != attacker.UID) { if (!c.AlternateEquipment) { c.LoadItemStats(c.Entity); } else { c.LoadItemStats2(c.Entity); } c.Entity.AuraStamp = Time32.Now; c.Entity.AuraTime = 20; // attacked.MaxAttack += 1000; c.Entity.CriticalStrike += 10; //Console.WriteLine("sk" + attacked.CriticalStrike + ""); c.Entity.RemoveFlag2(Update.Flags2.FendAura); c.Entity.RemoveFlag2(Update.Flags2.MetalAura); c.Entity.RemoveFlag2(Update.Flags2.WoodAura); c.Entity.RemoveFlag2(Update.Flags2.WaterAura); c.Entity.RemoveFlag2(Update.Flags2.EarthAura); c.Entity.RemoveFlag2(Update.Flags2.FireAura); c.Entity.AddFlag2(Update.Flags2.TyrantAura); //Update ud = new Update(true); //ud.Aura(attacked, attacked.CriticalStrike, spell.Level, (byte)spell.Duration); PhoenixProject.Network.GamePackets.StatusIconData.AuraType tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; switch (spell.ID) { case 0x28b4: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MetalAura; break; case 0x28b5: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WoodAura; break; case 0x28b6: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WaterAura; break; case 0x28b7: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FireAura; break; case 0x28b8: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.EarthAura; break; case 0x2bc0: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MagicDefender; break; case 0x289b: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; break; case 0x28aa: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FendAura; break; } StatusIconData data2 = new StatusIconData { AuraLevel = spell.Level, AuraPower = spell.Power, AuraType2 = tyrantAura, Identifier = c.Entity.UID, Type = PhoenixProject.Network.GamePackets.StatusIconData.AuraDataTypes.Add }; c.Entity.Owner.Send((byte[])data2); } } } } } if (!attacked.Owner.AlternateEquipment) { attacked.Owner.LoadItemStats(attacked.Owner.Entity); } else { attacked.Owner.LoadItemStats2(attacked.Owner.Entity); } SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; attacker.Owner.SendScreen(suse, true); attacked.AuraStamp = Time32.Now; attacked.AuraTime = 20; // attacked.MaxAttack += 1000; attacked.CriticalStrike += 10; //Console.WriteLine("sk" + attacked.CriticalStrike + ""); attacked.RemoveFlag2(Update.Flags2.FendAura); attacked.RemoveFlag2(Update.Flags2.MetalAura); attacked.RemoveFlag2(Update.Flags2.WoodAura); attacked.RemoveFlag2(Update.Flags2.WaterAura); attacked.RemoveFlag2(Update.Flags2.EarthAura); attacked.RemoveFlag2(Update.Flags2.FireAura); attacked.AddFlag2(Update.Flags2.TyrantAura); //Update ud = new Update(true); //ud.Aura(attacked, attacked.CriticalStrike, spell.Level, (byte)spell.Duration); PhoenixProject.Network.GamePackets.StatusIconData.AuraType tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; switch (spell.ID) { case 0x28b4: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MetalAura; break; case 0x28b5: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WoodAura; break; case 0x28b6: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WaterAura; break; case 0x28b7: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FireAura; break; case 0x28b8: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.EarthAura; break; case 0x2bc0: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MagicDefender; break; case 0x289b: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; break; case 0x28aa: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FendAura; break; } StatusIconData data = new StatusIconData { AuraLevel = spell.Level, AuraPower = spell.Power, AuraType2 = tyrantAura2, Identifier = attacker.UID, Type = PhoenixProject.Network.GamePackets.StatusIconData.AuraDataTypes.Add }; attacker.Owner.Send((byte[])data); } break; } case 10410: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); if (attacker.Owner.Team != null) { foreach (Client.GameState c in attacker.Owner.Team.Teammates) { if (c.Entity.MapID == attacker.MapID) { short distance = Kernel.GetDistance(c.Entity.X, c.Entity.Y, attacker.X, attacker.Y); if (distance < ServerBase.Constants.pScreenDistance) { if (c.Entity.UID != attacker.UID) { if (!c.AlternateEquipment) { c.LoadItemStats(c.Entity); } else { c.LoadItemStats2(c.Entity); } c.Entity.AuraStamp = Time32.Now; c.Entity.AuraTime = 20; c.Entity.SkillCStrike += 10; c.Entity.CriticalStrike += 10; // attacked.MaxAttack += 100; c.Entity.RemoveFlag2(Update.Flags2.TyrantAura); c.Entity.RemoveFlag2(Update.Flags2.MetalAura); c.Entity.RemoveFlag2(Update.Flags2.WoodAura); c.Entity.RemoveFlag2(Update.Flags2.WaterAura); c.Entity.RemoveFlag2(Update.Flags2.EarthAura); c.Entity.RemoveFlag2(Update.Flags2.FireAura); c.Entity.AddFlag2(Update.Flags2.FendAura); PhoenixProject.Network.GamePackets.StatusIconData.AuraType tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; switch (spell.ID) { case 0x28b4: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MetalAura; break; case 0x28b5: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WoodAura; break; case 0x28b6: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WaterAura; break; case 0x28b7: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FireAura; break; case 0x28b8: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.EarthAura; break; case 0x2bc0: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MagicDefender; break; case 0x289b: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; break; case 0x28aa: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FendAura; break; } StatusIconData data2 = new StatusIconData { AuraLevel = spell.Level, AuraPower = spell.Power, AuraType2 = tyrantAura2, Identifier = c.Entity.UID, Type = PhoenixProject.Network.GamePackets.StatusIconData.AuraDataTypes.Add }; c.Entity.Owner.Send((byte[])data2); } } } } } if (!attacked.Owner.AlternateEquipment) { attacked.Owner.LoadItemStats(attacked.Owner.Entity); } else { attacked.Owner.LoadItemStats2(attacked.Owner.Entity); } SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; attacker.Owner.SendScreen(suse, true); attacked.AuraStamp = Time32.Now; attacked.AuraTime = 20; attacked.SkillCStrike += 10; attacked.CriticalStrike += 10; // attacked.MaxAttack += 100; attacked.RemoveFlag2(Update.Flags2.TyrantAura); attacked.RemoveFlag2(Update.Flags2.MetalAura); attacked.RemoveFlag2(Update.Flags2.WoodAura); attacked.RemoveFlag2(Update.Flags2.WaterAura); attacked.RemoveFlag2(Update.Flags2.EarthAura); attacked.RemoveFlag2(Update.Flags2.FireAura); attacked.AddFlag2(Update.Flags2.FendAura); PhoenixProject.Network.GamePackets.StatusIconData.AuraType tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; switch (spell.ID) { case 0x28b4: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MetalAura; break; case 0x28b5: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WoodAura; break; case 0x28b6: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WaterAura; break; case 0x28b7: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FireAura; break; case 0x28b8: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.EarthAura; break; case 0x2bc0: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MagicDefender; break; case 0x289b: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; break; case 0x28aa: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FendAura; break; } StatusIconData data = new StatusIconData { AuraLevel = spell.Level, AuraPower = spell.Power, AuraType2 = tyrantAura, Identifier = attacker.UID, Type = PhoenixProject.Network.GamePackets.StatusIconData.AuraDataTypes.Add }; attacker.Owner.Send((byte[])data); //Update ud = new Update(true); //ud.Aura(attacked, attacked.SkillCStrike, spell.Level, (byte)spell.Duration); } break; } case 10420: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); if (attacker.Owner.Team != null) { foreach (Client.GameState c in attacker.Owner.Team.Teammates) { if (c.Entity.MapID == attacker.MapID) { short distance = Kernel.GetDistance(c.Entity.X, c.Entity.Y, attacker.X, attacker.Y); if (distance < ServerBase.Constants.pScreenDistance) { if (c.Entity.UID != attacker.UID) { if (!c.AlternateEquipment) { c.LoadItemStats(c.Entity); } else { c.LoadItemStats2(c.Entity); } c.Entity.AuraStamp = Time32.Now; c.Entity.AuraTime = 20; c.Entity.MetalResistance += 30; c.Entity.RemoveFlag2(Update.Flags2.TyrantAura); c.Entity.RemoveFlag2(Update.Flags2.FendAura); c.Entity.RemoveFlag2(Update.Flags2.WoodAura); c.Entity.RemoveFlag2(Update.Flags2.WaterAura); c.Entity.RemoveFlag2(Update.Flags2.EarthAura); c.Entity.RemoveFlag2(Update.Flags2.FireAura); c.Entity.AddFlag2(Update.Flags2.MetalAura); PhoenixProject.Network.GamePackets.StatusIconData.AuraType tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; switch (spell.ID) { case 0x28b4: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MetalAura; break; case 0x28b5: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WoodAura; break; case 0x28b6: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WaterAura; break; case 0x28b7: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FireAura; break; case 0x28b8: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.EarthAura; break; case 0x2bc0: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MagicDefender; break; case 0x289b: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; break; case 0x28aa: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FendAura; break; } StatusIconData data2 = new StatusIconData { AuraLevel = spell.Level, AuraPower = spell.Power, AuraType2 = tyrantAura2, Identifier = c.Entity.UID, Type = PhoenixProject.Network.GamePackets.StatusIconData.AuraDataTypes.Add }; c.Entity.Owner.Send((byte[])data2); } } } } } if (!attacked.Owner.AlternateEquipment) { attacked.Owner.LoadItemStats(attacked.Owner.Entity); } else { attacked.Owner.LoadItemStats2(attacked.Owner.Entity); } SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; attacker.Owner.SendScreen(suse, true); attacked.AuraStamp = Time32.Now; attacked.AuraTime = 20; attacked.MetalResistance += 30; attacked.RemoveFlag2(Update.Flags2.TyrantAura); attacked.RemoveFlag2(Update.Flags2.FendAura); attacked.RemoveFlag2(Update.Flags2.WoodAura); attacked.RemoveFlag2(Update.Flags2.WaterAura); attacked.RemoveFlag2(Update.Flags2.EarthAura); attacked.RemoveFlag2(Update.Flags2.FireAura); attacked.AddFlag2(Update.Flags2.MetalAura); PhoenixProject.Network.GamePackets.StatusIconData.AuraType tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; switch (spell.ID) { case 0x28b4: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MetalAura; break; case 0x28b5: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WoodAura; break; case 0x28b6: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WaterAura; break; case 0x28b7: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FireAura; break; case 0x28b8: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.EarthAura; break; case 0x2bc0: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MagicDefender; break; case 0x289b: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; break; case 0x28aa: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FendAura; break; } StatusIconData data = new StatusIconData { AuraLevel = spell.Level, AuraPower = spell.Power, AuraType2 = tyrantAura, Identifier = attacker.UID, Type = PhoenixProject.Network.GamePackets.StatusIconData.AuraDataTypes.Add }; attacker.Owner.Send((byte[])data); } //Update ud = new Update(true); //ud.Aura(attacked, attacked.MetalResistance, spell.Level, (byte)spell.Duration); break; } case 10421: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); if (attacker.Owner.Team != null) { foreach (Client.GameState c in attacker.Owner.Team.Teammates) { if (c.Entity.MapID == attacker.MapID) { short distance = Kernel.GetDistance(c.Entity.X, c.Entity.Y, attacker.X, attacker.Y); if (distance < ServerBase.Constants.pScreenDistance) { if (c.Entity.UID != attacker.UID) { if (!c.AlternateEquipment) { c.LoadItemStats(c.Entity); } else { c.LoadItemStats2(c.Entity); } c.Entity.AuraStamp = Time32.Now; c.Entity.AuraTime = 20; c.Entity.WoodResistance += 30; c.Entity.RemoveFlag2(Update.Flags2.TyrantAura); c.Entity.RemoveFlag2(Update.Flags2.FendAura); c.Entity.RemoveFlag2(Update.Flags2.MetalAura); c.Entity.RemoveFlag2(Update.Flags2.WaterAura); c.Entity.RemoveFlag2(Update.Flags2.EarthAura); c.Entity.RemoveFlag2(Update.Flags2.FireAura); c.Entity.AddFlag2(Update.Flags2.WoodAura); PhoenixProject.Network.GamePackets.StatusIconData.AuraType tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; switch (spell.ID) { case 0x28b4: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MetalAura; break; case 0x28b5: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WoodAura; break; case 0x28b6: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WaterAura; break; case 0x28b7: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FireAura; break; case 0x28b8: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.EarthAura; break; case 0x2bc0: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MagicDefender; break; case 0x289b: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; break; case 0x28aa: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FendAura; break; } StatusIconData data2 = new StatusIconData { AuraLevel = spell.Level, AuraPower = spell.Power, AuraType2 = tyrantAura2, Identifier = c.Entity.UID, Type = PhoenixProject.Network.GamePackets.StatusIconData.AuraDataTypes.Add }; c.Entity.Owner.Send((byte[])data2); } } } } } if (!attacked.Owner.AlternateEquipment) { attacked.Owner.LoadItemStats(attacked.Owner.Entity); } else { attacked.Owner.LoadItemStats2(attacked.Owner.Entity); } SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; attacker.Owner.SendScreen(suse, true); attacked.AuraStamp = Time32.Now; attacked.AuraTime = 20; attacked.WoodResistance += 30; attacked.RemoveFlag2(Update.Flags2.TyrantAura); attacked.RemoveFlag2(Update.Flags2.FendAura); attacked.RemoveFlag2(Update.Flags2.MetalAura); attacked.RemoveFlag2(Update.Flags2.WaterAura); attacked.RemoveFlag2(Update.Flags2.EarthAura); attacked.RemoveFlag2(Update.Flags2.FireAura); attacked.AddFlag2(Update.Flags2.WoodAura); PhoenixProject.Network.GamePackets.StatusIconData.AuraType tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; switch (spell.ID) { case 0x28b4: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MetalAura; break; case 0x28b5: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WoodAura; break; case 0x28b6: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WaterAura; break; case 0x28b7: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FireAura; break; case 0x28b8: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.EarthAura; break; case 0x2bc0: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MagicDefender; break; case 0x289b: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; break; case 0x28aa: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FendAura; break; } StatusIconData data = new StatusIconData { AuraLevel = spell.Level, AuraPower = spell.Power, AuraType2 = tyrantAura, Identifier = attacker.UID, Type = PhoenixProject.Network.GamePackets.StatusIconData.AuraDataTypes.Add }; attacker.Owner.Send((byte[])data); //Update ud = new Update(true); } //ud.Aura(attacked, attacked.WoodResistance, spell.Level, (byte)spell.Duration); break; } case 10422: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); if (attacker.Owner.Team != null) { foreach (Client.GameState c in attacker.Owner.Team.Teammates) { if (c.Entity.MapID == attacker.MapID) { short distance = Kernel.GetDistance(c.Entity.X, c.Entity.Y, attacker.X, attacker.Y); if (distance < ServerBase.Constants.pScreenDistance) { if (c.Entity.UID != attacker.UID) { if (!c.AlternateEquipment) { c.LoadItemStats(c.Entity); } else { c.LoadItemStats2(c.Entity); } c.Entity.AuraStamp = Time32.Now; c.Entity.AuraTime = 20; c.Entity.WaterResistance += 30; c.Entity.RemoveFlag2(Update.Flags2.TyrantAura); c.Entity.RemoveFlag2(Update.Flags2.FendAura); c.Entity.RemoveFlag2(Update.Flags2.MetalAura); c.Entity.RemoveFlag2(Update.Flags2.WoodAura); c.Entity.RemoveFlag2(Update.Flags2.EarthAura); c.Entity.RemoveFlag2(Update.Flags2.FireAura); c.Entity.AddFlag2(Update.Flags2.WaterAura); PhoenixProject.Network.GamePackets.StatusIconData.AuraType tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; switch (spell.ID) { case 0x28b4: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MetalAura; break; case 0x28b5: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WoodAura; break; case 0x28b6: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WaterAura; break; case 0x28b7: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FireAura; break; case 0x28b8: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.EarthAura; break; case 0x2bc0: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MagicDefender; break; case 0x289b: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; break; case 0x28aa: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FendAura; break; } StatusIconData data2 = new StatusIconData { AuraLevel = spell.Level, AuraPower = spell.Power, AuraType2 = tyrantAura2, Identifier = c.Entity.UID, Type = PhoenixProject.Network.GamePackets.StatusIconData.AuraDataTypes.Add }; c.Entity.Owner.Send((byte[])data2); } } } } } if (!attacked.Owner.AlternateEquipment) { attacked.Owner.LoadItemStats(attacked.Owner.Entity); } else { attacked.Owner.LoadItemStats2(attacked.Owner.Entity); } SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; attacker.Owner.SendScreen(suse, true); attacked.AuraStamp = Time32.Now; attacked.AuraTime = 20; attacked.WaterResistance += 30; attacked.RemoveFlag2(Update.Flags2.TyrantAura); attacked.RemoveFlag2(Update.Flags2.FendAura); attacked.RemoveFlag2(Update.Flags2.MetalAura); attacked.RemoveFlag2(Update.Flags2.WoodAura); attacked.RemoveFlag2(Update.Flags2.EarthAura); attacked.RemoveFlag2(Update.Flags2.FireAura); attacked.AddFlag2(Update.Flags2.WaterAura); PhoenixProject.Network.GamePackets.StatusIconData.AuraType tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; switch (spell.ID) { case 0x28b4: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MetalAura; break; case 0x28b5: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WoodAura; break; case 0x28b6: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WaterAura; break; case 0x28b7: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FireAura; break; case 0x28b8: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.EarthAura; break; case 0x2bc0: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MagicDefender; break; case 0x289b: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; break; case 0x28aa: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FendAura; break; } StatusIconData data = new StatusIconData { AuraLevel = spell.Level, AuraPower = spell.Power, AuraType2 = tyrantAura, Identifier = attacker.UID, Type = PhoenixProject.Network.GamePackets.StatusIconData.AuraDataTypes.Add }; attacker.Owner.Send((byte[])data); //Update ud = new Update(true); } //ud.Aura(attacked, attacked.WaterResistance, spell.Level, (byte)spell.Duration); break; } case 10424: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); if (attacker.Owner.Team != null) { foreach (Client.GameState c in attacker.Owner.Team.Teammates) { if (c.Entity.MapID == attacker.MapID) { short distance = Kernel.GetDistance(c.Entity.X, c.Entity.Y, attacker.X, attacker.Y); if (distance < ServerBase.Constants.pScreenDistance) { if (c.Entity.UID != attacker.UID) { if (!c.AlternateEquipment) { c.LoadItemStats(c.Entity); } else { c.LoadItemStats2(c.Entity); } c.Entity.AuraStamp = Time32.Now; c.Entity.AuraTime = 20; c.Entity.EarthResistance += 30; c.Entity.RemoveFlag2(Update.Flags2.TyrantAura); c.Entity.RemoveFlag2(Update.Flags2.FendAura); c.Entity.RemoveFlag2(Update.Flags2.MetalAura); c.Entity.RemoveFlag2(Update.Flags2.WoodAura); c.Entity.RemoveFlag2(Update.Flags2.WaterAura); c.Entity.RemoveFlag2(Update.Flags2.FireAura); c.Entity.AddFlag2(Update.Flags2.EarthAura); PhoenixProject.Network.GamePackets.StatusIconData.AuraType tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; switch (spell.ID) { case 0x28b4: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MetalAura; break; case 0x28b5: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WoodAura; break; case 0x28b6: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WaterAura; break; case 0x28b7: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FireAura; break; case 0x28b8: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.EarthAura; break; case 0x2bc0: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MagicDefender; break; case 0x289b: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; break; case 0x28aa: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FendAura; break; } StatusIconData data2 = new StatusIconData { AuraLevel = spell.Level, AuraPower = spell.Power, AuraType2 = tyrantAura, Identifier = c.Entity.UID, Type = PhoenixProject.Network.GamePackets.StatusIconData.AuraDataTypes.Add }; c.Entity.Owner.Send((byte[])data2); } } } } } if (!attacked.Owner.AlternateEquipment) { attacked.Owner.LoadItemStats(attacked.Owner.Entity); } else { attacked.Owner.LoadItemStats2(attacked.Owner.Entity); } SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; attacker.Owner.SendScreen(suse, true); attacked.AuraStamp = Time32.Now; attacked.AuraTime = 20; attacked.EarthResistance += 30; attacked.RemoveFlag2(Update.Flags2.TyrantAura); attacked.RemoveFlag2(Update.Flags2.FendAura); attacked.RemoveFlag2(Update.Flags2.MetalAura); attacked.RemoveFlag2(Update.Flags2.WoodAura); attacked.RemoveFlag2(Update.Flags2.WaterAura); attacked.RemoveFlag2(Update.Flags2.FireAura); attacked.AddFlag2(Update.Flags2.EarthAura); PhoenixProject.Network.GamePackets.StatusIconData.AuraType tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; switch (spell.ID) { case 0x28b4: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MetalAura; break; case 0x28b5: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WoodAura; break; case 0x28b6: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WaterAura; break; case 0x28b7: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FireAura; break; case 0x28b8: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.EarthAura; break; case 0x2bc0: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MagicDefender; break; case 0x289b: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; break; case 0x28aa: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FendAura; break; } StatusIconData data = new StatusIconData { AuraLevel = spell.Level, AuraPower = spell.Power, AuraType2 = tyrantAura2, Identifier = attacker.UID, Type = PhoenixProject.Network.GamePackets.StatusIconData.AuraDataTypes.Add }; attacker.Owner.Send((byte[])data); //Update ud = new Update(true); } ///ud.Aura(attacked, attacked.EarthResistance, spell.Level, (byte)spell.Duration); break; } case 10423: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); if (attacker.Owner.Team != null) { foreach (Client.GameState c in attacker.Owner.Team.Teammates) { if (c.Entity.MapID == attacker.MapID) { short distance = Kernel.GetDistance(c.Entity.X, c.Entity.Y, attacker.X, attacker.Y); if (distance < ServerBase.Constants.pScreenDistance) { if (c.Entity.UID != attacker.UID) { if (!c.AlternateEquipment) { c.LoadItemStats(c.Entity); } else { c.LoadItemStats2(c.Entity); } c.Entity.AuraStamp = Time32.Now; c.Entity.AuraTime = 20; c.Entity.FireResistance += 30; c.Entity.RemoveFlag2(Update.Flags2.TyrantAura); c.Entity.RemoveFlag2(Update.Flags2.FendAura); c.Entity.RemoveFlag2(Update.Flags2.MetalAura); c.Entity.RemoveFlag2(Update.Flags2.WoodAura); c.Entity.RemoveFlag2(Update.Flags2.WaterAura); c.Entity.RemoveFlag2(Update.Flags2.EarthAura); c.Entity.AddFlag2(Update.Flags2.FireAura); PhoenixProject.Network.GamePackets.StatusIconData.AuraType tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; switch (spell.ID) { case 0x28b4: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MetalAura; break; case 0x28b5: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WoodAura; break; case 0x28b6: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WaterAura; break; case 0x28b7: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FireAura; break; case 0x28b8: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.EarthAura; break; case 0x2bc0: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MagicDefender; break; case 0x289b: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; break; case 0x28aa: tyrantAura2 = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FendAura; break; } StatusIconData data2 = new StatusIconData { AuraLevel = spell.Level, AuraPower = spell.Power, AuraType2 = tyrantAura2, Identifier = c.Entity.UID, Type = PhoenixProject.Network.GamePackets.StatusIconData.AuraDataTypes.Add }; c.Entity.Owner.Send((byte[])data2); } } } } } if (!attacked.Owner.AlternateEquipment) { attacked.Owner.LoadItemStats(attacked.Owner.Entity); } else { attacked.Owner.LoadItemStats2(attacked.Owner.Entity); } SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; attacker.Owner.SendScreen(suse, true); attacked.AuraStamp = Time32.Now; attacked.AuraTime = 20; attacked.FireResistance += 30; attacked.RemoveFlag2(Update.Flags2.TyrantAura); attacked.RemoveFlag2(Update.Flags2.FendAura); attacked.RemoveFlag2(Update.Flags2.MetalAura); attacked.RemoveFlag2(Update.Flags2.WoodAura); attacked.RemoveFlag2(Update.Flags2.WaterAura); attacked.RemoveFlag2(Update.Flags2.EarthAura); attacked.AddFlag2(Update.Flags2.FireAura); PhoenixProject.Network.GamePackets.StatusIconData.AuraType tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; switch (spell.ID) { case 0x28b4: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MetalAura; break; case 0x28b5: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WoodAura; break; case 0x28b6: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.WaterAura; break; case 0x28b7: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FireAura; break; case 0x28b8: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.EarthAura; break; case 0x2bc0: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.MagicDefender; break; case 0x289b: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.TyrantAura; break; case 0x28aa: tyrantAura = PhoenixProject.Network.GamePackets.StatusIconData.AuraType.FendAura; break; } StatusIconData data = new StatusIconData { AuraLevel = spell.Level, AuraPower = spell.Power, AuraType2 = tyrantAura, Identifier = attacker.UID, Type = PhoenixProject.Network.GamePackets.StatusIconData.AuraDataTypes.Add }; attacker.Owner.Send((byte[])data); } // Update ud = new Update(true); // ud.Aura(attacked, attacked.FireResistance, spell.Level, (byte)spell.Duration); break; } case 10430: { if (CanUseSpell(spell, attacker.Owner)) { SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = spell.Level; suse.X = X; suse.Y = Y; if (attacker.Owner.Team != null) { PrepareSpell(spell, attacker.Owner); foreach (Client.GameState teammate in attacker.Owner.Team.Teammates) { if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, teammate.Entity.X, teammate.Entity.Y) <= spell.Distance) { attacker.RemoveFlag(Update.Flags.Poisoned); suse.Targets.Add(teammate.Entity.UID, 1); } } if (attacked.EntityFlag == EntityFlag.Player) attacked.Owner.SendScreen(suse, true); else attacked.MonsterInfo.SendScreen(suse); } else { if (attacked == null) return; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance) { PrepareSpell(spell, attacker.Owner); attacker.RemoveFlag(Update.Flags.Poisoned); suse.Targets.Add(attacked.UID, 1); if (attacked.EntityFlag == EntityFlag.Player) attacked.Owner.SendScreen(suse, true); else attacked.MonsterInfo.SendScreen(suse); } else { attacker.AttackPacket = null; } } } attacker.AttackPacket = null; break; } //Serenity case 10400: { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); if (attacker == null) return; SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = SpellID; suse.SpellLevel = attacker.Owner.Spells[SpellID].Level; suse.X = X; suse.Y = Y; suse.Targets.Add(attacker.UID, 1); attacker.ToxicFogLeft = 0; attacker.NoDrugsTime = 0; attacker.RemoveFlag2(Update.Flags2.SoulShackle); SyncPacket packet3 = new SyncPacket { Identifier = attacked.UID, Count = 2, Type = PhoenixProject.Network.GamePackets.SyncPacket.SyncType.StatusFlag, StatusFlag1 = (ulong)attacked.StatusFlag, StatusFlag2 = (ulong)attacked.StatusFlag2, Unknown1 = 0x36, StatusFlagOffset = 0x6f, Time = 0, Value = 0, Level = spell.Level }; attacked.Owner.Send((byte[])packet3); attacker.Owner.SendScreen(suse, true); } attacker.AttackPacket = null; break; } //Tranquility case 10425: { if (attacked == null) return; if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); if (attacked == null) return; SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = SpellID; suse.SpellLevel = attacker.Owner.Spells[SpellID].Level; suse.X = X; suse.Y = Y; suse.Targets.Add(attacked.UID, 1); attacked.ToxicFogLeft = 0; attacked.ShackleTime = 0; attacked.NoDrugsTime = 0; attacked.RemoveFlag2(Update.Flags2.SoulShackle); if (attacked.EntityFlag == EntityFlag.Player) { SyncPacket packet3 = new SyncPacket { Identifier = attacked.UID, Count = 2, Type = PhoenixProject.Network.GamePackets.SyncPacket.SyncType.StatusFlag, StatusFlag1 = (ulong)attacked.StatusFlag, StatusFlag2 = (ulong)attacked.StatusFlag2, Unknown1 = 0x36, StatusFlagOffset = 0x6f, Time = 0, Value = 0, Level = spell.Level }; attacked.Owner.Send((byte[])packet3); } if (attacked.EntityFlag == EntityFlag.Player) attacked.Owner.SendScreen(suse, true); else attacked.MonsterInfo.SendScreen(suse); } attacker.AttackPacket = null; break; } //WhirlwindKick case 10415: { if (Time32.Now < attacker.WhilrwindKick.AddMilliseconds(1200)) { attacker.AttackPacket = null; return; } attacker.WhilrwindKick = Time32.Now; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= 3) { if (CanUseSpell(spell, attacker.Owner)) { PrepareSpell(spell, attacker.Owner); SpellUse suse = new SpellUse(true); suse.Attacker = attacker.UID; suse.SpellID = spell.ID; suse.SpellLevel = 0; suse.X = (ushort)ServerBase.Kernel.Random.Next(3, 10); suse.Y = 0; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= 3) { for (int c = 0; c < attacker.Owner.Screen.Objects.Count; c++) { //For a multi threaded application, while we go through the collection //the collection might change. We will make sure that we wont go off //the limits with a check. if (c >= attacker.Owner.Screen.Objects.Count) break; Interfaces.IMapObject _obj = attacker.Owner.Screen.Objects[c]; if (_obj == null) continue; if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player) { attacked = _obj as Entity; if (ServerBase.Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range) { if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Ranged)) { uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack); suse.Effect1 = attack.Effect1; ReceiveAttack(attacker, attacked, attack, damage, spell); attacked.Stunned = true; attacked.StunStamp = Time32.Now; suse.Targets.Add(attacked.UID, damage); } } } } attacker.AttackPacket = null; } else { attacker.AttackPacket = null; return; } attacker.Owner.SendScreen(suse, true); suse.Targets = new SafeDictionary<uint, SpellUse.DamageClass>(); attacker.AttackPacket = null; return; } attacker.AttackPacket = null; } attacker.AttackPacket = null; return; } #endregion default: if (attacker.Owner.Account.State == PhoenixProject.Database.AccountTable.AccountState.ProjectManager) attacker.Owner.Send(new Message("Unknown spell id: " + spell.ID, System.Drawing.Color.CadetBlue, Message.Talk)); break; } if (spell.CanKill == 0) { attacker.Owner.IncreaseSpellExperience(80, spellID); } // attacker.Owner.IncreaseSpellExperience(Experience, spellID);//kimo if (attacker.MapID == 1039) { if (spell.ID == 7001 || spell.ID == 9876) { attacker.AttackPacket = null; return; } if (attacker.AttackPacket != null) { attack.Damage = spell.ID; attacker.AttackPacket = attack; if (Database.SpellTable.WeaponSpells.ContainsValue(spell.ID)) { if (attacker.AttackPacket == null) { attack.AttackType = Attack.Melee; attacker.AttackPacket = attack; } else { attacker.AttackPacket.AttackType = Attack.Melee; } } } } else { if (spell.NextSpellID != 0) { if (spell.NextSpellID >= 1000 && spell.NextSpellID <= 1002) if (Target >= 1000000) { attacker.AttackPacket = null; return; } attack.Damage = spell.NextSpellID; attacker.AttackPacket = attack; } else { if (!Database.SpellTable.WeaponSpells.ContainsValue(spell.ID) || spell.ID == 9876) attacker.AttackPacket = null; else { if (attacker.AttackPacket == null) { attack.AttackType = Attack.Melee; attacker.AttackPacket = attack; } else { attacker.AttackPacket.AttackType = Attack.Melee; } } } } } else { attacker.AttackPacket = null; } } #endregion } #endregion } #endregion } }