private void RefreshSkills() { int[] lvPlus = { 0, 3, 5, 8 }; for (int i = 0; i < Magics.Count; i++) { ClientMagic magic = Magics[i]; switch (magic.Spell) { case Spell.Fencing: Accuracy = (byte)Math.Min(byte.MaxValue, Accuracy + magic.Level * 3); //MaxAC = (ushort)Math.Min(ushort.MaxValue, MaxAC + (magic.Level + 1) * 3); break; case Spell.Slaying: Accuracy = (byte)Math.Min(byte.MaxValue, Accuracy + magic.Level); break; //case Spell.FatalSword: // Accuracy = (byte)Math.Min(byte.MaxValue, Accuracy + magic.Level); // break; case Spell.SpiritSword: Accuracy = (byte)Math.Min(byte.MaxValue, Accuracy + lvPlus[magic.Level]); //MaxDC = (ushort)Math.Min(ushort.MaxValue, MaxDC + MaxSC * (magic.Level + 1) * 0.1F); break; } } }
private void RefreshSkills() { int[] spiritSwordLvPlus = { 0, 3, 5, 8 }; int[] slayingLvPlus = { 5, 6, 7, 8 }; for (int i = 0; i < Magics.Count; i++) { ClientMagic magic = Magics[i]; switch (magic.Spell) { case Spell.Fencing: Stats[Stat.Accuracy] += magic.Level * 3; //Stats[Stat.MaxAC] += (magic.Level + 1) * 3; break; case Spell.Slaying: // case Spell.FatalSword: Stats[Stat.Accuracy] += magic.Level; Stats[Stat.MaxDC] += slayingLvPlus[magic.Level]; break; case Spell.SpiritSword: Stats[Stat.Accuracy] += spiritSwordLvPlus[magic.Level]; // Stats[Stat.Accuracy] += magic.Level; // Stats[Stat.MaxDC] += (int)(Stats[Stat.MaxSC] * (magic.Level + 1) * 0.1F); break; } } }
public void prevSendUseMagic(ClientMagic magic) { UserObject User = UserObject.User; switch (magic.Spell) { case Spell.Poisoning: { if (Settings.smartChangePoison) { UserItem item = User.GetPoison(usePoisonShape); if (item == null) { usePoisonShape++; if (usePoisonShape > 2) { usePoisonShape = 1; } item = User.GetPoison(usePoisonShape); } if (item != null) { Network.Enqueue(new C.EquipItem { Grid = MirGridType.Inventory, UniqueID = item.UniqueID, To = (int)EquipmentSlot.Amulet }); } usePoisonShape++; if (usePoisonShape > 2) { usePoisonShape = 1; } } } break; case Spell.SoulFireBall: case Spell.SummonSkeleton: case Spell.SummonHolyDeva: case Spell.SummonShinsu: case Spell.Hiding: case Spell.MassHiding: case Spell.SoulShield: case Spell.TrapHexagon: case Spell.Curse: case Spell.Plague: { UserItem item = User.GetAmulet(1); if (item != null) { Network.Enqueue(new C.EquipItem { Grid = MirGridType.Inventory, UniqueID = item.UniqueID, To = (int)EquipmentSlot.Amulet }); } } break; } }
public void ClearMagic() { NextMagic = null; NextMagicDirection = 0; NextMagicLocation = Point.Empty; NextMagicObject = null; }
private void RefreshSkills() { for (int i = 0; i < Magics.Count; i++) { ClientMagic magic = Magics[i]; switch (magic.Spell) { case Spell.Fencing: Accuracy = (byte)Math.Min(byte.MaxValue, Accuracy + magic.Level * 3); break; case Spell.Slaying: Accuracy = (byte)Math.Min(byte.MaxValue, Accuracy + magic.Level); break; case Spell.FatalSword: Accuracy = (byte)Math.Min(byte.MaxValue, Accuracy + magic.Level); break; case Spell.SpiritSword: Accuracy = (byte)Math.Min(byte.MaxValue, Accuracy + (byte)Math.Round(8F / 3F * magic.Level)); break; } } }
public void AddMagic(ClientMagic magic) { SkillSlot slot = Instantiate(SkillSlotPrefab, ContentOject.transform).GetComponent <SkillSlot>(); skillSlots.Add(slot); slot.Magic = magic; }
public virtual void OnUseSpell(PlayerObject player, ClientMagic magic) { UserObject User = (UserObject)player; User.NextMagic = magic; User.NextMagicLocation = MapControl.MapLocation; User.NextMagicObject = MapObject.MouseObject; User.NextMagicDirection = MapControl.MouseDirection(); }
public void NewMagic(S.NewMagic p) { ClientMagic magic = p.Magic; User.Magics.Add(magic); //User.RefreshStats(); //foreach (SkillBarDialog Bar in SkillBarDialogs) // Bar.Update(); }
public void Update() { HasSkill = false; foreach (var m in GameScene.User.Magics) { if ((m.Key < (BarIndex * 8) + 1) || (m.Key > ((BarIndex + 1) * 8) + 1)) { continue; } HasSkill = true; } if (!Visible) { return; } Index = 2190; _switchBindsButton.Index = 2247; BindNumberLabel.Text = (BarIndex + 1).ToString(); BindNumberLabel.Location = new Point(0, 1); for (var i = 1; i <= 8; i++) { Cells[i - 1].Index = -1; int offset = BarIndex * 8; string key = GetKey(BarIndex, i); KeyNameLabels[i - 1].Text = key; foreach (var m in GameScene.User.Magics) { if (m.Key != i + offset) { continue; } HasSkill = true; ClientMagic magic = MapObject.User.GetMagic(m.Spell); if (magic == null) { continue; } //string key = m.Key > 8 ? string.Format("CTRL F{0}", i) : string.Format("F{0}", m.Key); Cells[i - 1].Index = magic.Icon * 2; Cells[i - 1].Hint = string.Format(CMain.Tr("{0}\nMP: {1}\nCooldown: {2}\nKey: {3}"), magic.Name, (magic.BaseCost + (magic.LevelCost * magic.Level)), Functions.PrintTimeSpanFromMilliSeconds(magic.Delay), key); KeyNameLabels[i - 1].Text = ""; } CoolDowns[i - 1].Dispose(); } }
public void UpdateMagic(ClientMagic magic) { for (int i = 0; i < skillSlots.Count; i++) { SkillSlot slot = skillSlots[i]; if (slot.Magic.Spell != magic.Spell) { continue; } slot.Magic = magic; } }
public ClientMagic GetMagic(Spell spell) { for (int i = 0; i < Magics.Count; i++) { ClientMagic magic = Magics[i]; if (magic.Spell != spell) { continue; } return(magic); } return(null); }
public override void OnUseSpell(PlayerObject player, ClientMagic magic) { GameScene scene = GameScene.Scene; if (CMain.Time < scene.ToggleTime) { return; } GameScene.JinGangGunFa = !GameScene.JinGangGunFa; scene.ChatDialog.ReceiveChat(GameScene.JinGangGunFa ? "开启金刚棍法" : "关闭金刚棍法", ChatType.Hint); scene.ToggleTime = CMain.Time + 1000; Network.Enqueue(new C.SpellToggle { Spell = magic.Spell, CanUse = GameScene.DaMoGunFa }); }
public void Update(ClientMagic magic) { Magic = magic; NameLabel.Text = Magic.Name; LevelLabel.Text = Magic.Level.ToString(); switch (Magic.Level) { case 0: ExpLabel.Text = string.Format("{0}/{1}", Magic.Experience, Magic.Need1); break; case 1: ExpLabel.Text = string.Format("{0}/{1}", Magic.Experience, Magic.Need2); break; case 2: ExpLabel.Text = string.Format("{0}/{1}", Magic.Experience, Magic.Need3); break; case 3: ExpLabel.Text = "-"; break; } if (Magic.Key > 8) { int key = Magic.Key % 8; KeyLabel.Text = string.Format("CTRL" + Environment.NewLine + "F{0}", key != 0 ? key : 8); } else if (Magic.Key > 0) { KeyLabel.Text = string.Format("F{0}", Magic.Key); } else { KeyLabel.Text = string.Empty; } SkillButton.Index = Magic.Icon * 2; SkillButton.PressedIndex = Magic.Icon * 2 + 1; SetDelay(); }
public override void OnUseSpell(PlayerObject player, ClientMagic magic) { GameScene scene = GameScene.Scene; if (CMain.Time < scene.ToggleTime) { return; } scene.ToggleTime = CMain.Time + 500; int cost = magic.Level * magic.LevelCost + magic.BaseCost; if (cost > MapObject.User.MP) { scene.OutputMessageTr("Not Enough Mana to cast."); return; } Network.Enqueue(new C.SpellToggle { Spell = magic.Spell, CanUse = true }); }
public void MagicLeveled(S.MagicLeveled p) { for (int i = 0; i < User.Magics.Count; i++) { ClientMagic magic = User.Magics[i]; if (magic.Spell != p.Spell) { continue; } if (magic.Level != p.Level) { magic.Level = p.Level; User.RefreshStats(); } magic.Experience = p.Experience; SkillDialog.UpdateMagic(magic); break; } }
private void RefreshSkills() { for (int i = 0; i < Magics.Count; i++) { ClientMagic magic = Magics[i]; switch (magic.Spell) { case Spell.Fencing: Accuracy = (byte)Math.Min(byte.MaxValue, Accuracy + magic.Level * 3); MaxAC = (byte)Math.Min(byte.MaxValue, MaxAC + (magic.Level + 1) * 3); break; case Spell.FatalSword: Accuracy = (byte)Math.Min(byte.MaxValue, Accuracy + magic.Level); break; case Spell.SpiritSword: Accuracy = (byte)Math.Min(byte.MaxValue, Accuracy + magic.Level); MaxDC = (byte)Math.Min(byte.MaxValue, MaxDC + MaxSC * (magic.Level + 1) * 0.1F); break; } } }
private void RefreshSkills() { for (int i = 0; i < Magics.Count; i++) { ClientMagic magic = Magics[i]; switch (magic.Spell) { case Spell.Fencing: Stats[Stat.Accuracy] += magic.Level * 3; Stats[Stat.MaxAC] += (magic.Level + 1) * 3; break; case Spell.FatalSword: Stats[Stat.Accuracy] += magic.Level; break; case Spell.SpiritSword: Stats[Stat.Accuracy] += magic.Level; Stats[Stat.MaxDC] += (int)(Stats[Stat.MaxSC] * (magic.Level + 1) * 0.1F); break; } } }
public AssignKeyPanel(ClientMagic magic) { Magic = magic; Key = magic.Key; Modal = true; Index = 710; Library = Libraries.Prguse; Location = Center; Parent = GameScene.Scene; Visible = true; MagicImage = new MirImageControl { Location = new Point(16, 16), Index = magic.Icon * 2, Library = Libraries.MagIcon2, Parent = this, }; TitleLabel = new MirLabel { Location = new Point(49, 17), Parent = this, Size = new Size(230, 32), DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.WordBreak, Text = CMain.Format("Select the Key for: {0}", magic.Name) }; NoneButton = new MirButton { Index = 287, //154 HoverIndex = 288, PressedIndex = 289, Library = Libraries.Title, Parent = this, Location = new Point(284, 64), }; NoneButton.Click += (o, e) => Key = 0; SaveButton = new MirButton { Library = Libraries.Title, Parent = this, Location = new Point(284, 101), Index = 156, HoverIndex = 157, PressedIndex = 158, }; SaveButton.Click += (o, e) => { for (int i = 0; i < MapObject.User.Magics.Count; i++) { if (MapObject.User.Magics[i].Key == Key) { MapObject.User.Magics[i].Key = 0; } } Network.Enqueue(new C.MagicKey { Spell = Magic.Spell, Key = Key }); Magic.Key = Key; foreach (SkillBarDialog Bar in GameScene.Scene.SkillBarDialogs) { Bar.Update(); } Dispose(); }; FKeys = new MirButton[16]; FKeys[0] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(17, 58), Sound = SoundList.ButtonA, Text = "F1" }; FKeys[0].Click += (o, e) => Key = 1; FKeys[1] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(49, 58), Sound = SoundList.ButtonA, Text = "F2" }; FKeys[1].Click += (o, e) => Key = 2; FKeys[2] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(81, 58), Sound = SoundList.ButtonA, Text = "F3" }; FKeys[2].Click += (o, e) => Key = 3; FKeys[3] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(113, 58), Sound = SoundList.ButtonA, Text = "F4" }; FKeys[3].Click += (o, e) => Key = 4; FKeys[4] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(150, 58), Sound = SoundList.ButtonA, Text = "F5" }; FKeys[4].Click += (o, e) => Key = 5; FKeys[5] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(182, 58), Sound = SoundList.ButtonA, Text = "F6", }; FKeys[5].Click += (o, e) => Key = 6; FKeys[6] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(214, 58), Sound = SoundList.ButtonA, Text = "F7" }; FKeys[6].Click += (o, e) => Key = 7; FKeys[7] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(246, 58), Sound = SoundList.ButtonA, Text = "F8" }; FKeys[7].Click += (o, e) => Key = 8; FKeys[8] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(17, 95), Sound = SoundList.ButtonA, Text = "Ctrl" + Environment.NewLine + "F1" }; FKeys[8].Click += (o, e) => Key = 9; FKeys[9] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(49, 95), Sound = SoundList.ButtonA, Text = "Ctrl" + Environment.NewLine + "F2" }; FKeys[9].Click += (o, e) => Key = 10; FKeys[10] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(81, 95), Sound = SoundList.ButtonA, Text = "Ctrl" + Environment.NewLine + "F3" }; FKeys[10].Click += (o, e) => Key = 11; FKeys[11] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(113, 95), Sound = SoundList.ButtonA, Text = "Ctrl" + Environment.NewLine + "F4" }; FKeys[11].Click += (o, e) => Key = 12; FKeys[12] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(150, 95), Sound = SoundList.ButtonA, Text = "Ctrl" + Environment.NewLine + "F5" }; FKeys[12].Click += (o, e) => Key = 13; FKeys[13] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(182, 95), Sound = SoundList.ButtonA, Text = "Ctrl" + Environment.NewLine + "F6" }; FKeys[13].Click += (o, e) => Key = 14; FKeys[14] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(214, 95), Sound = SoundList.ButtonA, Text = "Ctrl" + Environment.NewLine + "F7" }; FKeys[14].Click += (o, e) => Key = 15; FKeys[15] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(246, 95), Sound = SoundList.ButtonA, Text = "Ctrl" + Environment.NewLine + "F8" }; FKeys[15].Click += (o, e) => Key = 16; BeforeDraw += AssignKeyPanel_BeforeDraw; }
private void UseMagic(ClientMagic magic) { if (CMain.Time < GameScene.SpellTime || User.Poison.HasFlag(PoisonType.Stun)) { User.ClearMagic(); return; } if ((CMain.Time <= magic.CastTime + magic.Delay) && magic.CastTime > 0) { if (CMain.Time >= OutputDelay) { OutputDelay = CMain.Time + 1000; GameScene.Scene.OutputMessage(string.Format("You cannot cast {0} for another {1} seconds.", magic.Spell.ToString(), ((magic.CastTime + magic.Delay) - CMain.Time - 1) / 1000 + 1)); } User.ClearMagic(); return; } int cost = magic.Level * magic.LevelCost + magic.BaseCost; if (magic.Spell == Spell.Teleport || magic.Spell == Spell.Blink) { for (int i = 0; i < GameScene.Scene.Buffs.Count; i++) { if (GameScene.Scene.Buffs[i].Type != BuffType.Teleport) continue; cost += (int)(User.MaxMP * 0.3F); } } if (cost > MapObject.User.MP) { if (CMain.Time >= OutputDelay) { OutputDelay = CMain.Time + 1000; GameScene.Scene.OutputMessage("Not Enough Mana to cast."); } User.ClearMagic(); return; } bool isTargetSpell = true; MapObject target = null; //Targeting switch (magic.Spell) { case Spell.FireBall: case Spell.GreatFireBall: case Spell.ElectricShock: case Spell.Poisoning: case Spell.ThunderBolt: case Spell.FlameDisruptor: case Spell.SoulFireBall: case Spell.TurnUndead: case Spell.FrostCrunch: case Spell.Vampirism: case Spell.Revelation: case Spell.Entrapment: case Spell.Hallucination: case Spell.DarkBody: if (User.NextMagicObject != null) { if (!User.NextMagicObject.Dead && User.NextMagicObject.Race != ObjectType.Item && User.NextMagicObject.Race != ObjectType.Merchant) target = User.NextMagicObject; } if (target == null) target = MapObject.MagicObject; if (target != null && target.Race == ObjectType.Monster) MapObject.MagicObject = target; break; case Spell.StraightShot: case Spell.DoubleShot: case Spell.ElementalShot: case Spell.DelayedExplosion: case Spell.BindingShot: case Spell.VampireShot: case Spell.PoisonShot: case Spell.CrippleShot: case Spell.NapalmShot: case Spell.SummonVampire: case Spell.SummonToad: case Spell.SummonSnakes: if (!User.HasClassWeapon) { GameScene.Scene.OutputMessage("You must be wearing a bow to perform this skill."); User.ClearMagic(); return; } if (User.NextMagicObject != null) { if (!User.NextMagicObject.Dead && User.NextMagicObject.Race != ObjectType.Item && User.NextMagicObject.Race != ObjectType.Merchant) target = User.NextMagicObject; } if (target == null) target = MapObject.MagicObject; if (target != null && target.Race == ObjectType.Monster) MapObject.MagicObject = target; if(magic.Spell == Spell.ElementalShot) { isTargetSpell = User.HasElements; } switch(magic.Spell) { case Spell.SummonVampire: case Spell.SummonToad: case Spell.SummonSnakes: isTargetSpell = false; break; } break; case Spell.Purification: case Spell.Healing: case Spell.UltimateEnhancer: case Spell.EnergyShield: case Spell.PetEnhancer: if (User.NextMagicObject != null) { if (!User.NextMagicObject.Dead && User.NextMagicObject.Race != ObjectType.Item && User.NextMagicObject.Race != ObjectType.Merchant) target = User.NextMagicObject; } if (target == null) target = User; break; case Spell.FireBang: case Spell.MassHiding: case Spell.FireWall: case Spell.TrapHexagon: if (User.NextMagicObject != null) { if (!User.NextMagicObject.Dead && User.NextMagicObject.Race != ObjectType.Item && User.NextMagicObject.Race != ObjectType.Merchant) target = User.NextMagicObject; } break; case Spell.PoisonCloud: if (User.NextMagicObject != null) { if (!User.NextMagicObject.Dead && User.NextMagicObject.Race != ObjectType.Item && User.NextMagicObject.Race != ObjectType.Merchant) target = User.NextMagicObject; } break; case Spell.Blizzard: case Spell.MeteorStrike: if (User.NextMagicObject != null) { if (!User.NextMagicObject.Dead && User.NextMagicObject.Race != ObjectType.Item && User.NextMagicObject.Race != ObjectType.Merchant) target = User.NextMagicObject; } break; case Spell.Reincarnation: if (User.NextMagicObject != null) { if (User.NextMagicObject.Dead && User.NextMagicObject.Race == ObjectType.Player) target = User.NextMagicObject; } break; case Spell.Trap: if (User.NextMagicObject != null) { if (!User.NextMagicObject.Dead && User.NextMagicObject.Race != ObjectType.Item && User.NextMagicObject.Race != ObjectType.Merchant) target = User.NextMagicObject; } break; case Spell.FlashDash: if (User.GetMagic(Spell.FlashDash).Level <= 1 && User.IsDashAttack() == false) { User.ClearMagic(); return; } isTargetSpell = false; break; default: isTargetSpell = false; break; } MirDirection dir = (target == null || target == User) ? User.NextMagicDirection : Functions.DirectionFromPoint(User.CurrentLocation, target.CurrentLocation); Point location = target != null ? target.CurrentLocation : User.NextMagicLocation; if (magic.Spell == Spell.FlashDash) dir = User.Direction; if (!Functions.InRange(User.CurrentLocation, location, 9) && isTargetSpell) { if (CMain.Time >= OutputDelay) { OutputDelay = CMain.Time + 1000; GameScene.Scene.OutputMessage("Target is too far."); } User.ClearMagic(); return; } GameScene.LogTime = CMain.Time + Globals.LogDelay; User.QueuedAction = new QueuedAction { Action = MirAction.Spell, Direction = dir, Location = User.CurrentLocation, Params = new List<object>() }; User.QueuedAction.Params.Add(magic.Spell); User.QueuedAction.Params.Add(target != null ? target.ObjectID : 0); User.QueuedAction.Params.Add(location); User.QueuedAction.Params.Add(magic.Level); }
public AssignKeyPanel(ClientMagic magic) { Magic = magic; Key = magic.Key; Modal = true; Index = 710; Library = Libraries.Prguse; Location = Center; Parent = GameScene.Scene; Visible = true; MagicImage = new MirImageControl { Location = new Point(16, 16), Index = magic.Icon * 2, Library = Libraries.MagIcon2, Parent = this, }; TitleLabel = new MirLabel { Location = new Point(49, 17), Parent = this, Size = new Size(230, 32), DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.WordBreak, Text = string.Format("Select the Key for: {0}", magic.Spell) }; NoneButton = new MirButton { Index = 287, //154 HoverIndex = 288, PressedIndex = 289, Library = Libraries.Title, Parent = this, Location = new Point(284, 64), }; NoneButton.Click += (o, e) => Key = 0; SaveButton = new MirButton { Library = Libraries.Title, Parent = this, Location = new Point(284, 101), Index = 156, HoverIndex = 157, PressedIndex = 158, }; SaveButton.Click += (o, e) => { for (int i = 0; i < MapObject.User.Magics.Count; i++) { if (MapObject.User.Magics[i].Key == Key) MapObject.User.Magics[i].Key = 0; } Network.Enqueue(new C.MagicKey { Spell = Magic.Spell, Key = Key }); Magic.Key = Key; GameScene.Scene.SkillBarDialog.Update(); Dispose(); }; FKeys = new MirButton[16]; FKeys[0] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(17, 58), Sound = SoundList.ButtonA, Text = "F1" }; FKeys[0].Click += (o, e) => Key = 1; FKeys[1] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(49, 58), Sound = SoundList.ButtonA, Text = "F2" }; FKeys[1].Click += (o, e) => Key = 2; FKeys[2] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(81, 58), Sound = SoundList.ButtonA, Text = "F3" }; FKeys[2].Click += (o, e) => Key = 3; FKeys[3] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(113, 58), Sound = SoundList.ButtonA, Text = "F4" }; FKeys[3].Click += (o, e) => Key = 4; FKeys[4] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(150, 58), Sound = SoundList.ButtonA, Text = "F5" }; FKeys[4].Click += (o, e) => Key = 5; FKeys[5] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(182, 58), Sound = SoundList.ButtonA, Text = "F6", }; FKeys[5].Click += (o, e) => Key = 6; FKeys[6] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(214, 58), Sound = SoundList.ButtonA, Text = "F7" }; FKeys[6].Click += (o, e) => Key = 7; FKeys[7] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(246, 58), Sound = SoundList.ButtonA, Text = "F8" }; FKeys[7].Click += (o, e) => Key = 8; FKeys[8] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(17, 95), Sound = SoundList.ButtonA, Text = "Ctrl" + Environment.NewLine + "F1" }; FKeys[8].Click += (o, e) => Key = 9; FKeys[9] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(49, 95), Sound = SoundList.ButtonA, Text = "Ctrl" + Environment.NewLine + "F2" }; FKeys[9].Click += (o, e) => Key = 10; FKeys[10] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(81, 95), Sound = SoundList.ButtonA, Text = "Ctrl" + Environment.NewLine + "F3" }; FKeys[10].Click += (o, e) => Key = 11; FKeys[11] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(113, 95), Sound = SoundList.ButtonA, Text = "Ctrl" + Environment.NewLine + "F4" }; FKeys[11].Click += (o, e) => Key = 12; FKeys[12] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(150, 95), Sound = SoundList.ButtonA, Text = "Ctrl" + Environment.NewLine + "F5" }; FKeys[12].Click += (o, e) => Key = 13; FKeys[13] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(182, 95), Sound = SoundList.ButtonA, Text = "Ctrl" + Environment.NewLine + "F6" }; FKeys[13].Click += (o, e) => Key = 14; FKeys[14] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(214, 95), Sound = SoundList.ButtonA, Text = "Ctrl" + Environment.NewLine + "F7" }; FKeys[14].Click += (o, e) => Key = 15; FKeys[15] = new MirButton { Index = 0, PressedIndex = 1, Library = Libraries.Prguse, Parent = this, Location = new Point(246, 95), Sound = SoundList.ButtonA, Text = "Ctrl" + Environment.NewLine + "F8" }; FKeys[15].Click += (o, e) => Key = 16; BeforeDraw += AssignKeyPanel_BeforeDraw; }
public void Update(ClientMagic magic) { Magic = magic; NameLabel.Text = Magic.Spell.ToString(); LevelLabel.Text = Magic.Level.ToString(); switch (Magic.Level) { case 0: ExpLabel.Text = string.Format("{0}/{1}", Magic.Experience, Magic.Need1); break; case 1: ExpLabel.Text = string.Format("{0}/{1}", Magic.Experience, Magic.Need2); break; case 2: ExpLabel.Text = string.Format("{0}/{1}", Magic.Experience, Magic.Need3); break; case 3: ExpLabel.Text = "-"; break; } if (Magic.Key > 8) { int key = Magic.Key % 8; KeyLabel.Text = string.Format("CTRL" + Environment.NewLine + "F{0}", key != 0 ? key : 8); } else if (Magic.Key > 0) KeyLabel.Text = string.Format("F{0}", Magic.Key); else KeyLabel.Text = string.Empty; SkillButton.Index = Magic.Icon * 2; SkillButton.PressedIndex = Magic.Icon * 2 + 1; SetDelay(); }
protected override void ReadPacket(BinaryReader reader) { Magic = new ClientMagic(reader); }
private void UseMagic(ClientMagic magic) { if (CMain.Time < GameScene.SpellTime || User.Poison == PoisonType.Stun) { User.ClearMagic(); return; } int cost = magic.Level*magic.LevelCost + magic.BaseCost; if (magic.Spell == Spell.Teleport) { for (int i = 0; i < GameScene.Scene.Buffs.Count; i++) { if (GameScene.Scene.Buffs[i].Type != BuffType.Teleport) continue; cost += (int) (User.MaxMP*0.3F); } } if (cost > MapObject.User.MP) { if (CMain.Time >= OutputDelay) { OutputDelay = CMain.Time + 1000; GameScene.Scene.OutputMessage("Not Enough Mana to cast."); } User.ClearMagic(); return; } MapObject target = null; //Targeting switch (magic.Spell) { case Spell.FireBall: case Spell.GreatFireBall: case Spell.ElectricShock: case Spell.Poisoning: case Spell.ThunderBolt: case Spell.FlameDisruptor: case Spell.SoulFireBall: case Spell.TurnUndead: case Spell.FrostCrunch: case Spell.Vampirism: case Spell.Revelation: case Spell.Entrapment: if (User.NextMagicObject != null) { if (!User.NextMagicObject.Dead && User.NextMagicObject.Race != ObjectType.Item && User.NextMagicObject.Race != ObjectType.Merchant) target = User.NextMagicObject; } if (target == null) target = MapObject.MagicObject; if (target != null && target.Race == ObjectType.Monster) MapObject.MagicObject = target; break; case Spell.Purification: case Spell.Healing: if (User.NextMagicObject != null) { if (!User.NextMagicObject.Dead && User.NextMagicObject.Race != ObjectType.Item && User.NextMagicObject.Race != ObjectType.Merchant) target = User.NextMagicObject; } if (target == null) target = User; break; case Spell.FireBang: case Spell.MassHiding: case Spell.FireWall: if (User.NextMagicObject != null) { if (!User.NextMagicObject.Dead && User.NextMagicObject.Race != ObjectType.Item && User.NextMagicObject.Race != ObjectType.Merchant) target = User.NextMagicObject; } break; case Spell.PoisonField: if (User.NextMagicObject != null) { if (!User.NextMagicObject.Dead && User.NextMagicObject.Race != ObjectType.Item && User.NextMagicObject.Race != ObjectType.Merchant) target = User.NextMagicObject; } if (CMain.Time < GameScene.PoisonFieldTime) { if (CMain.Time >= OutputDelay) { OutputDelay = CMain.Time + 1000; GameScene.Scene.OutputMessage(string.Format("You cannot cast Poison Field for another {0} seconds.", (GameScene.PoisonFieldTime - CMain.Time - 1)/1000 + 1)); } User.ClearMagic(); return; } break; case Spell.Blizzard: case Spell.MeteorStrike: if (User.NextMagicObject != null) { if (!User.NextMagicObject.Dead && User.NextMagicObject.Race != ObjectType.Item && User.NextMagicObject.Race != ObjectType.Merchant) target = User.NextMagicObject; } break; } MirDirection dir = (target == null || target == User) ? User.NextMagicDirection : Functions.DirectionFromPoint(User.CurrentLocation, target.CurrentLocation); Point location = target != null ? target.CurrentLocation : User.NextMagicLocation; if (!Functions.InRange(User.CurrentLocation, location, 9)) { if (CMain.Time >= OutputDelay) { OutputDelay = CMain.Time + 1000; GameScene.Scene.OutputMessage("Target is too far."); } User.ClearMagic(); return; } User.QueuedAction = new QueuedAction { Action = MirAction.Spell, Direction = dir, Location = User.CurrentLocation, Params = new List<object>() }; User.QueuedAction.Params.Add(magic.Spell); User.QueuedAction.Params.Add(target != null ? target.ObjectID : 0); User.QueuedAction.Params.Add(location); }
public void Update(ClientMagic magic) { Magic = magic; NameLabel.Text = Magic.Spell.ToString(); LevelLabel.Text = Magic.Level.ToString(); if (Magic.Key > 8) { int key = Magic.Key % 8; KeyLabel.Text = string.Format("CTRL" + Environment.NewLine + "F{0}", key != 0 ? key : 8); } else if (Magic.Key > 0) KeyLabel.Text = string.Format("F{0}", Magic.Key); else KeyLabel.Text = string.Empty; long delay = Magic.Delay; if (Magic.Spell == Spell.FlamingSword) delay = 10000; else if (Magic.Spell == Spell.CounterAttack) delay = 7000; else delay = Magic.Delay; switch (Magic.Level) { case 0: SkillDescriptionLabel.Text = string.Format("{0}\nLevel : {1}\nExp : {2}/{3}\nCool-down :{4}\nMP Cost : {5}\n", Magic.Spell, Magic.Level, Magic.Experience, Magic.Need1, Functions.PrintTimeSpanFromMilliSeconds(delay), Magic.BaseCost + Magic.LevelCost); ExpLabel.Text = string.Format("{0}/{1}", Magic.Experience, Magic.Need1); break; case 1: SkillDescriptionLabel.Text = string.Format("{0}\nLevel : {1}\nExp : {2}/{3}\nCool-down :{4}\nMP Cost : {5}", Magic.Spell, Magic.Need2, Magic.Experience, Magic.Need2, Functions.PrintTimeSpanFromMilliSeconds(delay), Magic.BaseCost + Magic.LevelCost); ExpLabel.Text = string.Format("{0}/{1}", Magic.Experience, Magic.Need2); break; case 2: SkillDescriptionLabel.Text = string.Format("{0}\nLevel : {1}\nExp : {2}/{3}\nCool-down :{4}\nMP Cost : {5}", Magic.Spell, Magic.Level, Magic.Experience, Magic.Need3, Functions.PrintTimeSpanFromMilliSeconds(delay), Magic.BaseCost + Magic.LevelCost); ExpLabel.Text = string.Format("{0}/{1}", Magic.Experience, Magic.Need3); break; case 3: SkillDescriptionLabel.Text = string.Format("{0}\nLevel : {1}\nCool-down :{2}\nMP Cost : {3}", Magic.Spell, Magic.Level, Functions.PrintTimeSpanFromMilliSeconds(delay), Magic.BaseCost + Magic.LevelCost); ExpLabel.Text = string.Format("-"); break; } SkillButton.Index = Magic.Icon * 2; SkillButton.PressedIndex = Magic.Icon * 2 + 1; SetDelay(); }