/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Drop System Base /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void SkillDrop(obj o, character c, string type) { try { world_item sitem = new world_item(); switch (type) { case "mask": sitem.Model = 10364; sitem.Ids = new Global.ID(Global.ID.IDS.World); sitem.UniqueID = sitem.Ids.GetUniqueID; sitem.PlusValue = 0; sitem.x = this.x + rnd.Next(0, 7); sitem.z = this.z; sitem.y = this.y + rnd.Next(0, 6); sitem.xSec = this.xSec; sitem.ySec = this.ySec; sitem.Type = 3; sitem.fromType = 5; sitem.downType = true; sitem.fromOwner = this.UniqueID; sitem.Owner = ((Systems)this.GetTarget()).Character.Account.ID; Systems.aRound(ref sitem.x, ref sitem.y, 0); Systems.WorldItem.Add(sitem); sitem.Send(Packet.ObjectSpawn(sitem), true); break; } } catch (Exception ex) { Console.WriteLine("Skill drop error {0}", ex); Systems.Debugger.Write(ex); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Forgotten world base entrance /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void ForgottenWorld(int itemid) { try { //Spawn portal obj o = new obj(); double x = Character.Position.x; double z = Character.Position.z; double y = Character.Position.y; o.Ids = new Global.ID(Global.ID.IDS.Object); o.UniqueID = o.Ids.GetUniqueID; o.xSec = Character.Position.xSec; o.ySec = Character.Position.ySec; o.x = (o.xSec - 135) * 192 + (x) / 10; o.z = z; o.y = (o.ySec - 92) * 192 + (y) / 10; client.Send(Packet.SpawnPortal(o, Character, itemid)); } catch (Exception ex) { Console.WriteLine("Portal spawn error : {0}", ex); Systems.Debugger.Write(ex); } }
private obj getMob(int id, List <string> param) { short AREA = short.Parse(param[1]); float x = Convert.ToInt32(param[2]); float z = Convert.ToInt32(param[3]); float y = Convert.ToInt32(param[4]); obj o = new obj(); o.AutoMovement = true; o.LocalType = Data.ObjectBase[id].Type; o.OrgMovement = o.AutoMovement; o.StartRunTimer(Global.RandomID.GetRandom(5000, 8000)); o.ID = id; o.Ids = new Global.ID(Global.ID.IDS.Object); o.UniqueID = o.Ids.GetUniqueID; o.xSec = Convert.ToByte((AREA).ToString("X4").Substring(2, 2), 16); o.ySec = Convert.ToByte((AREA).ToString("X4").Substring(0, 2), 16); o.x = (o.xSec - 135) * 192 + (x) / 10; o.z = z; o.y = (o.ySec - 92) * 192 + (y) / 10; o.oX = o.x; o.oY = o.y; Systems.aRound(ref o.oX, ref o.oY, 9); o.State = 1; o.Move = 1; o.AutoSpawn = true; o.State = 2; o.HP = Data.ObjectBase[id].HP; o.Kat = 1; o.Agro = new List <_agro>(); o.SpeedWalk = Data.ObjectBase[o.ID].SpeedWalk; o.SpeedRun = Data.ObjectBase[o.ID].SpeedRun; o.SpeedZerk = Data.ObjectBase[o.ID].SpeedZerk; o.oldAgresif = o.Agresif; if (o.Type == 1) { o.Agresif = 1; } //if (o.Type == 0) o.Agresif = 0; o.spawnOran = 20; if (id == 1979 || id == 2101 || id == 2124 || id == 2111 || id == 2112) { o.AutoMovement = false; } o.OrgMovement = o.AutoMovement; if (o.AutoMovement) { o.StartRunTimer(Global.RandomID.GetRandom(5000, 8000)); } o.Type = Systems.RandomType(Data.ObjectBase[id].Level, ref o.Kat, false, ref o.Agresif); o.HP *= o.Kat; if (o.Type == 1) { o.Agresif = 1; } return(o); }
private void spawnMob(List <string> parameters) { obj o = this.getMob(Int32.Parse(parameters[0]), parameters); Systems.Objects.Add(o); o.SpawnMe(); }
public static double gamedistance(obj p1, DarkEmu_GameServer.character._pos p2) { // Nukei: for test with range checking on objects, maybe faster than only calculating distance if ((p1.xSec >= p2.xSec - 1) && (p1.xSec <= p2.xSec + 1) && (p1.ySec >= p2.ySec - 1) && (p1.ySec <= p2.ySec + 1)) { return(gamedistance((float)p1.x, (float)p1.y, p2.x, p2.y)); } else { return(99999999999999); } }
public static void AddObject(obj o) { switch (o.ID) { case 1954: TigerGirl.Add(o); break; case 1982: Urichi.Add(o); break; case 2002: Isytaru.Add(o); break; case 3810: LordYarkan.Add(o); break; case 3875: DemonShaitan.Add(o); break; case 3877: Roc.Add(o); break; case 5871: Cerberus.Add(o); break; case 14778: CapIvy.Add(o); break; case 14839: Medusa.Add(o); break; case 32768: Neith.Add(o); break; case 32752: Sphinx.Add(o); break; case 32770: Isis.Add(o); break; } }
/* * public static void StartEffectDamage(int intval, int HitPower, byte e_index, object target) * { * try * { * if (target.sys.Character.Action.DeBuff.Effect.EffectImpactTimer[e_index] != null) target.sys.Character.Action.DeBuff.Effect.EffectImpactTimer[e_index].Dispose(); * * target.sys.Character.Action.DeBuff.Effect.EffectImpactTimer[e_index] = new Timer( * new TimerCallback( * delegate(object e) * { * if (target.type == true) // player * { * if (!target.sys.Character.State.Die) * { * target.HP(HitPower); * target.sys.Send(Packet.Effects2Dmg(target.sys.Character.Information.UniqueID, HitPower)); * } * else return; * } * else if (target.type == false) // mob * { * if (!target.os.Die) * { * target.HP(HitPower); * target.os.Send(Packet.Effects2Dmg(target.ID, HitPower)); * } * else return; * } * } * ), null, 0, intval); * } * catch (Exception ex) * { * deBug.Write(ex); * Console.WriteLine("StartEffectDamage() Error {0}", ex); * } * } */ /////////////////////////////////////////////////////////////////////////// // Shock state /////////////////////////////////////////////////////////////////////////// public static void GenerateEffect_es(object target, int skillid) { // Get effects parameters int Power = Data.SkillBase[skillid].Properties1["es"]; int Probability = Data.SkillBase[skillid].Properties2["es"]; int Random = Seed.Next(1, 100); byte slot; // if effect succeeded if (Random <= Probability) { if (target.GetType().ToString() == "DarkEmu_GameServer.Systems") // player { Systems sys = target as Systems; if (sys.Character.State.Die == true) { return; } slot = sys.DeBuffGetFreeSlot(); sys.Character.Action.DeBuff.Effect.EffectID[slot] = EffectNumbers.SHOCKED; sys.Character.Action.DeBuff.Effect.SkillID[slot] = skillid; sys.StartEffectTimer(Power * 100, slot); sys.Send(Packet.EffectUpdate(sys.Character.Information.UniqueID, EffectNumbers.SHOCKED, true)); // Timer for burn state } else if (target.GetType().ToString() == "DarkEmu_GameServer.obj") // mob { obj os = target as obj; if (os.Die == true) { return; } slot = os.DeBuffGetFreeSlot(); os.DeBuff.Effect.EffectID[slot] = EffectNumbers.SHOCKED; os.DeBuff.Effect.SkillID[slot] = skillid; os.StartEffectTimer(Power * 100, slot); os.Send(Packet.EffectUpdate(os.UniqueID, EffectNumbers.SHOCKED, true)); // Burn timer // Add (character details). } } }
/////////////////////////////////////////////////////////////////////////// // Remove frostbite /////////////////////////////////////////////////////////////////////////// public static void DeleteEffect_fb(object target, byte EffectSlot) { try { if (target.GetType().ToString() == "DarkEmu_GameServer.Systems") // player { Systems sys = target as Systems; sys.Send(Packet.EffectUpdate(sys.Character.Information.UniqueID, sys.Character.Action.DeBuff.Effect.EffectID[EffectSlot], false)); sys.Character.Action.DeBuff.Effect.EffectID[EffectSlot] = 0; sys.Character.Action.DeBuff.Effect.SkillID[EffectSlot] = 0; sys.Character.Speed.AttackSpeedModifier = 1; sys.Character.Speed.RunSpeed *= 2; sys.Character.Speed.WalkSpeed *= 2; sys.Character.Speed.BerserkSpeed *= 2; sys.Send(Packet.SetSpeed(sys.Character.Information.UniqueID, sys.Character.Speed.WalkSpeed, sys.Character.Speed.RunSpeed)); } else if (target.GetType().ToString() == "DarkEmu_GameServer.obj") // mob { obj os = target as obj; os.Send(Packet.EffectUpdate(os.UniqueID, os.DeBuff.Effect.EffectID[EffectSlot], false)); os.DeBuff.Effect.EffectID[EffectSlot] = 0; os.DeBuff.Effect.SkillID[EffectSlot] = 0; // attack speed os.AttackSpeed = 1; // movement speed os.SpeedRun *= 2; os.SpeedWalk *= 2; //Set bool to false again os.Frostbite = false; os.Send(Packet.SetSpeed(os.UniqueID, os.SpeedWalk, os.SpeedRun)); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
void SelectObject() { try { if (Character.Information.Scroll) { return; } PacketReader Reader = new PacketReader(PacketInformation.buffer); int objectid = Reader.Int32(); if (objectid == 0) { return; } //if (Character.Position.Walking) StopPlayerMovementO(objectid); if (objectid == Character.Information.UniqueID && Character.State.Die) { Player_Up(); return; } obj o = GetObject(objectid); if (o != null) { byte[] bb = DarkEmu_GameServer.Packet.SelectObject(objectid, o.ID, o.LocalType, o.HP); if (bb == null) { return; } client.Send(bb); return; } Systems sys = GetPlayers(objectid); if (o == null && sys != null) { client.Send(DarkEmu_GameServer.Packet.SelectObject(objectid, 0, 5, sys.Character.Stat.Hp)); return; } Reader.Close(); } catch (Exception ex) { Console.WriteLine("Selectobject error: {0}", ex); } }
public static void ISY(object e) { try { if (!Isy) { obj o = Isytaru[rnd.Next(0, Isytaru.Count - 1)]; Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); Isy = true; Console.WriteLine("Isytaru spawn warp location : {0}{1}, {2}, {3}", o.xSec, o.ySec, o.x, o.y); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
public static void LORD(object e) { try { if (!Lord) { obj o = LordYarkan[rnd.Next(0, LordYarkan.Count - 1)]; Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); Lord = true; Console.WriteLine("Lord yarkan spawn warp location : {0}{1}, {2}, {3}", o.xSec, o.ySec, o.x, o.y); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
public static void IVY(object e) { try { if (!Ivy) { obj o = CapIvy[rnd.Next(0, CapIvy.Count)]; Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); Ivy = true; Console.WriteLine("Captain ivy spawn warp location : {0}{1}, {2}, {3}", o.xSec, o.ySec, o.x, o.y); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
public static void URI(object e) { try { if (!Uri) { obj o = Urichi[rnd.Next(0, Urichi.Count - 1)]; Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); Uri = true; Console.WriteLine("Urichi spawn warp location : {0}{1}, {2}, {3}", o.xSec, o.ySec, o.x, o.y); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
public static void MEDUSA_CB(object e) { try { if (!Medusa_s) { obj o = Medusa[rnd.Next(0, Medusa.Count - 1)]; Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); Medusa_s = true; Console.WriteLine("Medusa spawn warp location : {0}{1}, {2}, {3}", o.xSec, o.ySec, o.x, o.y); } } catch (Exception ex) { Console.WriteLine("Medusa spawn error {0}", ex); } }
public static void DEMON(object e) { try { if (!Demon) { obj o = DemonShaitan[rnd.Next(0, DemonShaitan.Count - 1)]; Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); Demon = true; Console.WriteLine("Demon Shaitan spawn warp location : {0}{1}, {2}, {3}", o.xSec, o.ySec, o.x, o.y); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
public static void TG(object e) { try { if (!Tiger) { obj o = TigerGirl[rnd.Next(0, TigerGirl.Count - 1)]; Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); Tiger = true; Console.WriteLine("Tiger girl spawn warp location : {0}{1}, {2}, {3}", o.xSec, o.ySec, o.x, o.y); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
public static void ROC_CB(object e) { try { if (!Roc_s) { obj o = Roc[rnd.Next(0, Roc.Count)]; Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); Roc_s = true; Console.WriteLine("Roc spawn warp location : {0}{1}, {2}, {3}", o.xSec, o.ySec, o.x, o.y); } } catch (Exception ex) { Console.WriteLine("Roc spawn error {0}", ex); } }
public static void CERB(object e) { try { if (!Cerb) { obj o = Cerberus[rnd.Next(0, Cerberus.Count - 1)]; Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); Cerb = true; Console.WriteLine("Cerberus spawn warp location : {0}{1}, {2}, {3}", o.xSec, o.ySec, o.x, o.y); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
object GetObjects(int id) { try { obj o = GetObject(id); if (o != null) { return(o); } Systems sys = GetPlayers(id); if (sys != null) { return(sys); } } catch (Exception ex) { Systems.Debugger.Write(ex); } return(null); }
private void SpawnUnique(List <string> parameters) { obj o = new obj(); switch ((Uniques)Int32.Parse(parameters[0])) { case Uniques.TigerGirl: // INSERT SPAWN CODE HERE o = getMob(1954, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.Urichi: o = getMob(1982, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.Isyutaru: o = getMob(2002, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.LordYarkan: o = getMob(3810, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.DemonShaitan: o = getMob(3875, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.Cerberus: o = getMob(5871, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.CapIvy: o = getMob(14778, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.Medusa: o = getMob(14839, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.Roc: o = getMob(3877, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.Neith: o = getMob(32768, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.Isis: o = getMob(32770, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.Sphinx: o = getMob(32752, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Monster Summon Scrolls /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void HandleSummon(int scrollid) { try { //if (this.Character.Information.Level < 10) return; int count = 1;//Default should be set to 1 //single scroll if (scrollid == 3936) { count = 5; } //party scroll if (scrollid == 3935) { if (this.Character.Network.Party == null) { return; } if (this.Character.Network.Party.Members.Count < 5) { return; } count = this.Character.Network.Party.Members.Count; } int model = GetStrongMobByLevel(this.Character.Information.Level); byte type = Data.ObjectBase[model].ObjectType; for (int i = 1; i <= count; i++) { obj Spawn = new obj(); Spawn.ID = model; Spawn.Type = type; Spawn.Ids = new Global.ID(Global.ID.IDS.Object); Spawn.UniqueID = Spawn.Ids.GetUniqueID; Spawn.x = Character.Position.x; Spawn.z = Character.Position.z; Spawn.y = Character.Position.y; Spawn.oX = Spawn.x; Spawn.oY = Spawn.y; Spawn.xSec = Character.Position.xSec; Spawn.ySec = Character.Position.ySec; Spawn.AutoMovement = true; Spawn.State = 1; Spawn.Move = 1; Spawn.SpeedWalk = Data.ObjectBase[Spawn.ID].SpeedWalk; Spawn.SpeedRun = Data.ObjectBase[Spawn.ID].SpeedRun; Spawn.SpeedZerk = Data.ObjectBase[Spawn.ID].SpeedZerk; Spawn.HP = Data.ObjectBase[model].HP; Spawn.Agresif = Data.ObjectBase[model].Agresif; Spawn.LocalType = 1; Spawn.AutoSpawn = false; Spawn.Kat = 1; Systems.aRound(ref Spawn.x, ref Spawn.y, 1); Systems.Objects.Add(Spawn); Spawn.SpawnMe(); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
public static void ClearObject(obj o) { character n = new character(); try { switch (o.ID) { case 1954: Systems.SendAll(Packet.Unique_Data(6, (int)1954, n.Information.Name)); Tiger = false; DarkEmu_GameServer.GlobalUnique.StartTGUnique(rnd.Next(10, 20) * 60000, 600); //Random spawn tiger girl break; case 1982: Systems.SendAll(Packet.Unique_Data(6, (int)1982, n.Information.Name)); Uri = false; DarkEmu_GameServer.GlobalUnique.StartUriUnique(rnd.Next(10, 20) * 60000, 600); //Random spawn urichi break; case 2002: Systems.SendAll(Packet.Unique_Data(6, (int)2002, n.Information.Name)); Isy = false; DarkEmu_GameServer.GlobalUnique.StartIsyUnique(rnd.Next(10, 20) * 60000, 600); //Random spawn isy break; case 3810: Systems.SendAll(Packet.Unique_Data(6, (int)3810, n.Information.Name)); Lord = false; DarkEmu_GameServer.GlobalUnique.StartLordUnique(rnd.Next(10, 20) * 60000, 600); //Random spawn lord yarkan break; case 3875: Systems.SendAll(Packet.Unique_Data(6, (int)3875, n.Information.Name)); Demon = false; DarkEmu_GameServer.GlobalUnique.StartDemonUnique(rnd.Next(10, 20) * 60000, 600); //Random spawn demon shaitan break; case 3877: Systems.SendAll(Packet.Unique_Data(6, (int)3877, n.Information.Name)); Roc_s = false; DarkEmu_GameServer.GlobalUnique.StartRoc(rnd.Next(10, 20) * 60000, 600); //Random spawn roc break; case 5871: Systems.SendAll(Packet.Unique_Data(6, (int)5871, n.Information.Name)); Cerb = false; DarkEmu_GameServer.GlobalUnique.StartCerbUnique(rnd.Next(10, 20) * 60000, 600); //Random spawn cerberus break; case 14778: Systems.SendAll(Packet.Unique_Data(6, (int)14538, n.Information.Name)); Ivy = false; DarkEmu_GameServer.GlobalUnique.StartIvyUnique(rnd.Next(10, 20) * 60000, 600); //Random spawn captain ivy break; case 14839: Systems.SendAll(Packet.Unique_Data(6, (int)22654, n.Information.Name)); Cerb = false; DarkEmu_GameServer.GlobalUnique.StartMedusa(rnd.Next(10, 20) * 90000, 600); //Random spawn medusa break; case 32768: Systems.SendAll(Packet.Unique_Data(6, (int)32768, n.Information.Name)); Neith_s = false; DarkEmu_GameServer.GlobalUnique.StartNeith(rnd.Next(10, 20) * 90000, 600); //Random spawn neith break; case 32752: Systems.SendAll(Packet.Unique_Data(6, (int)32752, n.Information.Name)); Sphinx_s = false; DarkEmu_GameServer.GlobalUnique.StartSphinx(rnd.Next(10, 20) * 90000, 600); //Random spawn sphinx break; case 32770: Systems.SendAll(Packet.Unique_Data(6, (int)32770, n.Information.Name)); Isis_s = false; DarkEmu_GameServer.GlobalUnique.StartIsis(rnd.Next(10, 20) * 90000, 600); //Random spawn isis break; } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
/////////////////////////////////////////////////////////////////////////// public static byte[] SpawnPortal(obj o, character c, int itemid) { PacketWriter Writer = new PacketWriter(); Writer.Create(Systems.SERVER_SOLO_SPAWN); Writer.DWord(o.ID); Writer.DWord(o.UniqueID); Writer.Byte(o.xSec); Writer.Byte(o.ySec); Writer.Float(Formule.packetx((float)o.x, o.xSec)); Writer.Float(o.z); Writer.Float(Formule.packety((float)o.y, o.ySec)); Writer.Word(0); Writer.Byte(1); Writer.Byte(0); Writer.Byte(1); Writer.Byte(6); Writer.Text(c.Information.Name); Writer.DWord(itemid); Writer.Byte(1); return Writer.GetBytes(); }
private void SpawnUnique(List<string> parameters) { obj o = new obj(); switch ((Uniques)Int32.Parse(parameters[0])) { case Uniques.TigerGirl: // INSERT SPAWN CODE HERE o = getMob(1954, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.Urichi: o = getMob(1982, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.Isyutaru: o = getMob(2002, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.LordYarkan: o = getMob(3810, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.DemonShaitan: o = getMob(3875, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.Cerberus: o = getMob(5871, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.CapIvy: o = getMob(14778, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.Medusa: o = getMob(14839, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.Roc: o = getMob(3877, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.Neith: o = getMob(32768, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.Isis: o = getMob(32770, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; case Uniques.Sphinx: o = getMob(32752, parameters); Systems.Objects.Add(o); o.SpawnMe(); Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); break; } }
public static double gamedistance(obj p1, DarkEmu_GameServer.character._pos p2) { // Nukei: for test with range checking on objects, maybe faster than only calculating distance if ((p1.xSec >= p2.xSec - 1) && (p1.xSec <= p2.xSec + 1) && (p1.ySec >= p2.ySec - 1) && (p1.ySec <= p2.ySec + 1)) { return gamedistance((float)p1.x, (float)p1.y, p2.x, p2.y); } else { return 99999999999999; } }
void ActionNormalAttack() { try { float x = 0, y = 0; bool[] aRound = null; if (Character.Action.Object != null) { //Set target object as object obj TargetInformation = Character.Action.Object as obj; //If our target object is a monster #region Attacking a monster if (Data.ObjectBase[TargetInformation.ID].Object_type == Global.objectdata.NamdedType.MONSTER) { //If state is dead if (TargetInformation.State == 4) { //Set normal attack bool to false Character.Action.nAttack = false; //Stop attack timer StopAttackTimer(); } if (TargetInformation.Agro == null) { TargetInformation.Agro = new List <_agro>(); } x = (float)TargetInformation.x; y = (float)TargetInformation.y; if (!TargetInformation.Attacking) { TargetInformation.AddAgroDmg(Character.Information.UniqueID, 1); } if (TargetInformation.Die || TargetInformation.GetDie) { StopAttackTimer(); return; } } #endregion //If attacking a player #region Attacking a player if (Data.ObjectBase[TargetInformation.ID].Object_type == Global.objectdata.NamdedType.PLAYER) { if (!Character.Information.PvP) { Character.Action.nAttack = false; StopAttackTimer(); return; } Systems sys = Character.Action.Object as Systems; if (sys.Character.State.LastState == 4) { StopAttackTimer(); return; } if (!(Character.Information.PvP && sys.Character.Information.PvP)) { StopAttackTimer(); return; } if (!Character.InGame) { StopAttackTimer(); return; } x = sys.Character.Position.x; y = sys.Character.Position.y; aRound = sys.Character.aRound; } #endregion double distance = Formule.gamedistance(Character.Position.x, Character.Position.y, x, y); if (Character.Information.Item.wID == 0) { distance -= 0.5; } else { distance -= Data.ItemBase[Character.Information.Item.wID].ATTACK_DISTANCE; } if (distance > 0) { float farkx = x; float farky = y; if (Character.Information.Item.wID == 0) { Character.Position.wX = farkx - Character.Position.x - 0; Character.Position.wY = farky - Character.Position.y - 0; Character.Position.kX = Character.Position.wX; Character.Position.kY = Character.Position.wY; } else { Character.Position.wX = farkx - Character.Position.x - (float)Data.ItemBase[Character.Information.Item.wID].ATTACK_DISTANCE; Character.Position.wY = farky - Character.Position.y - (float)Data.ItemBase[Character.Information.Item.wID].ATTACK_DISTANCE; Character.Position.kX = Character.Position.wX; Character.Position.kY = Character.Position.wY; } Send(Packet.Movement(new DarkEmu_GameServer.Global.vektor(Character.Information.UniqueID, (float)Formule.packetx((float)farkx, Character.Position.xSec), (float)Character.Position.z, (float)Formule.packety((float)farky, Character.Position.ySec), Character.Position.xSec, Character.Position.ySec))); Character.Position.Time = (distance / (Character.Speed.RunSpeed * 0.0768)) * 1000.0; Character.Position.RecordedTime = Character.Position.Time; Character.Position.packetxSec = Character.Position.xSec; Character.Position.packetySec = Character.Position.ySec; Character.Position.packetX = (ushort)Formule.packetx((float)farkx, Character.Position.xSec); Character.Position.packetY = (ushort)Formule.packety((float)farky, Character.Position.ySec); Character.Position.Walking = true; StartMovementTimer((int)(Character.Position.Time * 0.1)); return; } } ActionAttack(); } catch (Exception ex) { Console.WriteLine("Normal Attack Error : {0}", ex); Systems.Debugger.Write(ex); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Spawn Monsters /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void GM_LOADMONSTER(int model, byte type, byte type2) { try { Framework.Ini ini; ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini"); string count = ini.GetValue("Custom", "GMSpawnCount", "1").ToString(); int total = Convert.ToInt16(count); for (int i = 1; i <= total; i++) { obj o = new obj(); o.ID = model; o.Type = type; o.Ids = new Global.ID(Global.ID.IDS.Object); o.UniqueID = o.Ids.GetUniqueID; o.x = Character.Position.x; o.z = Character.Position.z; o.y = Character.Position.y; o.oX = o.x; o.oY = o.y; o.xSec = Character.Position.xSec; o.ySec = Character.Position.ySec; o.AutoMovement = true; o.HP = Data.ObjectBase[model].HP; o.Agresif = Data.ObjectBase[model].Agresif; if (Data.ObjectBase[model].Type == 4) o.LocalType = 4; else if (Data.ObjectBase[model].Type == 1) o.LocalType = 1; else if (Data.ObjectBase[model].Type == 2) o.LocalType = 2; o.AutoSpawn = false; o.Kat = 1; o.SpeedWalk = Data.ObjectBase[o.ID].SpeedWalk; o.SpeedRun = Data.ObjectBase[o.ID].SpeedRun; o.SpeedZerk = Data.ObjectBase[o.ID].SpeedZerk; Systems.aRound(ref o.oX, ref o.oY, 5); Systems.Objects.Add(o); o.SpawnMe(); if (o.ID == 1954 || o.ID == 1982 || o.ID == 2002 || o.ID == 3810 || o.ID == 3875 || o.ID == 5871 || o.ID == 14538 || o.ID == 14839 || o.ID == 3877) Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); Framework.Ini ini2; ini2 = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini"); string spawnmessage = ini.GetValue("Custom", "EnableUniqueMessage", "0").ToString(); if (spawnmessage == "1") Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); } } catch (Exception ex) { Console.WriteLine(ex); } }
public void AddObject(obj o) { if(added % 10 == 0) this.StartData(); buff_data[added /10].DWord(o.ID); buff_data[added / 10].DWord(o.UniqueID); buff_data[added / 10].Byte(o.xSec); buff_data[added / 10].Byte(o.ySec); buff_data[added / 10].Float(Formule.packetx((float)o.x, o.xSec)); buff_data[added / 10].Float(o.z); buff_data[added / 10].Float(Formule.packety((float)o.y, o.ySec)); switch (o.LocalType) { case 0: buff_data[added / 10].Word(0); buff_data[added / 10].Word(1); buff_data[added / 10].Byte(o.xSec); buff_data[added / 10].Byte(o.ySec); if (!File.FileLoad.CheckCave(o.xSec, o.ySec)) { buff_data[added / 10].Word(Formule.packetx((float)(o.x + o.wx), o.xSec)); buff_data[added / 10].Word(o.z); buff_data[added / 10].Word(Formule.packety((float)(o.y + o.wy), o.ySec)); } else { if (o.x < 0) { buff_data[added / 10].Word(Formule.packetx((float)(o.x + o.wx), o.xSec)); buff_data[added / 10].Word(0xFFFF); } else { buff_data[added / 10].DWord(Formule.packetx((float)(o.x + o.wx), o.xSec)); } buff_data[added / 10].DWord(o.z); if (o.y < 0) { buff_data[added / 10].Word(Formule.packety((float)(o.y + o.wy), o.ySec)); buff_data[added / 10].Word(0xFFFF); } else { buff_data[added / 10].DWord(Formule.packety((float)(o.y + o.wy), o.ySec)); } } buff_data[added / 10].Byte(1); buff_data[added / 10].Byte(o.Walking == true ? 2 : 0); buff_data[added / 10].Byte(0); buff_data[added / 10].Float(o.SpeedWalk);// Walk speed buff_data[added / 10].Float(o.SpeedRun);// Run speed buff_data[added / 10].Float(o.SpeedZerk);// Berserk speed buff_data[added / 10].Byte(0); buff_data[added / 10].Byte(2); buff_data[added / 10].Byte(1); buff_data[added / 10].Byte(5); buff_data[added / 10].Byte(o.Type); break; case 1: buff_data[added / 10].Word(0); buff_data[added / 10].Byte(1); // has destination buff_data[added / 10].Byte(0); // walk flag buff_data[added / 10].Byte(o.xSec); buff_data[added / 10].Byte(o.ySec); if (!File.FileLoad.CheckCave(o.xSec, o.ySec)) { buff_data[added / 10].Word(Formule.packetx((float)(o.x + o.wx), o.xSec)); buff_data[added / 10].Word(o.z); buff_data[added / 10].Word(Formule.packety((float)(o.y + o.wy), o.ySec)); } else { if (o.x < 0) { buff_data[added / 10].Word(Formule.packetx((float)(o.x + o.wx), o.xSec)); buff_data[added / 10].Word(0xFFFF); } else { buff_data[added / 10].DWord(Formule.packetx((float)(o.x + o.wx), o.xSec)); } buff_data[added / 10].DWord(o.z); if (o.y < 0) { buff_data[added / 10].Word(Formule.packety((float)(o.y + o.wy), o.ySec)); buff_data[added / 10].Word(0xFFFF); } else { buff_data[added / 10].DWord(Formule.packety((float)(o.y + o.wy), o.ySec)); } } buff_data[added / 10].Byte(1); // 01: alive - 02: dead buff_data[added / 10].Byte(0); buff_data[added / 10].Byte(o.Walking == true ? 2 : 0); // movement flag buff_data[added / 10].Byte(0); buff_data[added / 10].Float(o.SpeedWalk);// Walk speed buff_data[added / 10].Float(o.SpeedRun);// Run speed buff_data[added / 10].Float(o.SpeedZerk);// Berserk speed buff_data[added / 10].Byte(0); // number of buffs later must be added buff_data[added / 10].Byte(2); buff_data[added / 10].Byte(1); buff_data[added / 10].Byte(5); buff_data[added / 10].Byte(o.Type); //buff_data.Byte(0); // fix mob spawn 740 break; case 2: // npc/shops buff_data[added / 10].Word(o.rotation); // Should be angle? yet not changing ingame.. buff_data[added / 10].Byte(0); buff_data[added / 10].Byte(1); buff_data[added / 10].Byte(0); buff_data[added / 10].Word(o.rotation); // Should be angle? yet not changing ingame.. buff_data[added / 10].Byte(1); buff_data[added / 10].Byte(0); buff_data[added / 10].Byte(0); buff_data[added / 10].Byte(0); buff_data[added / 10].DWord(0); buff_data[added / 10].DWord(0); buff_data[added / 10].Float(100); buff_data[added / 10].Byte(0);//##################################### buff_data[added / 10].Byte(2);// Npc fix 740 buff_data[added / 10].Byte(0);// //buff_data.Byte(0);//##################################### i dunno this sure we need to test it break; case 3: // teleporter buff_data[added / 10].Word(0); buff_data[added / 10].Byte(1); buff_data[added / 10].Byte(0); buff_data[added / 10].Byte(0); buff_data[added / 10].Byte(1); buff_data[added / 10].DWord(0); buff_data[added / 10].DWord(0); //buff_data.Byte(0);// teleporter fix 740 dunno :) lets try like this then // this if needed break; case 4: // Thiefs and trader spawns buff_data[added / 10].Word(0); buff_data[added / 10].Word(1); buff_data[added / 10].Byte(o.xSec); buff_data[added / 10].Byte(o.ySec); if (!File.FileLoad.CheckCave(o.xSec, o.ySec)) { buff_data[added / 10].Word(Formule.packetx((float)(o.x + o.wx), o.xSec)); buff_data[added / 10].Word(o.z); buff_data[added / 10].Word(Formule.packety((float)(o.y + o.wy), o.ySec)); } else { if (o.x < 0) { buff_data[added / 10].Word(Formule.packetx((float)(o.x + o.wx), o.xSec)); buff_data[added / 10].Word(0xFFFF); } else { buff_data[added / 10].DWord(Formule.packetx((float)(o.x + o.wx), o.xSec)); } buff_data[added / 10].DWord(o.z); if (o.y < 0) { buff_data[added / 10].Word(Formule.packety((float)(o.y + o.wy), o.ySec)); buff_data[added / 10].Word(0xFFFF); } else { buff_data[added / 10].DWord(Formule.packety((float)(o.y + o.wy), o.ySec)); } } buff_data[added / 10].Byte(1); buff_data[added / 10].Byte(o.Walking == true ? 2 : 0); buff_data[added / 10].Byte(0); buff_data[added / 10].Byte(0); buff_data[added / 10].Float(o.SpeedWalk);// Walk speed buff_data[added / 10].Float(o.SpeedRun);// Run speed buff_data[added / 10].Float(o.SpeedZerk);// Berserk speed buff_data[added / 10].Byte(0); buff_data[added / 10].Byte(2); buff_data[added / 10].Byte(1); buff_data[added / 10].Byte(5); buff_data[added / 10].Byte(0); buff_data[added / 10].Byte(0xE3); // Need to check what this is... //buff_data.Byte(1); break; case 5: // Static monster spawns buff_data[added / 10].Word(0); // angle buff_data[added / 10].Byte(1); buff_data[added / 10].Byte(0); // walk / run buff_data[added / 10].Byte(o.xSec); buff_data[added / 10].Byte(o.ySec); if (!File.FileLoad.CheckCave(o.xSec, o.ySec)) { buff_data[added / 10].Word(Formule.packetx((float)o.x, o.xSec)); buff_data[added / 10].Word(o.z); buff_data[added / 10].Word(Formule.packety((float)o.y, o.ySec)); } else { if (o.x < 0) { buff_data[added / 10].Word(Formule.packetx((float)o.x, o.xSec)); buff_data[added / 10].Word(0xFFFF); } else { buff_data[added / 10].DWord(Formule.packetx((float)o.x, o.xSec)); } buff_data[added / 10].DWord(o.z); if (o.y < 0) { buff_data[added / 10].Word(Formule.packety((float)o.y, o.ySec)); buff_data[added / 10].Word(0xFFFF); } else { buff_data[added / 10].DWord(Formule.packety((float)o.y, o.ySec)); } } buff_data[added / 10].Byte(1); buff_data[added / 10].Byte(0); buff_data[added / 10].Byte(0); buff_data[added / 10].Byte(0); buff_data[added / 10].Float(0); // Walk speed buff_data[added / 10].Float(0); // Run speed buff_data[added / 10].Float(100); // Berserk speed buff_data[added / 10].Byte(0); buff_data[added / 10].Byte(2); buff_data[added / 10].Byte(1); buff_data[added / 10].Byte(5); buff_data[added / 10].Byte(o.Type); //buff_data.Byte(0); o.LocalType = 1; //fix for static flowers,ishades reverts back to type for when selected break; default: break; } added++; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Spawn & Kill /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void GM_ZOE(int model, byte count) { try { for (int x = 0; x < count; x++) { // spawn obj o = new obj(); o.ID = model; o.Type = 3; o.Ids = new Global.ID(Global.ID.IDS.Object); o.UniqueID = o.Ids.GetUniqueID; o.x = Character.Position.x; o.z = Character.Position.z; o.y = Character.Position.y; o.oX = o.x; o.oY = o.y; o.xSec = Character.Position.xSec; o.ySec = Character.Position.ySec; o.AutoMovement = false; o.HP = Data.ObjectBase[model].HP; o.Agresif = Data.ObjectBase[model].Agresif; if (Data.ObjectBase[model].Type == 4) o.LocalType = 4; else if (Data.ObjectBase[model].Type == 1) o.LocalType = 1; else if (Data.ObjectBase[model].Type == 2) o.LocalType = 2; o.AutoSpawn = false; o.Kat = 1; o.SpeedWalk = Data.ObjectBase[o.ID].SpeedWalk; o.SpeedRun = Data.ObjectBase[o.ID].SpeedRun; o.SpeedZerk = Data.ObjectBase[o.ID].SpeedZerk; Systems.aRound(ref o.oX, ref o.oY, 5); Systems.Objects.Add(o); o.SpawnMe(); o.AddAgroDmg(Character.Information.UniqueID, o.HP); if (o.ID == 1954 || o.ID == 1982 || o.ID == 2002 || o.ID == 3810 || o.ID == 3875 || o.ID == 5871 || o.ID == 14538 || o.ID == 14839 || o.ID == 3877) Systems.SendAll(Packet.Unique_Data(5, (int)o.ID, null)); // kill obj o2 = GetObject(o.UniqueID); o2.HP = 0; o2.GetDie = true; o2.SetExperience(); o2.MonsterDrop(); o2.StartDeadTimer(100); if (o2.ID == 1954 || o2.ID == 1982 || o2.ID == 2002 || o2.ID == 3810 || o2.ID == 3875 || o2.ID == 5871 || o2.ID == 14538) Systems.SendAll(Packet.Unique_Data(6, (int)o2.ID, Character.Information.Name)); } } catch (Exception ex) { Console.WriteLine("[ZOE] Error : " + ex.Message); Systems.Debugger.Write(ex); } }
private obj getMob(int id, List<string> param) { short AREA = short.Parse(param[1]); float x = Convert.ToInt32(param[2]); float z = Convert.ToInt32(param[3]); float y = Convert.ToInt32(param[4]); obj o = new obj(); o.AutoMovement = true; o.LocalType = Data.ObjectBase[id].Type; o.OrgMovement = o.AutoMovement; o.StartRunTimer(Global.RandomID.GetRandom(5000, 8000)); o.ID = id; o.Ids = new Global.ID(Global.ID.IDS.Object); o.UniqueID = o.Ids.GetUniqueID; o.xSec = Convert.ToByte((AREA).ToString("X4").Substring(2, 2), 16); o.ySec = Convert.ToByte((AREA).ToString("X4").Substring(0, 2), 16); o.x = (o.xSec - 135) * 192 + (x) / 10; o.z = z; o.y = (o.ySec - 92) * 192 + (y) / 10; o.oX = o.x; o.oY = o.y; Systems.aRound(ref o.oX, ref o.oY, 9); o.State = 1; o.Move = 1; o.AutoSpawn = true; o.State = 2; o.HP = Data.ObjectBase[id].HP; o.Kat = 1; o.Agro = new List<_agro>(); o.SpeedWalk = Data.ObjectBase[o.ID].SpeedWalk; o.SpeedRun = Data.ObjectBase[o.ID].SpeedRun; o.SpeedZerk = Data.ObjectBase[o.ID].SpeedZerk; o.oldAgresif = o.Agresif; if (o.Type == 1) o.Agresif = 1; //if (o.Type == 0) o.Agresif = 0; o.spawnOran = 20; if (id == 1979 || id == 2101 || id == 2124 || id == 2111 || id == 2112) o.AutoMovement = false; o.OrgMovement = o.AutoMovement; if (o.AutoMovement) o.StartRunTimer(Global.RandomID.GetRandom(5000, 8000)); o.Type = Systems.RandomType(Data.ObjectBase[id].Level, ref o.Kat, false, ref o.Agresif); o.HP *= o.Kat; if (o.Type == 1) o.Agresif = 1; return o; }
///////////////////////////////////////////////////////////////////////////////// // Save return point ///////////////////////////////////////////////////////////////////////////////// #region Save return point protected void SavePlace() { //Wrap our function inside a catcher try { //Open our packet reader PacketReader reader = new PacketReader(PacketInformation.buffer); int ObjectID = reader.Int32(); //Get object information obj o = GetObject(ObjectID); //Defaul value for type byte type = 0; //Switch by object name switch (Data.ObjectBase[o.ID].Name) { case "STORE_CH_GATE": type = 1; break; case "STORE_WC_GATE": type = 2; break; case "STORE_KT_GATE": type = 5; break; case "STORE_EU_GATE": type = 20; break; case "STORE_CA_GATE": type = 25; break; case "STORE_SD_GATE1": type = 175; break; case "STORE_SD_GATE2": type = 176; break; case "STORE_EU_TO_JUPITER_FIELD_GATE": type = 207; break; case "STORE_JUPITER_FIELD_TO_EU_GATE": type = 208; break; case "STORE_JUPITER_FIELD_TO_JUPITER_GATE": type = 209; break; case "STORE_JUPITER_A0_START_GATE": type = 220; break; } //Set new return global information Character.Information.Place = type; //Update database MsSQL.InsertData("update character set savearea='" + Character.Information.Place + "' where id='" + Character.Information.CharacterID + "'"); //Send confirmation packet client.Send(Packet.UpdatePlace()); } catch (Exception ex) { Console.WriteLine("Save return point error {0}", ex); Systems.Debugger.Write(ex); } }
public void RandomMonster(int sID, byte randomTYPE) { try { obj o = new obj(); o.ID = sID; o.Ids = new Global.ID(Global.ID.IDS.Object); o.UniqueID = o.Ids.GetUniqueID; o.x = this.x; o.z = this.z; o.y = this.y; o.oY = this.oY; o.oX = this.oX; //Systems.aRound(ref o.oX, ref o.oY, 1); o.xSec = this.xSec; o.ySec = this.ySec; o.AutoMovement = this.AutoMovement; if (ID == 1979 || ID == 2101 || ID == 2124 || ID == 2111 || ID == 2112) o.AutoMovement = false; o.AutoSpawn = true; o.Move = 1; o.HP = Data.ObjectBase[o.ID].HP; o.SpeedWalk = Data.ObjectBase[o.ID].SpeedWalk; o.SpeedRun = Data.ObjectBase[o.ID].SpeedRun; o.SpeedZerk = Data.ObjectBase[o.ID].SpeedZerk; o.Agresif = 0; o.LocalType = 1; o.State = 2; o.Kat = 1; o.Agro = new List<_agro>(); o.spawnOran = 0; if (randomTYPE == 0) // Standart { o.Type = Systems.RandomType(Data.ObjectBase[o.ID].Level, ref this.Kat, false, ref o.Agresif); if (o.Type == 1) o.Agresif = 1; if (Data.ObjectBase[o.ID].Agresif == 1) { o.Agresif = 1; } o.HP *= this.Kat; } else { if (randomTYPE == 6) o.HP *= 4; else if (randomTYPE == 4) o.HP *= 20; else if (randomTYPE == 1) o.HP *= 2; else if (randomTYPE == 16) o.HP *= 10; else if (randomTYPE == 17) o.HP *= 20; else if (randomTYPE == 20) o.HP *= 210; o.AutoSpawn = false; o.Type = randomTYPE; o.Agresif = 1; } o.SpawnMe(); Systems.Objects.Add(o); } catch (Exception ex) { Console.WriteLine("Respawn monster: {0}",ex); Systems.Debugger.Write(ex); } }
//Monster spawns public static byte[] ObjectSpawn(obj o) { //Create new packet writer PacketWriter Writer = new PacketWriter(); //Add opcode Writer.Create(Systems.SERVER_SOLO_SPAWN); //Add dword object id Writer.DWord(o.ID); //Add dword object world id Writer.DWord(o.UniqueID); //Add x and y sector for object Writer.Byte(o.xSec); Writer.Byte(o.ySec); //Add float x y z for object Writer.Float(Formule.packetx((float)o.x, o.xSec)); Writer.Float(o.z); Writer.Float(Formule.packety((float)o.y, o.ySec)); //Switch on spawn type switch (Data.ObjectBase[o.ID].Object_type) { //Normal monsters case Global.objectdata.NamdedType.MONSTER: Writer.Word(0); Writer.Word(1); Writer.Byte(o.xSec); Writer.Byte(o.ySec); if (!File.FileLoad.CheckCave(o.xSec, o.ySec)) { Writer.Word(Formule.packetx((float)(o.x + o.wx), o.xSec)); Writer.Word(o.z); Writer.Word(Formule.packety((float)(o.y + o.wy), o.ySec)); } else { if (o.x < 0) { Writer.Word(Formule.cavepacketx((float)(o.x + o.wx))); Writer.Word(0xFFFF); } else { Writer.DWord(Formule.cavepacketx((float)(o.x + o.wx))); } Writer.DWord(o.z); if (o.y < 0) { Writer.Word(Formule.cavepackety((float)(o.y + o.wy))); Writer.Word(0xFFFF); } else { Writer.DWord(Formule.cavepackety((float)(o.y + o.wy))); } } Writer.Byte(0); Writer.Byte(o.Walking == true ? 2 : 0); Writer.Byte(0); Writer.Byte(0); Writer.Byte(0); Writer.Float(o.SpeedWalk);// Walk speed Writer.Float(o.SpeedRun);// Run speed Writer.Float(o.SpeedZerk);// Berserk speed Writer.Byte(0); Writer.Byte(2); Writer.Byte(1); Writer.Byte(5); Writer.Byte(o.Type); Writer.Byte(4); break; case Global.objectdata.NamdedType.NPC: Writer.Word(o.rotation); Writer.Byte(0); Writer.Byte(1); Writer.Byte(0); Writer.Word(o.rotation); Writer.Byte(1);//Non static Writer.Byte(0);//Non static Writer.Byte(0);//Non static Writer.Byte(0); Writer.Byte(0); Writer.DWord(0); Writer.DWord(0); Writer.Float(100); Writer.Byte(0); Writer.Byte(2); Writer.Byte(0);//Static Writer.Byte(1);//Non static break; case Global.objectdata.NamdedType.TELEPORT: Writer.Word(0); Writer.Byte(1); Writer.Byte(0); Writer.Byte(0); Writer.Byte(1); Writer.DWord(0); Writer.DWord(0); Writer.Byte(0); break; case Global.objectdata.NamdedType.JOBMONSTER: // Thiefs and trader spawns Writer.Word(0); Writer.Word(1); Writer.Byte(o.xSec); Writer.Byte(o.ySec); if (!File.FileLoad.CheckCave(o.xSec, o.ySec)) { Writer.Word(Formule.packetx((float)(o.x + o.wx), o.xSec)); Writer.Word(o.z); Writer.Word(Formule.packety((float)(o.y + o.wy), o.ySec)); } else { if (o.x < 0) { Writer.Word(Formule.packetx((float)(o.x + o.wx), o.xSec)); Writer.Word(0xFFFF); } else { Writer.DWord(Formule.packetx((float)(o.x + o.wx), o.xSec)); } Writer.DWord(o.z); if (o.y < 0) { Writer.Word(Formule.packety((float)(o.y + o.wy), o.ySec)); Writer.Word(0xFFFF); } else { Writer.DWord(Formule.packety((float)(o.y + o.wy), o.ySec)); } } Writer.Byte(1); Writer.Byte(o.Walking == true ? 2 : 0); Writer.Byte(0); Writer.Byte(0); Writer.Byte(0); Writer.Float(o.SpeedWalk);// Walk speed Writer.Float(o.SpeedRun);// Run speed Writer.Float(o.SpeedZerk);// Berserk speed Writer.Byte(0); Writer.Byte(2); Writer.Byte(1); Writer.Byte(5); Writer.Byte(0); Writer.Byte(0xE3); // Need to check what this is... Writer.Byte(1); break; } return Writer.GetBytes(); }
/////////////////////////////////////////////////////////////////////////// // Frostbite state /////////////////////////////////////////////////////////////////////////// #region Frost Bite public static void GenerateEffect_fb(object target, int skillid) { // Get effects parameters int Power = Data.SkillBase[skillid].Properties1["fb"]; int Probability = Data.SkillBase[skillid].Properties2["fb"]; int Random = Seed.Next(1, 100); byte slot; // if effect succeeded if (Random <= Probability) { if (target.GetType().ToString() == "DarkEmu_GameServer.Systems") // player { Systems sys = target as Systems; if (sys.Character.State.Die == true) { return; } slot = sys.DeBuffGetFreeSlot(); sys.Character.Action.DeBuff.Effect.EffectID[slot] = EffectNumbers.FROSTBITE; sys.Character.Action.DeBuff.Effect.SkillID[slot] = skillid; sys.StartEffectTimer(Power * 100, slot); sys.Send(Packet.EffectUpdate(sys.Character.Information.UniqueID, EffectNumbers.FROSTBITE, true)); // attack speed sys.Character.Speed.AttackSpeedModifier = 1.5; sys.Character.Speed.RunSpeed /= 2; sys.Character.Speed.WalkSpeed /= 2; sys.Character.Speed.BerserkSpeed /= 2; sys.Send(Packet.SetSpeed(sys.Character.Information.UniqueID, sys.Character.Speed.WalkSpeed, sys.Character.Speed.RunSpeed)); } else if (target.GetType().ToString() == "DarkEmu_GameServer.obj") // mob { obj os = target as obj; if (os.Die == true) { return; } slot = os.DeBuffGetFreeSlot(); os.DeBuff.Effect.EffectID[slot] = EffectNumbers.FROSTBITE; os.DeBuff.Effect.SkillID[slot] = skillid; //target.os.DeBuff.Effect.EffectPower[slot] = Power; os.StartEffectTimer(Power * 100, slot); os.Send(Packet.EffectUpdate(os.UniqueID, EffectNumbers.FROSTBITE, true)); // attack speed os.AttackSpeed = 1.5; // movement speed os.SpeedRun /= 2; os.SpeedWalk /= 2; //Set our bool active os.Frostbite = true; os.Send(Packet.SetSpeed(os.UniqueID, os.SpeedWalk, os.SpeedRun)); } } }
public targetObject(object o, Systems player) { try { os = null; o_x = 0; o_y = 0; magdef = 0; phydef = 0; type = false; if (o == null) return; main = player; if (main == null) return; if (o.GetType().ToString() == "DarkEmu_GameServer.obj") { os = o as obj; if (os.Die) { player.StopAttackTimer(); return; } o_x = (float)os.x; o_y = (float)os.y; xsec = os.xSec; ysec = os.ySec; magdef = Data.ObjectBase[os.ID].MagDef; phydef = Data.ObjectBase[os.ID].PhyDef; id = os.UniqueID; type = false; hps = os.HP; state = os.State; main.Character.Action.MonsterID.Add(os.UniqueID); mabsrob = 0; os.Target = player; } if (o.GetType().ToString() == "DarkEmu_GameServer.Systems") { sys = o as Systems; o_x = sys.Character.Position.x; o_y = sys.Character.Position.y; xsec = sys.Character.Position.xSec; ysec = sys.Character.Position.ySec; magdef = sys.Character.Stat.MagDef; phydef = sys.Character.Stat.PhyDef; id = sys.Character.Information.UniqueID; absorbphy = sys.Character.Stat.phy_Absorb; absorbmag = sys.Character.Stat.mag_Absorb; state = sys.Character.State.LastState; hps = sys.Character.Stat.SecondHp; type = true; mabsrob = sys.Character.Stat.Absorb_mp; } } catch (Exception ex) { Console.WriteLine("Target object error : {0}", ex); Systems.Debugger.Write(ex); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Monster Summon Scrolls /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void HandleSummon(int scrollid) { try { //if (this.Character.Information.Level < 10) return; int count = 1;//Default should be set to 1 //single scroll if (scrollid == 3936) { count = 5; } //party scroll if (scrollid == 3935) { if (this.Character.Network.Party == null) return; if (this.Character.Network.Party.Members.Count < 5) return; count = this.Character.Network.Party.Members.Count; } int model = GetStrongMobByLevel(this.Character.Information.Level); byte type = Data.ObjectBase[model].ObjectType; for (int i = 1; i <= count; i++) { obj Spawn = new obj(); Spawn.ID = model; Spawn.Type = type; Spawn.Ids = new Global.ID(Global.ID.IDS.Object); Spawn.UniqueID = Spawn.Ids.GetUniqueID; Spawn.x = Character.Position.x; Spawn.z = Character.Position.z; Spawn.y = Character.Position.y; Spawn.oX = Spawn.x; Spawn.oY = Spawn.y; Spawn.xSec = Character.Position.xSec; Spawn.ySec = Character.Position.ySec; Spawn.AutoMovement = true; Spawn.State = 1; Spawn.Move = 1; Spawn.SpeedWalk = Data.ObjectBase[Spawn.ID].SpeedWalk; Spawn.SpeedRun = Data.ObjectBase[Spawn.ID].SpeedRun; Spawn.SpeedZerk = Data.ObjectBase[Spawn.ID].SpeedZerk; Spawn.HP = Data.ObjectBase[model].HP; Spawn.Agresif = Data.ObjectBase[model].Agresif; Spawn.LocalType = 1; Spawn.AutoSpawn = false; Spawn.Kat = 1; Systems.aRound(ref Spawn.x, ref Spawn.y, 1); Systems.Objects.Add(Spawn); Spawn.SpawnMe(); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }