/// <summary> /// The on game action. /// </summary> /// <param name="executeParameter"> /// Contains GameActions enumeration parameter, that /// informs what execution parameter is wanted to execute /// </param> private void OnGameAction(GameActions executeParameter) { if (executeParameter == GameActions.NewGame) { this.StartNewGame(); } }
public void UpdateCell(MatrixPosition pos, GameActions gameActions) { int n = gameActions.GetNeighboursCount(pos); if (n != 2 && n != 3) { // kill if alive gameActions.KillCell(pos); } else if (n == 3) { // reproduce - if not alive gameActions.CreateCell(pos); } }
public override void OnButtonClick(int buttonID) { switch ((Buttons)buttonID) { case Buttons.Map: Log.Message(LogTypes.Warning, "Map button pushed! Not implemented yet!"); MiniMapGump.Toggle(_scene); break; case Buttons.Paperdoll: if (UIManager.GetByLocalSerial <PaperDollGump>(World.Player) == null) { GameActions.DoubleClick((Serial)(World.Player.Serial | int.MinValue)); } else { UIManager.Remove <PaperDollGump>(World.Player); } break; case Buttons.Inventory: Item backpack = World.Player.Equipment[(int)Layer.Backpack]; if (backpack != null && !backpack.IsDisposed) { if (UIManager.GetByLocalSerial(backpack) == null) { GameActions.DoubleClick(backpack); } else { UIManager.Remove <Gump>(backpack); } } break; case Buttons.Journal: if (UIManager.GetByLocalSerial <JournalGump>() == null) { UIManager.Add(new JournalGump()); } else { UIManager.Remove <JournalGump>(); } break; case Buttons.Chat: Log.Message(LogTypes.Warning, "Chat button pushed! Not implemented yet!"); break; case Buttons.Help: GameActions.RequestHelp(); break; case Buttons.Debug: Log.Message(LogTypes.Warning, "Debug button pushed! Not implemented yet!"); break; } }
public StatusGumpModern() { Point p = Point.Zero; int xOffset = 0; _labels = new Label[(int)MobileStats.NumStats]; Add(new GumpPic(0, 0, 0x2A6C, 0)); if (Client.Version >= ClientVersion.CV_308Z) { p.X = 389; p.Y = 152; AddStatTextLabel(!string.IsNullOrEmpty(World.Player.Name) ? World.Player.Name : string.Empty, MobileStats.Name, Client.UseUOPGumps ? 90 : 58, 50, 320, 0x0386, TEXT_ALIGN_TYPE.TS_CENTER); if (Client.Version >= ClientVersion.CV_5020) { Add(new Button((int)ButtonType.BuffIcon, 0x7538, 0x7539, 0x7539) { X = 40, Y = 50, ButtonAction = ButtonAction.Activate }); } Lock status = World.Player.StrLock; xOffset = Client.UseUOPGumps ? 28 : 40; ushort gumpID = GetStatLockGraphic(status); Add(_lockers[0] = new GumpPic(xOffset, 76, gumpID, 0)); _lockers[0].MouseUp += (sender, e) => { World.Player.StrLock = (Lock)(((byte)World.Player.StrLock + 1) % 3); GameActions.ChangeStatLock(0, World.Player.StrLock); ushort gumpid = GetStatLockGraphic(World.Player.StrLock); _lockers[0].Graphic = gumpid; }; //AddChildren(_lockers[0] = new Button((int)ButtonType.LockerStr, gumpID, gumpID) //{ // X = xOffset, // Y = 76, // ButtonAction = ButtonAction.Activate, //}); status = World.Player.DexLock; xOffset = Client.UseUOPGumps ? 28 : 40; gumpID = GetStatLockGraphic(status); Add(_lockers[1] = new GumpPic(xOffset, 102, gumpID, 0)); _lockers[1].MouseUp += (sender, e) => { World.Player.DexLock = (Lock)(((byte)World.Player.DexLock + 1) % 3); GameActions.ChangeStatLock(1, World.Player.DexLock); ushort gumpid = GetStatLockGraphic(World.Player.DexLock); _lockers[1].Graphic = gumpid; }; //AddChildren(_lockers[1] = new Button((int)ButtonType.LockerDex, gumpID, gumpID) //{ // X = xOffset, // Y = 102, // ButtonAction = ButtonAction.Activate //}); status = World.Player.IntLock; xOffset = Client.UseUOPGumps ? 28 : 40; gumpID = GetStatLockGraphic(status); Add(_lockers[2] = new GumpPic(xOffset, 132, gumpID, 0)); _lockers[2].MouseUp += (sender, e) => { World.Player.IntLock = (Lock)(((byte)World.Player.IntLock + 1) % 3); GameActions.ChangeStatLock(2, World.Player.IntLock); ushort gumpid = GetStatLockGraphic(World.Player.IntLock); _lockers[2].Graphic = gumpid; }; //AddChildren(_lockers[2] = new Button((int)ButtonType.LockerInt, gumpID, gumpID) //{ // X = xOffset, // Y = 132, // ButtonAction = ButtonAction.Activate //}); if (Client.UseUOPGumps) { xOffset = 80; AddStatTextLabel(World.Player.HitChanceIncrease.ToString(), MobileStats.HitChanceInc, xOffset, 161); Add(new HitBox(58, 154, 59, 24, "Hit Chance Increase", 1) { CanMove = true }); } else { xOffset = 88; } AddStatTextLabel(World.Player.Strength.ToString(), MobileStats.Strength, xOffset, 77); AddStatTextLabel(World.Player.Dexterity.ToString(), MobileStats.Dexterity, xOffset, 105); AddStatTextLabel(World.Player.Intelligence.ToString(), MobileStats.Intelligence, xOffset, 133); Add(new HitBox(58, 70, 59, 24, "Strength", 1) { CanMove = true }); Add(new HitBox(58, 98, 59, 24, "Dexterity", 1) { CanMove = true }); Add(new HitBox(58, 126, 59, 24, "Intelligence", 1) { CanMove = true }); int textWidth = 40; if (Client.UseUOPGumps) { xOffset = 150; AddStatTextLabel($"{World.Player.DefenseChanceIncrease}/{World.Player.MaxDefenseChanceIncrease}", MobileStats.DefenseChanceInc, xOffset, 161); Add(new HitBox(124, 154, 59, 24, "Defense Chance Increase", 1) { CanMove = true }); } else { xOffset = 146; } xOffset -= 5; AddStatTextLabel(World.Player.Hits.ToString(), MobileStats.HealthCurrent, xOffset, 70, textWidth, alignment: TEXT_ALIGN_TYPE.TS_CENTER); AddStatTextLabel(World.Player.HitsMax.ToString(), MobileStats.HealthMax, xOffset, 83, textWidth, alignment: TEXT_ALIGN_TYPE.TS_CENTER); AddStatTextLabel(World.Player.Stamina.ToString(), MobileStats.StaminaCurrent, xOffset, 98, textWidth, alignment: TEXT_ALIGN_TYPE.TS_CENTER); AddStatTextLabel(World.Player.StaminaMax.ToString(), MobileStats.StaminaMax, xOffset, 111, textWidth, alignment: TEXT_ALIGN_TYPE.TS_CENTER); AddStatTextLabel(World.Player.Mana.ToString(), MobileStats.ManaCurrent, xOffset, 126, textWidth, alignment: TEXT_ALIGN_TYPE.TS_CENTER); AddStatTextLabel(World.Player.ManaMax.ToString(), MobileStats.ManaMax, xOffset, 139, textWidth, alignment: TEXT_ALIGN_TYPE.TS_CENTER); xOffset += 5; Add(new Line(xOffset, 138, Math.Abs(xOffset - 185), 1, 0xFF383838)); Add(new Line(xOffset, 110, Math.Abs(xOffset - 185), 1, 0xFF383838)); Add(new Line(xOffset, 82, Math.Abs(xOffset - 185), 1, 0xFF383838)); Add(new HitBox(124, 70, 59, 24, "Hits Points", 1) { CanMove = true }); Add(new HitBox(124, 98, 59, 24, "Stamina", 1) { CanMove = true }); Add(new HitBox(124, 126, 59, 24, "Mana", 1) { CanMove = true }); if (Client.UseUOPGumps) { xOffset = 240; AddStatTextLabel(World.Player.LowerManaCost.ToString(), MobileStats.LowerManaCost, xOffset, 162); Add(new HitBox(205, 154, 65, 24, "Lower Mana Cost", 1) { CanMove = true }); } else { xOffset = 220; } AddStatTextLabel(World.Player.StatsCap.ToString(), MobileStats.StatCap, xOffset, 77); AddStatTextLabel(World.Player.Luck.ToString(), MobileStats.Luck, xOffset, 105); xOffset -= 10; AddStatTextLabel(World.Player.Weight.ToString(), MobileStats.WeightCurrent, xOffset, 126, textWidth, alignment: TEXT_ALIGN_TYPE.TS_CENTER); int lineX = Client.UseUOPGumps ? 236 : 216; Add(new Line(lineX, 138, Math.Abs(lineX - (Client.UseUOPGumps ? 270 : 250)), 1, 0xFF383838)); AddStatTextLabel(World.Player.WeightMax.ToString(), MobileStats.WeightMax, xOffset, 139, textWidth, alignment: TEXT_ALIGN_TYPE.TS_CENTER); xOffset = Client.UseUOPGumps ? 205 : 188; Add(new HitBox(xOffset, 70, 65, 24, "Maximum Stats", 1) { CanMove = true }); Add(new HitBox(xOffset, 98, 65, 24, "Luck", 1) { CanMove = true }); Add(new HitBox(xOffset, 126, 65, 24, "Weight", 1) { CanMove = true }); if (Client.UseUOPGumps) { xOffset = 320; AddStatTextLabel(World.Player.DamageIncrease.ToString(), MobileStats.DamageChanceInc, xOffset, 105); AddStatTextLabel(World.Player.SwingSpeedIncrease.ToString(), MobileStats.SwingSpeedInc, xOffset, 161); Add(new HitBox(285, 98, 69, 24, "Weapon Damage Increase", 1) { CanMove = true }); Add(new HitBox(285, 154, 69, 24, "Swing Speed Increase", 1) { CanMove = true }); } else { xOffset = 280; AddStatTextLabel(World.Player.Gold.ToString(), MobileStats.Gold, xOffset, 105); Add(new HitBox(260, 98, 69, 24, "Gold", 1) { CanMove = true }); } AddStatTextLabel($"{World.Player.DamageMin}-{World.Player.DamageMax}", MobileStats.Damage, xOffset, 77); AddStatTextLabel($"{World.Player.Followers}-{World.Player.FollowersMax}", MobileStats.Followers, xOffset, 133); xOffset = Client.UseUOPGumps ? 285 : 260; Add(new HitBox(xOffset, 70, 69, 24, "Damage", 1) { CanMove = true }); Add(new HitBox(xOffset, 126, 69, 24, "Followers", 1) { CanMove = true }); if (Client.UseUOPGumps) { xOffset = 400; AddStatTextLabel(World.Player.LowerReagentCost.ToString(), MobileStats.LowerReagentCost, xOffset, 77); AddStatTextLabel(World.Player.SpellDamageIncrease.ToString(), MobileStats.SpellDamageInc, xOffset, 105); AddStatTextLabel(World.Player.FasterCasting.ToString(), MobileStats.FasterCasting, xOffset, 133); AddStatTextLabel(World.Player.FasterCastRecovery.ToString(), MobileStats.FasterCastRecovery, xOffset, 161); xOffset = 365; Add(new HitBox(xOffset, 70, 55, 24, "Lower Reagent Cost", 1) { CanMove = true }); Add(new HitBox(xOffset, 98, 55, 24, "Spell Damage Increase", 1) { CanMove = true }); Add(new HitBox(xOffset, 126, 55, 24, "Faster Casting", 1) { CanMove = true }); Add(new HitBox(xOffset, 154, 55, 24, "Faster Cast Recovery", 1) { CanMove = true }); xOffset = 480; AddStatTextLabel(World.Player.Gold.ToString(), MobileStats.Gold, xOffset, 161); Add(new HitBox(445, 154, 55, 24, "Gold", 1) { CanMove = true }); xOffset = 475; AddStatTextLabel($"{World.Player.PhysicalResistance}/{World.Player.MaxPhysicResistence}", MobileStats.AR, xOffset, 74); AddStatTextLabel($"{World.Player.FireResistance}/{World.Player.MaxFireResistence}", MobileStats.RF, xOffset, 92); AddStatTextLabel($"{World.Player.ColdResistance}/{World.Player.MaxColdResistence}", MobileStats.RC, xOffset, 106); AddStatTextLabel($"{World.Player.PoisonResistance}/{World.Player.MaxPoisonResistence}", MobileStats.RP, xOffset, 120); AddStatTextLabel($"{World.Player.EnergyResistance}/{World.Player.MaxEnergyResistence}", MobileStats.RE, xOffset, 134); } else { xOffset = 354; AddStatTextLabel(World.Player.PhysicalResistance.ToString(), MobileStats.AR, xOffset, 76); AddStatTextLabel(World.Player.FireResistance.ToString(), MobileStats.RF, xOffset, 92); AddStatTextLabel(World.Player.ColdResistance.ToString(), MobileStats.RC, xOffset, 106); AddStatTextLabel(World.Player.PoisonResistance.ToString(), MobileStats.RP, xOffset, 120); AddStatTextLabel(World.Player.EnergyResistance.ToString(), MobileStats.RE, xOffset, 134); } xOffset = Client.UseUOPGumps ? 445 : 334; Add(new HitBox(xOffset, 76, 40, 14, "Physical Resistance", 1) { CanMove = true }); Add(new HitBox(xOffset, 92, 40, 14, "Fire Resistance", 1) { CanMove = true }); Add(new HitBox(xOffset, 106, 40, 14, "Cold Resistance", 1) { CanMove = true }); Add(new HitBox(xOffset, 120, 40, 14, "Poison Resistance", 1) { CanMove = true }); Add(new HitBox(xOffset, 134, 40, 14, "Energy Resistance", 1) { CanMove = true }); } else { if (Client.Version == ClientVersion.CV_308D) { AddStatTextLabel(World.Player.StatsCap.ToString(), MobileStats.StatCap, 171, 124); Add(new HitBox(171, 124, 34, 12, "Max Stats", 1) { CanMove = true }); } else if (Client.Version == ClientVersion.CV_308J) { AddStatTextLabel(World.Player.StatsCap.ToString(), MobileStats.StatCap, 180, 131); AddStatTextLabel($"{World.Player.Followers}/{World.Player.FollowersMax}", MobileStats.Followers, 180, 144); Add(new HitBox(180, 131, 34, 12, "Max Stats", 1) { CanMove = true }); Add(new HitBox(171, 144, 34, 12, "Followers", 1) { CanMove = true }); } } if (Client.UseUOPGumps) { p.X = 540; p.Y = 180; } Add(new HitBox(p.X, p.Y, 16, 16, "Minimize", 1) { CanMove = true }); _point = p; }
public override void OnButtonClick(int buttonID) { switch ((Buttons)buttonID) { case Buttons.Help: GameActions.RequestHelp(); break; case Buttons.Options: OptionsGump gump = Engine.UI.GetByLocalSerial <OptionsGump>(); if (gump == null) { Engine.UI.Add(new OptionsGump { X = Engine.WindowWidth / 2 - 300, Y = Engine.WindowHeight / 2 - 250 }); } else { gump.SetInScreen(); gump.BringOnTop(); } break; case Buttons.LogOut: Engine.SceneManager.GetScene <GameScene>()?.RequestQuitGame(); break; case Buttons.Quests: GameActions.RequestQuestMenu(); break; case Buttons.Skills: World.SkillsRequested = true; NetClient.Socket.Send(new PSkillsRequest(World.Player)); break; case Buttons.Guild: GameActions.OpenGuildGump(); break; case Buttons.PeaceWarToggle: GameActions.ToggleWarMode(); break; case Buttons.Status: if (Mobile == World.Player) { Engine.UI.GetByLocalSerial <HealthBarGump>(Mobile)?.Dispose(); StatusGumpBase status = StatusGumpBase.GetStatusGump(); if (status == null) { StatusGumpBase.AddStatusGump(Mouse.Position.X - 100, Mouse.Position.Y - 25); } else { status.BringOnTop(); } } else { if (Engine.UI.GetByLocalSerial <HealthBarGump>(Mobile) != null) { break; } GameActions.RequestMobileStatus(Mobile); Rectangle bounds = FileManager.Gumps.GetTexture(0x0804).Bounds; Engine.UI.Add(new HealthBarGump(Mobile) { X = Mouse.Position.X - (bounds.Width / 2), Y = Mouse.Position.Y - 5, }); } break; } }
public override void OnButtonClick(int buttonID) { switch ((Buttons)buttonID) { case Buttons.Help: GameActions.RequestHelp(); break; case Buttons.Options: if (Engine.UI.GetByLocalSerial <OptionsGump1>() == null) { Engine.UI.Add(new OptionsGump1 { X = 80, Y = 80 }); } else { Engine.UI.Remove <OptionsGump1>(); } break; case Buttons.LogOut: Engine.UI.Add(new LogoutGump()); Log.Message(LogTypes.Info, "Logout request sent!"); break; case Buttons.Quests: GameActions.RequestQuestMenu(); break; case Buttons.Skills: if (Engine.UI.GetByLocalSerial <SkillGumpAdvanced>() == null) { Engine.UI.Add(new SkillGumpAdvanced()); } else { Engine.UI.Remove <SkillGumpAdvanced>(); } break; case Buttons.Guild: GameActions.OpenGuildGump(); break; case Buttons.PeaceWarToggle: GameActions.ToggleWarMode(); break; case Buttons.Status: if (Engine.UI.GetByLocalSerial <StatusGump>() == null) { Engine.UI.Add(new StatusGump()); } else { Engine.UI.Remove <StatusGump>(); } break; } }
static void Main(string[] args) { var Menu = true; //Setting The Game //Main Menu while (Menu) { int choice; var consoleKey = MainMenu.GetConsoleKey(); if (consoleKey.Key == ConsoleKey.Escape) { break; } else if (int.TryParse(consoleKey.KeyChar.ToString(), out choice) == false || consoleKey.Key == ConsoleKey.H) { continue; } Console.Clear(); //Setting the Board var board = SettingGame.GetBoard(choice); //Declaring Which Main Class (Action Handler Class : IPawnActionHandler(Implemetation)) I Want To Execute With Gameplay Class!!! var GamePlay = new GamePlay(new PawnActionHandler()); var GameOn = true; //Plyer Request = User Input and Current Board var playerRequest = new PlayerRequest(); //The Game Started while (GameOn) { //Printing The Board DisplayBoard.Display(board); //The Player Enters Input var playerinput = GameInput.GetPlayerInput(board); if (playerinput.Equals(false)) { Thread.Sleep(2000); Console.Clear(); break; } //If The Player Couldn't Play Because The Input Wasn't Good To Play a Turn (Move or Eat a Pawn) it will equals to true var anotherTurn = true; playerRequest.MovementInput = (Input)playerinput; playerRequest.Board = board; //The player Try to Move if (GameActions.Move(playerRequest, board, GamePlay) == true) { anotherTurn = false; } //The Player Try to Eat else { Console.WriteLine("\nUnssucceful Move...\n"); Thread.Sleep(2000); if (GameActions.Eat(playerRequest, board, GamePlay) == true) { anotherTurn = false; } else { Console.WriteLine("\nUnsuccessful First Eat Move...\n"); Thread.Sleep(2000); } } //The Player Didn't Success To Move or to Eat if (anotherTurn == true) { continue; } //Check If The Pawns Neeeds To Change (Type) ChangeTypes.ChangeTheTypes(board); //Exit?? If Someone lost all of his pawns if (Exit.ExitCheck() == true) { GameOn = false; continue; } //Current Color Turn board.CurrentTurn = Colors.ChangeTheColor(board.CurrentTurn); //Save Game??? //if (SettingGame.SaveGame(board) == true) // GameOn = false; //Console.WriteLine($"\nBlack Pawns = {SettingGame.BlackPawnsAlive.Count}\nWhite Pawns = {SettingGame.WhitePawnsAlive.Count}\n"); } } }
private bool OnLeftMouseUp() { if (UIManager.PopupMenu != null && !UIManager.PopupMenu.Bounds.Contains(Mouse.Position.X, Mouse.Position.Y)) { UIManager.ShowGamePopup(null); } if (_isMouseLeftDown) { _isMouseLeftDown = false; _holdMouse2secOverItemTime = 0; } // drag-select code comes first to allow selection finish on mouseup outside of viewport if (_selectionStart.X == Mouse.Position.X && _selectionStart.Y == Mouse.Position.Y) { _isSelectionActive = false; } if (_isSelectionActive) { DoDragSelect(); return(true); } if (!UIManager.IsMouseOverWorld) { return(false); } if (UIManager.SystemChat != null && !UIManager.SystemChat.IsFocused) { UIManager.KeyboardFocusControl = null; UIManager.SystemChat.SetFocus(); } if (!ProfileManager.CurrentProfile.DisableAutoMove && _rightMousePressed) { _continueRunning = true; } BaseGameObject lastObj = SelectedObject.LastLeftDownObject; SelectedObject.LastLeftDownObject = null; if (UIManager.IsDragging) { return(false); } if (ItemHold.Enabled && !ItemHold.IsFixedPosition) { uint drop_container = 0xFFFF_FFFF; bool can_drop = false; ushort dropX = 0; ushort dropY = 0; sbyte dropZ = 0; GameObject gobj = SelectedObject.LastObject as GameObject; if (gobj is Entity obj) { can_drop = obj.Distance <= Constants.DRAG_ITEMS_DISTANCE; if (can_drop) { if (obj is Item it && it.ItemData.IsContainer || obj is Mobile) { dropX = 0xFFFF; dropY = 0xFFFF; dropZ = 0; drop_container = obj.Serial; } else if (obj is Item it2 && (it2.ItemData.IsSurface || it2.ItemData.IsStackable && it2.Graphic == ItemHold.Graphic)) { dropX = obj.X; dropY = obj.Y; dropZ = obj.Z; if (it2.ItemData.IsSurface) { dropZ += (sbyte)(it2.ItemData.Height == 0xFF ? 0 : it2.ItemData.Height); } else { drop_container = obj.Serial; } } } else { Client.Game.Scene.Audio.PlaySound(0x0051); } } else if (gobj is Land || gobj is Static || gobj is Multi) { can_drop = gobj.Distance <= Constants.DRAG_ITEMS_DISTANCE; if (can_drop) { dropX = gobj.X; dropY = gobj.Y; dropZ = gobj.Z; } else { Client.Game.Scene.Audio.PlaySound(0x0051); } } if (can_drop) { if (drop_container == 0xFFFF_FFFF && dropX == 0 && dropY == 0) { can_drop = false; } if (can_drop) { GameActions.DropItem(ItemHold.Serial, dropX, dropY, dropZ, drop_container); } } }
private int Process(MacroObject macro) { int result = 0; switch (macro.Code) { case MacroType.Say: case MacroType.Emote: case MacroType.Whisper: case MacroType.Yell: MacroObjectString mos = (MacroObjectString)macro; if (!string.IsNullOrEmpty(mos.Text)) { MessageType type = MessageType.Regular; ushort hue = Engine.Profile.Current.SpeechHue; switch (macro.Code) { case MacroType.Emote: type = MessageType.Emote; hue = Engine.Profile.Current.EmoteHue; break; case MacroType.Whisper: type = MessageType.Whisper; hue = Engine.Profile.Current.WhisperHue; break; case MacroType.Yell: type = MessageType.Yell; break; } Chat.Say(mos.Text, hue, type); } break; case MacroType.Walk: byte dt = (byte)Direction.Up; if (macro.SubCode != MacroSubType.NW) { dt = (byte)(macro.SubCode - 2); if (dt > 7) { dt = 0; } } if (!Pathfinder.AutoWalking) { World.Player.Walk((Direction)dt, false); } break; case MacroType.WarPeace: GameActions.ToggleWarMode(); break; case MacroType.Paste: if (SDL.SDL_HasClipboardText() != SDL.SDL_bool.SDL_FALSE) { string s = SDL.SDL_GetClipboardText(); if (!string.IsNullOrEmpty(s)) { WorldViewportGump viewport = Engine.UI.GetByLocalSerial <WorldViewportGump>(); if (viewport != null) { SystemChatControl chat = viewport.FindControls <SystemChatControl>().SingleOrDefault(); if (chat != null) { chat.textBox.Text += s; } } } } break; case MacroType.Open: case MacroType.Close: case MacroType.Minimize: case MacroType.Maximize: // TODO: break; case MacroType.OpenDoor: GameActions.OpenDoor(); break; case MacroType.UseSkill: int skill = macro.SubCode - MacroSubType.Anatomy; if (skill >= 0 && skill < 24) { skill = _skillTable[skill]; if (skill != 0xFF) { GameActions.UseSkill(skill); } } break; case MacroType.LastSkill: GameActions.UseSkill(GameActions.LastSkillIndex); break; case MacroType.CastSpell: int spell = macro.SubCode - MacroSubType.Clumsy + 1; if (spell > 0 && spell <= 151) { int totalCount = 0; int spellType = 0; for (spellType = 0; spellType < 7; spellType++) { totalCount += _spellsCountTable[spellType]; if (spell < totalCount) { break; } } if (spellType < 7) { spell += spellType * 100; if (spellType > 2) { spell += 100; } GameActions.CastSpell(spell); } } break; case MacroType.LastSpell: GameActions.CastSpell(GameActions.LastSpellIndex); break; case MacroType.Bow: case MacroType.Salute: int index = macro.Code - MacroType.Bow; const string BOW = "bow"; const string SALUTE = "salute"; GameActions.EmoteAction(index == 0 ? BOW : SALUTE); break; case MacroType.QuitGame: Engine.SceneManager.GetScene <GameScene>()?.RequestQuitGame(); break; case MacroType.AllNames: GameActions.AllNames(); break; case MacroType.LastTarget: if (WaitForTargetTimer == 0) { WaitForTargetTimer = Engine.Ticks + Constants.WAIT_FOR_TARGET_DELAY; } if (TargetManager.IsTargeting) { //if (TargetManager.TargetingState != TargetType.Object) //{ // TargetManager.TargetGameObject(TargetManager.LastGameObject); //} //else TargetManager.TargetGameObject(World.Get(TargetManager.LastGameObject)); WaitForTargetTimer = 0; } else if (WaitForTargetTimer < Engine.Ticks) { WaitForTargetTimer = 0; } else { result = 1; } break; case MacroType.TargetSelf: if (WaitForTargetTimer == 0) { WaitForTargetTimer = Engine.Ticks + Constants.WAIT_FOR_TARGET_DELAY; } if (TargetManager.IsTargeting) { TargetManager.TargetGameObject(World.Player); WaitForTargetTimer = 0; } else if (WaitForTargetTimer < Engine.Ticks) { WaitForTargetTimer = 0; } else { result = 1; } break; case MacroType.ArmDisarm: int handIndex = 1 - (macro.SubCode - MacroSubType.LeftHand); GameScene gs = Engine.SceneManager.GetScene <GameScene>(); if (handIndex < 0 || handIndex > 1 || gs.IsHoldingItem) { break; } if (_itemsInHand[handIndex] != 0) { Item item = World.Items.Get(_itemsInHand[handIndex]); if (item != null) { GameActions.PickUp(item, 1); gs.WearHeldItem(World.Player); } _itemsInHand[handIndex] = 0; } else { Item backpack = World.Player.Equipment[(int)Layer.Backpack]; if (backpack == null) { break; } Item item = World.Player.Equipment[(int)Layer.OneHanded + handIndex]; if (item != null) { _itemsInHand[handIndex] = item.Serial; GameActions.PickUp(item, 1); GameActions.DropItem(item, Position.INVALID, backpack); } } break; case MacroType.WaitForTarget: if (WaitForTargetTimer == 0) { WaitForTargetTimer = Engine.Ticks + Constants.WAIT_FOR_TARGET_DELAY; } if (TargetManager.IsTargeting || WaitForTargetTimer < Engine.Ticks) { WaitForTargetTimer = 0; } else { result = 1; } break; case MacroType.TargetNext: if (TargetManager.LastGameObject.IsMobile) { Mobile mob = World.Mobiles.Get(TargetManager.LastGameObject); if (mob.HitsMax == 0) { NetClient.Socket.Send(new PStatusRequest(mob)); } World.LastAttack = mob.Serial; } break; case MacroType.AttackLast: GameActions.Attack(World.LastAttack); break; case MacroType.Delay: MacroObjectString mosss = (MacroObjectString)macro; string str = mosss.Text; if (!string.IsNullOrEmpty(str) && int.TryParse(str, out int rr)) { _nextTimer = Engine.Ticks + rr; } break; case MacroType.CircleTrans: Engine.Profile.Current.UseCircleOfTransparency = !Engine.Profile.Current.UseCircleOfTransparency; break; case MacroType.CloseGump: Engine.UI.Gumps .Where(s => !(s is TopBarGump) && !(s is BuffGump) && !(s is WorldViewportGump)) .ToList() .ForEach(s => s.Dispose()); break; case MacroType.AlwaysRun: Engine.Profile.Current.AlwaysRun = !Engine.Profile.Current.AlwaysRun; break; case MacroType.SaveDesktop: Engine.Profile.Current?.Save(Engine.UI.Gumps.OfType <Gump>().Where(s => s.CanBeSaved).Reverse().ToList()); break; case MacroType.EnableRangeColor: Engine.Profile.Current.NoColorObjectsOutOfRange = true; break; case MacroType.DisableRangeColor: Engine.Profile.Current.NoColorObjectsOutOfRange = false; break; case MacroType.ToggleRangeColor: Engine.Profile.Current.NoColorObjectsOutOfRange = !Engine.Profile.Current.NoColorObjectsOutOfRange; break; case MacroType.AttackSelectedTarget: // TODO: break; case MacroType.UseSelectedTarget: // TODO: break; case MacroType.CurrentTarget: // TODO: break; case MacroType.TargetSystemOnOff: // TODO: break; case MacroType.BandageSelf: case MacroType.BandageTarget: if (FileManager.ClientVersion < ClientVersions.CV_5020 || Engine.Profile.Current.BandageSelfOld) { if (WaitingBandageTarget) { if (WaitForTargetTimer == 0) { WaitForTargetTimer = Engine.Ticks + Constants.WAIT_FOR_TARGET_DELAY; } if (TargetManager.IsTargeting) { TargetManager.TargetGameObject(macro.Code == MacroType.BandageSelf ? World.Player : World.Mobiles.Get(TargetManager.LastGameObject)); } else { result = 1; } WaitingBandageTarget = false; WaitForTargetTimer = 0; } else { var bandage = World.Player.FindBandage(); if (bandage != null) { WaitingBandageTarget = true; GameActions.DoubleClick(bandage); result = 1; } } } else { var bandage = World.Player.FindBandage(); if (bandage != null) { if (macro.Code == MacroType.BandageSelf) { NetClient.Socket.Send(new PTargetSelectedObject(bandage.Serial, World.Player.Serial)); } else { // TODO: NewTargetSystem Log.Message(LogTypes.Warning, $"BandageTarget (NewTargetSystem) not implemented yet."); } } } break; case MacroType.SetUpdateRange: case MacroType.ModifyUpdateRange: if (macro is MacroObjectString moss && !string.IsNullOrEmpty(moss.Text) && byte.TryParse(moss.Text, out byte res)) { if (res < Constants.MIN_VIEW_RANGE) { res = Constants.MIN_VIEW_RANGE; } else if (res > Constants.MAX_VIEW_RANGE) { res = Constants.MAX_VIEW_RANGE; } World.ViewRange = res; } break; case MacroType.IncreaseUpdateRange: World.ViewRange++; if (World.ViewRange > Constants.MAX_VIEW_RANGE) { World.ViewRange = Constants.MAX_VIEW_RANGE; } break; case MacroType.DecreaseUpdateRange: World.ViewRange--; if (World.ViewRange < Constants.MIN_VIEW_RANGE) { World.ViewRange = Constants.MIN_VIEW_RANGE; } break; case MacroType.MaxUpdateRange: World.ViewRange = Constants.MAX_VIEW_RANGE; break; case MacroType.MinUpdateRange: World.ViewRange = Constants.MIN_VIEW_RANGE; break; case MacroType.DefaultUpdateRange: World.ViewRange = Constants.MAX_VIEW_RANGE; break; case MacroType.SelectNext: case MacroType.SelectPrevious: case MacroType.SelectNearest: // TODO: int scantype = macro.SubCode - MacroSubType.Hostile; int scanRange = macro.Code - MacroType.SelectNext; switch (scanRange) { case 0: break; case 1: break; case 2: break; } break; case MacroType.ToggleBuiconWindow: BuffGump buff = Engine.UI.GetByLocalSerial <BuffGump>(); if (buff != null) { buff.Dispose(); } else { Engine.UI.Add(new BuffGump(100, 100)); } break; case MacroType.InvokeVirtue: byte id = (byte)(macro.SubCode - MacroSubType.Honor + 31); NetClient.Socket.Send(new PInvokeVirtueRequest(id)); break; case MacroType.PrimaryAbility: GameActions.UsePrimaryAbility(); break; case MacroType.SecondaryAbility: GameActions.UseSecondaryAbility(); break; case MacroType.ToggleGargoyleFly: if (World.Player.Race == RaceType.GARGOYLE) { NetClient.Socket.Send(new PToggleGargoyleFlying()); } break; case MacroType.EquipLastWeapon: NetClient.Socket.Send(new PEquipLastWeapon()); break; case MacroType.KillGumpOpen: // TODO: break; } return(result); }
private void RetryClicked() { GameActions.UIButtonClicked(Constants.Buttons.RETRY_BUTTON); }
public static void OnHueTarget(Entity entity) { TargetManager.TargetGameObject(entity); Mouse.LastLeftButtonClickTime = 0; GameActions.Print($"Item ID: {entity.Graphic}\nHue: {entity.Hue}"); }
/// <summary> /// The game action event raised. /// </summary> /// <param name="obj"> /// The obj. /// </param> private void GameActionEvent(GameActions obj) { // undo action if (obj == GameActions.Undo) { var undoState = this.undoRedo.Undo as Turn; if (undoState != null) { this.SetState(undoState); this.eventAggregator.GetEvent<UndoRedoRestoreEvent>().Publish(undoState.GameState); } } // Redo action if (obj == GameActions.Redo) { var redoState = this.undoRedo.Redo as Turn; if (redoState != null) { this.SetState(redoState); this.eventAggregator.GetEvent<UndoRedoRestoreEvent>().Publish(redoState.GameState); } } // New game action. Resets all if (obj != GameActions.NewGame) return; if (this.game.GameState != GameStates.InitialState) { this.ResetGame(); } }
/// <summary> /// The can execute. /// </summary> /// <param name="action"> /// The action. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> private bool CanExecute(GameActions? action) { // React to actions switch (action) { case GameActions.Undo: return this.undoRedo.CanUndo; case GameActions.Redo: return this.undoRedo.CanRedo; default: return true; } }
private void GamePaused(bool isPause) { GameActions.ShowUIScreen(UIScreen.Pause, isPause); }
private void QuitClicked() { GameActions.UIButtonClicked(Constants.Buttons.QUIT_BUTTON); }
public void ParsePacket(Packet p) { byte code = p.ReadByte(); bool add = false; switch (code) { case 1: add = true; goto case 2; case 2: byte count = p.ReadByte(); if (count <= 1) { Leader = 0; Inviter = 0; for (int i = 0; i < PARTY_SIZE; i++) { if (Members[i] == null || Members[i].Serial == 0) { break; } BaseHealthBarGump gump = UIManager.GetGump <BaseHealthBarGump>(Members[i].Serial); if (gump != null) { if (code == 2) { Members[i].Serial = 0; } gump.RequestUpdateContents(); } } Clear(); UIManager.GetGump <PartyGump>()?.RequestUpdateContents(); break; } Clear(); uint to_remove = 0xFFFF_FFFF; if (!add) { to_remove = p.ReadUInt(); UIManager.GetGump <BaseHealthBarGump>(to_remove)?.RequestUpdateContents(); } bool remove_all = !add && to_remove == World.Player; int done = 0; for (int i = 0; i < count; i++) { uint serial = p.ReadUInt(); bool remove = !add && (/*count <= 2 || */ serial == to_remove); if (remove && serial == to_remove && i == 0) { remove_all = true; } if (!remove && !remove_all) { if (!Contains(serial)) { Members[i] = new PartyMember(serial); } done++; } if (i == 0 && !remove && !remove_all) { Leader = serial; } BaseHealthBarGump gump = UIManager.GetGump <BaseHealthBarGump>(serial); if (gump != null) { GameActions.RequestMobileStatus(serial); gump.RequestUpdateContents(); } else { if (serial == World.Player) { } } } if (done <= 1 && !add) { for (int i = 0; i < PARTY_SIZE; i++) { if (Members[i] != null && SerialHelper.IsValid(Members[i].Serial)) { uint serial = Members[i].Serial; Members[i] = null; UIManager.GetGump <BaseHealthBarGump>(serial)?.RequestUpdateContents(); } } Clear(); } UIManager.GetGump <PartyGump>()?.RequestUpdateContents(); break; case 3: case 4: uint ser = p.ReadUInt(); string name = p.ReadUnicode(); for (int i = 0; i < PARTY_SIZE; i++) { if (Members[i] != null && Members[i].Serial == ser) { MessageManager.HandleMessage(null, name, Members[i].Name, ProfileManager.Current.PartyMessageHue, MessageType.Party, 3, TEXT_TYPE.OBJECT); break; } } break; case 7: Inviter = p.ReadUInt(); if (ProfileManager.Current.PartyInviteGump) { UIManager.Add(new PartyInviteGump(Inviter)); } break; } }
public static void Toggle() { GameActions.Print(String.Format("Defender:{0}abled", (IsEnabled = !IsEnabled) == true ? "En" : "Dis"), 1154); }
public void AddAction(GameActions.GameAction a) { _gameActions.Enqueue(a); }
public override void OnButtonClick(int buttonID) { switch ((Buttons)buttonID) { case Buttons.Map: MiniMapGump miniMapGump = UIManager.GetGump <MiniMapGump>(); if (miniMapGump == null) { UIManager.Add(new MiniMapGump()); } else { miniMapGump.SetInScreen(); miniMapGump.BringOnTop(); } break; case Buttons.Paperdoll: PaperDollGump paperdollGump = UIManager.GetGump <PaperDollGump>(World.Player); if (paperdollGump == null) { GameActions.OpenPaperdoll(World.Player); } else { paperdollGump.SetInScreen(); paperdollGump.BringOnTop(); } break; case Buttons.Inventory: Item backpack = World.Player.Equipment[(int)Layer.Backpack]; ContainerGump backpackGump = UIManager.GetGump <ContainerGump>(backpack); if (backpackGump == null) { GameActions.DoubleClick(backpack); } else { backpackGump.SetInScreen(); backpackGump.BringOnTop(); } break; case Buttons.Journal: JournalGump journalGump = UIManager.GetGump <JournalGump>(); if (journalGump == null) { UIManager.Add(new JournalGump { X = 64, Y = 64 }); } else { journalGump.SetInScreen(); journalGump.BringOnTop(); } break; case Buttons.Chat: if (UOChatManager.ChatIsEnabled) { UOChatGump chatGump = UIManager.GetGump <UOChatGump>(); if (chatGump == null) { UIManager.Add(new UOChatGump()); } else { chatGump.SetInScreen(); chatGump.BringOnTop(); } } break; case Buttons.GlobalChat: Log.Warn("Chat button pushed! Not implemented yet!"); GameActions.Print("GlobalChat not implemented yet.", 0x23, MessageType.System); break; case Buttons.UOStore: if (Client.Version >= ClientVersion.CV_706400) { NetClient.Socket.Send(new POpenUOStore()); } break; case Buttons.Help: GameActions.RequestHelp(); break; case Buttons.Debug: DebugGump debugGump = UIManager.GetGump <DebugGump>(); if (debugGump == null) { debugGump = new DebugGump { X = ProfileManager.Current.DebugGumpPosition.X, Y = ProfileManager.Current.DebugGumpPosition.Y }; UIManager.Add(debugGump); } else { debugGump.IsVisible = !debugGump.IsVisible; debugGump.SetInScreen(); } //Engine.DropFpsMinMaxValues(); break; case Buttons.WorldMap: WorldMapGump worldMap = UIManager.GetGump <WorldMapGump>(); if (worldMap == null || worldMap.IsDisposed) { worldMap = new WorldMapGump(); UIManager.Add(worldMap); } else { worldMap.BringOnTop(); worldMap.SetInScreen(); } break; case Buttons.TargetList: TargetMenuGump tm = UIManager.GetGump <TargetMenuGump>(); if (tm == null || tm.IsDisposed) { tm = new TargetMenuGump(); UIManager.Add(tm); } else { tm.BringOnTop(); tm.SetInScreen(); } break; } }
public override void OnButtonClick(int buttonID) { switch ((Buttons)buttonID) { case Buttons.Map: MiniMapGump miniMapGump = UIManager.GetGump <MiniMapGump>(); if (miniMapGump == null) { UIManager.Add(new MiniMapGump()); } else { miniMapGump.SetInScreen(); miniMapGump.BringOnTop(); } break; case Buttons.Paperdoll: PaperDollGump paperdollGump = UIManager.GetGump <PaperDollGump>(World.Player); if (paperdollGump == null) { GameActions.OpenPaperdoll(World.Player); } else { paperdollGump.SetInScreen(); paperdollGump.BringOnTop(); } break; case Buttons.Inventory: Item backpack = World.Player.FindItemByLayer(Layer.Backpack); if (backpack == null) { return; } ContainerGump backpackGump = UIManager.GetGump <ContainerGump>(backpack); if (backpackGump == null) { GameActions.DoubleClick(backpack); } else { backpackGump.SetInScreen(); backpackGump.BringOnTop(); } break; case Buttons.Journal: JournalGump journalGump = UIManager.GetGump <JournalGump>(); if (journalGump == null) { UIManager.Add(new JournalGump { X = 64, Y = 64 }); } else { journalGump.SetInScreen(); journalGump.BringOnTop(); } break; case Buttons.Chat: if (UOChatManager.ChatIsEnabled == CHAT_STATUS.ENABLED) { UOChatGump chatGump = UIManager.GetGump <UOChatGump>(); if (chatGump == null) { UIManager.Add(new UOChatGump()); } else { chatGump.SetInScreen(); chatGump.BringOnTop(); } } else if (UOChatManager.ChatIsEnabled == CHAT_STATUS.ENABLED_USER_REQUEST) { UOChatGumpChooseName chatGump = UIManager.GetGump <UOChatGumpChooseName>(); if (chatGump == null) { UIManager.Add(new UOChatGumpChooseName()); } else { chatGump.SetInScreen(); chatGump.BringOnTop(); } } break; case Buttons.GlobalChat: Log.Warn("Chat button pushed! Not implemented yet!"); GameActions.Print("GlobalChat not implemented yet.", 0x23, MessageType.System); break; case Buttons.UOStore: if (Client.Version >= ClientVersion.CV_706400) { NetClient.Socket.Send(new POpenUOStore()); } break; case Buttons.Help: GameActions.RequestHelp(); break; case Buttons.Debug: DebugGump debugGump = UIManager.GetGump <DebugGump>(); if (debugGump == null) { debugGump = new DebugGump(100, 100); UIManager.Add(debugGump); } else { debugGump.IsVisible = !debugGump.IsVisible; debugGump.SetInScreen(); } break; case Buttons.NetStats: NetworkStatsGump netstatsgump = UIManager.GetGump <NetworkStatsGump>(); if (netstatsgump == null) { netstatsgump = new NetworkStatsGump(100, 100); UIManager.Add(netstatsgump); } else { netstatsgump.IsVisible = !netstatsgump.IsVisible; netstatsgump.SetInScreen(); } break; case Buttons.WorldMap: WorldMapGump worldMap = UIManager.GetGump <WorldMapGump>(); if (worldMap == null || worldMap.IsDisposed) { worldMap = new WorldMapGump(); UIManager.Add(worldMap); } else { worldMap.BringOnTop(); worldMap.SetInScreen(); } break; } }
private void OnMouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButton.Left) { if (_dragginObject != null) { _dragginObject = null; } if (Engine.UI.IsDragging /*&& Mouse.LDroppedOffset != Point.Zero*/) { return; } if (TargetManager.IsTargeting) { switch (TargetManager.TargetingState) { case TargetType.Position: case TargetType.Object: GameObject obj = SelectedObject; if (obj != null) { TargetManager.TargetGameObject(obj); Mouse.LastLeftButtonClickTime = 0; } break; case TargetType.SetTargetClientSide: obj = SelectedObject; if (obj != null) { TargetManager.TargetGameObject(obj); Mouse.LastLeftButtonClickTime = 0; Engine.UI.Add(new InfoGump(obj)); } break; default: Log.Message(LogTypes.Warning, "Not implemented."); break; } } else if (IsHoldingItem) { SelectedObject = null; GameObject obj = _mousePicker.MouseOverObject; if (obj != null && obj.Distance < Constants.DRAG_ITEMS_DISTANCE) { switch (obj) { case Mobile mobile: MergeHeldItem(mobile); break; case Item item: if (item.IsCorpse) { MergeHeldItem(item); } else { SelectedObject = item; if (item.Graphic == HeldItem.Graphic && HeldItem.IsStackable) { MergeHeldItem(item); } else { DropHeldItemToWorld(obj.Position.X, obj.Position.Y, (sbyte)(obj.Position.Z + item.ItemData.Height)); } } break; case Multi multi: DropHeldItemToWorld(obj.Position.X, obj.Position.Y, (sbyte)(obj.Position.Z + multi.ItemData.Height)); break; case Static st: DropHeldItemToWorld(obj.Position.X, obj.Position.Y, (sbyte)(obj.Position.Z + st.ItemData.Height)); break; case Land _: DropHeldItemToWorld(obj.Position); break; default: Log.Message(LogTypes.Warning, "Unhandled mouse inputs for GameObject type " + obj.GetType()); return; } } else { Engine.SceneManager.CurrentScene.Audio.PlaySound(0x0051); } } else { GameObject obj = _mousePicker.MouseOverObject; switch (obj) { case Static st: string name = st.Name; if (string.IsNullOrEmpty(name)) { name = FileManager.Cliloc.GetString(1020000 + st.Graphic); } if (obj.Overheads.Count == 0) { obj.AddOverhead(MessageType.Label, name, 3, 0, false); } break; case Multi multi: name = multi.Name; if (string.IsNullOrEmpty(name)) { name = FileManager.Cliloc.GetString(1020000 + multi.Graphic); } if (obj.Overheads.Count == 0) { obj.AddOverhead(MessageType.Label, name, 3, 0, false); } break; case Entity entity: if (!_inqueue) { _inqueue = true; _queuedObject = entity; _dequeueAt = Mouse.MOUSE_DELAY_DOUBLE_CLICK; _queuedAction = () => { if (!World.ClientFlags.TooltipsEnabled) { GameActions.SingleClick(_queuedObject); } GameActions.OpenPopupMenu(_queuedObject); }; } break; } } } else if (e.Button == MouseButton.Right) { if (_rightMousePressed) { _rightMousePressed = false; } } }
public static void Target(uint serial) { if (!IsTargeting) { return; } Entity entity = World.InGame ? World.Get(serial) : null; if (entity != null) { switch (TargetingState) { case CursorTarget.Invalid: return; case CursorTarget.MultiPlacement: case CursorTarget.Position: case CursorTarget.Object: case CursorTarget.HueCommandTarget: case CursorTarget.SetTargetClientSide: if (entity != World.Player) { LastTargetInfo.SetEntity(serial); } if (SerialHelper.IsMobile(serial) && serial != World.Player && (World.Player.NotorietyFlag == NotorietyFlag.Innocent || World.Player.NotorietyFlag == NotorietyFlag.Ally)) { Mobile mobile = entity as Mobile; if (mobile != null) { bool showCriminalQuery = false; if (TargetingType == TargetType.Harmful && ProfileManager.CurrentProfile.EnabledCriminalActionQuery && mobile.NotorietyFlag == NotorietyFlag.Innocent) { showCriminalQuery = true; } else if (TargetingType == TargetType.Beneficial && ProfileManager.CurrentProfile.EnabledBeneficialCriminalActionQuery && (mobile.NotorietyFlag == NotorietyFlag.Criminal || mobile.NotorietyFlag == NotorietyFlag.Murderer || mobile.NotorietyFlag == NotorietyFlag.Gray)) { showCriminalQuery = true; } if (showCriminalQuery && UIManager.GetGump <QuestionGump>() == null) { QuestionGump messageBox = new QuestionGump ( "This may flag\nyou criminal!", s => { if (s) { NetClient.Socket.Send_TargetObject(entity, entity.Graphic, entity.X, entity.Y, entity.Z, _targetCursorId, (byte)TargetingType); ClearTargetingWithoutTargetCancelPacket(); if (LastTargetInfo.Serial != serial) { GameActions.RequestMobileStatus(serial); } } } ); UIManager.Add(messageBox); return; } } } if (TargetingState != CursorTarget.SetTargetClientSide) { _lastDataBuffer[0] = 0x6C; _lastDataBuffer[1] = 0x00; _lastDataBuffer[2] = (byte)(_targetCursorId >> 24); _lastDataBuffer[3] = (byte)(_targetCursorId >> 16); _lastDataBuffer[4] = (byte)(_targetCursorId >> 8); _lastDataBuffer[5] = (byte)_targetCursorId; _lastDataBuffer[6] = (byte)TargetingType; _lastDataBuffer[7] = (byte)(entity.Serial >> 24); _lastDataBuffer[8] = (byte)(entity.Serial >> 16); _lastDataBuffer[9] = (byte)(entity.Serial >> 8); _lastDataBuffer[10] = (byte)entity.Serial; _lastDataBuffer[11] = (byte)(entity.X >> 8); _lastDataBuffer[12] = (byte)entity.X; _lastDataBuffer[13] = (byte)(entity.Y >> 8); _lastDataBuffer[14] = (byte)entity.Y; _lastDataBuffer[15] = (byte)(entity.Z >> 8); _lastDataBuffer[16] = (byte)entity.Z; _lastDataBuffer[17] = (byte)(entity.Graphic >> 8); _lastDataBuffer[18] = (byte)entity.Graphic; NetClient.Socket.Send_TargetObject(entity, entity.Graphic, entity.X, entity.Y, entity.Z, _targetCursorId, (byte)TargetingType); if (SerialHelper.IsMobile(serial) && LastTargetInfo.Serial != serial) { GameActions.RequestMobileStatus(serial); } } ClearTargetingWithoutTargetCancelPacket(); Mouse.CancelDoubleClick = true; break; case CursorTarget.Grab: if (SerialHelper.IsItem(serial)) { GameActions.GrabItem(serial, ((Item)entity).Amount); } ClearTargetingWithoutTargetCancelPacket(); return; case CursorTarget.SetGrabBag: if (SerialHelper.IsItem(serial)) { ProfileManager.CurrentProfile.GrabBagSerial = serial; GameActions.Print(string.Format(ResGeneral.GrabBagSet0, serial)); } ClearTargetingWithoutTargetCancelPacket(); return; } } }
protected override void UpdateContents() { const int GRID_ITEM_SIZE = 50; int x = 20; int y = 20; foreach (GridLootItem gridLootItem in Children.OfType <GridLootItem>()) { gridLootItem.Dispose(); } int count = 0; _pagesCount = 1; _background.Width = x; _background.Height = y; int line = 1; int row = 0; for (LinkedObject i = _corpse.Items; i != null; i = i.Next) { Item it = (Item)i; if (it.IsLootable) { GridLootItem gridItem = new GridLootItem(it, GRID_ITEM_SIZE); if (x >= MAX_WIDTH - 20) { x = 20; ++line; y += gridItem.Height + 20; if (y >= MAX_HEIGHT - 40) { _pagesCount++; y = 20; //line = 1; } } gridItem.X = x; gridItem.Y = y; Add(gridItem, _pagesCount); x += gridItem.Width + 20; ++row; ++count; } } _background.Width = (GRID_ITEM_SIZE + 20) * row + 20; _background.Height = 20 + 40 + (GRID_ITEM_SIZE + 20) * line + 20; if (_background.Height >= MAX_HEIGHT - 40) { _background.Height = MAX_HEIGHT; } _background.Width = MAX_WIDTH; if (ActivePage <= 1) { ActivePage = 1; _buttonNext.IsVisible = _pagesCount > 1; _buttonPrev.IsVisible = false; } else if (ActivePage >= _pagesCount) { ActivePage = _pagesCount; _buttonNext.IsVisible = false; _buttonPrev.IsVisible = _pagesCount > 1; } else if (ActivePage > 1 && ActivePage < _pagesCount) { _buttonNext.IsVisible = true; _buttonPrev.IsVisible = true; } if (count == 0) { GameActions.Print(ResGumps.CorpseIsEmpty); Dispose(); } else if (_hideIfEmpty && !IsVisible) { IsVisible = true; } }
private void BuildGump() { AcceptMouseInput = false; CanBeSaved = true; CanMove = true; LocalSerial = Mobile.Serial; if (Mobile == World.Player) { Add(new GumpPic(0, 0, 0x07d0, 0)); //HELP BUTTON Add(new Button((int)Buttons.Help, 0x07ef, 0x07f0, 0x07f1) { X = 185, Y = 44 + 27 * 0, ButtonAction = ButtonAction.Activate }); //OPTIONS BUTTON Add(new Button((int)Buttons.Options, 0x07d6, 0x07d7, 0x07d8) { X = 185, Y = 44 + 27 * 1, ButtonAction = ButtonAction.Activate }); // LOG OUT BUTTON Add(new Button((int)Buttons.LogOut, 0x07d9, 0x07da, 0x07db) { X = 185, Y = 44 + 27 * 2, ButtonAction = ButtonAction.Activate }); // QUESTS BUTTON Add(new Button((int)Buttons.Quests, 0x57b5, 0x57b7, 0x57b6) { X = 185, Y = 44 + 27 * 3, ButtonAction = ButtonAction.Activate }); // SKILLS BUTTON Add(new Button((int)Buttons.Skills, 0x07df, 0x07e0, 0x07e1) { X = 185, Y = 44 + 27 * 4, ButtonAction = ButtonAction.Activate }); // GUILD BUTTON Add(new Button((int)Buttons.Guild, 0x57b2, 0x57b4, 0x57b3) { X = 185, Y = 44 + 27 * 5, ButtonAction = ButtonAction.Activate }); // TOGGLE PEACE/WAR BUTTON _isWarMode = Mobile.InWarMode; ushort[] btngumps = _isWarMode ? WarModeBtnGumps : PeaceModeBtnGumps; Add(_warModeBtn = new Button((int)Buttons.PeaceWarToggle, btngumps[0], btngumps[1], btngumps[2]) { X = 185, Y = 44 + 27 * 6, ButtonAction = ButtonAction.Activate }); // STATUS BUTTON Add(new Button((int)Buttons.Status, 0x07eb, 0x07ec, 0x07ed) { X = 185, Y = 44 + 27 * 7, ButtonAction = ButtonAction.Activate }); // Virtue menu Add(_virtueMenuPic = new GumpPic(79, 4, 0x0071, 0)); _virtueMenuPic.MouseDoubleClick += VirtueMenu_MouseDoubleClickEvent; int profileX = 25; const int SCROLLS_STEP = 14; if (World.ClientFlags.PaperdollBooks) { Add(_combatBook = new GumpPic(156, 200, 0x2B34, 0)); _combatBook.MouseDoubleClick += (sender, e) => { GameActions.OpenAbilitiesBook(); }; if (FileManager.ClientVersion >= ClientVersions.CV_7000) { Add(_racialAbilitiesBook = new GumpPic(23, 200, 0x2B28, 0)); _racialAbilitiesBook.MouseDoubleClick += (sender, e) => { if (Engine.UI.GetByLocalSerial <RacialAbilitiesBookGump>() == null) { Engine.UI.Add(new RacialAbilitiesBookGump(100, 100)); } }; profileX += SCROLLS_STEP; } } Add(_profilePic = new GumpPic(profileX, 196, 0x07D2, 0)); _profilePic.MouseDoubleClick += Profile_MouseDoubleClickEvent; profileX += SCROLLS_STEP; Add(_partyManifestPic = new GumpPic(profileX, 196, 0x07D2, 0)); _partyManifestPic.MouseDoubleClick += PartyManifest_MouseDoubleClickEvent; } else { Add(new GumpPic(0, 0, 0x07d1, 0)); // STATUS BUTTON Add(new Button((int)Buttons.Status, 0x07eb, 0x07ec, 0x07ed) { X = 185, Y = 44 + 27 * 7, ButtonAction = ButtonAction.Activate }); } // Equipment slots for hat/earrings/neck/ring/bracelet Add(new EquipmentSlot(2, 76, Mobile, Layer.Helmet)); Add(new EquipmentSlot(2, 76 + 22, Mobile, Layer.Earrings)); Add(new EquipmentSlot(2, 76 + 22 * 2, Mobile, Layer.Necklace)); Add(new EquipmentSlot(2, 76 + 22 * 3, Mobile, Layer.Ring)); Add(new EquipmentSlot(2, 76 + 22 * 4, Mobile, Layer.Bracelet)); Add(new EquipmentSlot(2, 76 + 22 * 5, Mobile, Layer.Tunic)); // Paperdoll control! _paperDollInteractable = new PaperDollInteractable(8, 21, Mobile); //_paperDollInteractable.MouseOver += (sender, e) => //{ // OnMouseOver(e.X, e.Y); //}; Add(_paperDollInteractable); // Name and title Label titleLabel = new Label(Title, false, 0x0386, 185) { X = 39, Y = 262 }; Add(titleLabel); }
public GridLootItem(uint serial, int size) { LocalSerial = serial; Item item = World.Items.Get(serial); if (item == null) { Dispose(); return; } CanMove = false; HSliderBar amount = new HSliderBar ( 0, 0, size, 1, item.Amount, item.Amount, HSliderBarStyle.MetalWidgetRecessedBar, true, color: 0xFFFF, drawUp: true ); Add(amount); amount.IsVisible = amount.IsEnabled = amount.MaxValue > 1; AlphaBlendControl background = new AlphaBlendControl(); background.Y = 15; background.Width = size; background.Height = size; Add(background); _texture = new TextureControl(); _texture.IsPartial = item.ItemData.IsPartialHue; _texture.ScaleTexture = true; _texture.Hue = item.Hue; _texture.Texture = ArtLoader.Instance.GetTexture(item.DisplayedGraphic); _texture.Y = 15; _texture.Width = size; _texture.Height = size; _texture.CanMove = false; if (World.ClientFeatures.TooltipsEnabled) { _texture.SetTooltip(item); } Add(_texture); _texture.MouseUp += (sender, e) => { if (e.Button == MouseButtonType.Left) { GameActions.GrabItem(item, (ushort)amount.Value); } }; Width = background.Width; Height = background.Height + 15; WantUpdateSize = false; }
public static void UseAutoPotion() { GameScene gs = Client.Game.GetScene <GameScene>(); if (World.Player != null) { var _backpack = World.Player.FindItemByLayer(Layer.Backpack); if (!World.Player.IsDead && !TargetManager.IsTargeting) { if (_backpack == null) { return; } _twohand = World.Player.FindItemByLayer(Layer.TwoHanded); if (_twohand != null) { GameActions.Print("AP: Disarming."); GameActions.PickUp(_twohand.Serial, 0, 0, 1); TimeSpan.FromMilliseconds(50); GameActions.DropItem(ItemHold.Serial, 0xFFFF, 0xFFFF, 0, _backpack.Serial); TimeSpan.FromMilliseconds(50); } if (World.Player.Hits < 85) { FindAndUsePotion(Potions.Heal, out bool found); if (found == true) { TimeSpan.FromMilliseconds(50); } else { GameActions.Print("AP: No Heal Potions."); return; } } if (World.Player.IsParalyzed) { GameActions.Say($"[pouch"); TimeSpan.FromMilliseconds(50); } if (World.Player.IsPoisoned && World.Player.Hits < World.Player.HitsMax) { FindAndUsePotion(Potions.Cure, out bool found); if (found == true) { TimeSpan.FromMilliseconds(50); } else { GameActions.Print("AP: No Cure Potions."); return; } } if (World.Player.Stamina < 23) { FindAndUsePotion(Potions.Refresh, out bool found); if (found == true) { TimeSpan.FromMilliseconds(50); } else { GameActions.Print("AP: No Refresh Potions."); return; } } if (World.Player.Strength < 100) { FindAndUsePotion(Potions.Strength, out bool found); if (found == true) { TimeSpan.FromMilliseconds(50); } else { GameActions.Print("AP: No Strength Potions."); return; } } if (World.Player.Dexterity > 89) { FindAndUsePotion(Potions.Agility, out bool found); if (found == true) { TimeSpan.FromMilliseconds(50); } else { GameActions.Print("AP: No Agility Potions."); return; } } if (!World.Player.IsPoisoned && World.Player.Hits > 85 && World.Player.Stamina > 23 && World.Player.Strength > 100 && World.Player.Dexterity > 100 && !World.Player.IsParalyzed) { GameActions.Print("AP: Nothing to do."); return; } } else { return; } } }
//##Perform Message##// public static void Print(string message, MessageColor color = MessageColor.Default) { GameActions.Print(message, (ushort)color, MessageType.System, 1); }
public StatusGumpOutlands() { Point pos = Point.Zero; _labels = new Label[(int)MobileStats.Max]; Add(new GumpPic(0, 0, 0x2A6C, 0)); Add(new GumpPic(34, 12, 0x0805, 0)); // Health bar Add(new GumpPic(34, 25, 0x0805, 0)); // Mana bar Add(new GumpPic(34, 38, 0x0805, 0)); // Stamina bar if (Client.Version >= ClientVersion.CV_5020) { Add(new Button((int)ButtonType.BuffIcon, 0x837, 0x838, 0x838) { X = 159, Y = 40, ButtonAction = ButtonAction.Activate }); Add(new Label("Buffs", false, 0x0386, 60, 1) { X = 174, Y = 40 }); } ushort gumpIdHp = 0x0806; if (World.Player.IsPoisoned) { gumpIdHp = 0x0808; } else if (World.Player.IsYellowHits) { gumpIdHp = 0x0809; } _fillBars[(int)FillStats.Hits] = new GumpPicWithWidth(34, 12, gumpIdHp, 0, 0); _fillBars[(int)FillStats.Mana] = new GumpPicWithWidth(34, 25, 0x0806, 0, 0); _fillBars[(int)FillStats.Stam] = new GumpPicWithWidth(34, 38, 0x0806, 0, 0); Add(_fillBars[(int)FillStats.Hits]); Add(_fillBars[(int)FillStats.Mana]); Add(_fillBars[(int)FillStats.Stam]); UpdateStatusFillBar(FillStats.Hits, World.Player.Hits, World.Player.HitsMax); UpdateStatusFillBar(FillStats.Mana, World.Player.Mana, World.Player.ManaMax); UpdateStatusFillBar(FillStats.Stam, World.Player.Stamina, World.Player.StaminaMax); // Name Label text = new Label(!string.IsNullOrEmpty(World.Player.Name) ? World.Player.Name : string.Empty, false, 0x0386, 320, 1, align: TEXT_ALIGN_TYPE.TS_CENTER) { X = 108, Y = 12 }; _labels[(int)MobileStats.Name] = text; Add(text); // Stat locks Add(_lockers[(int)StatType.Str] = new GumpPic( 10, 73, GetStatLockGraphic(World.Player.StrLock), 0)); Add(_lockers[(int)StatType.Dex] = new GumpPic( 10, 102, GetStatLockGraphic(World.Player.DexLock), 0)); Add(_lockers[(int)StatType.Int] = new GumpPic( 10, 130, GetStatLockGraphic(World.Player.IntLock), 0)); _lockers[(int)StatType.Str].MouseUp += (sender, e) => { World.Player.StrLock = (Lock)(((byte)World.Player.StrLock + 1) % 3); GameActions.ChangeStatLock(0, World.Player.StrLock); _lockers[(int)StatType.Str].Graphic = GetStatLockGraphic(World.Player.StrLock); }; _lockers[(int)StatType.Dex].MouseUp += (sender, e) => { World.Player.DexLock = (Lock)(((byte)World.Player.DexLock + 1) % 3); GameActions.ChangeStatLock(1, World.Player.DexLock); _lockers[(int)StatType.Dex].Graphic = GetStatLockGraphic(World.Player.DexLock); }; _lockers[(int)StatType.Int].MouseUp += (sender, e) => { World.Player.IntLock = (Lock)(((byte)World.Player.IntLock + 1) % 3); GameActions.ChangeStatLock(2, World.Player.IntLock); _lockers[(int)StatType.Int].Graphic = GetStatLockGraphic(World.Player.IntLock); }; // Str/dex/int text labels int xOffset = 60; AddStatTextLabel(World.Player.Strength.ToString(), MobileStats.Strength, xOffset, 73); AddStatTextLabel(World.Player.Dexterity.ToString(), MobileStats.Dexterity, xOffset, 102); AddStatTextLabel(World.Player.Intelligence.ToString(), MobileStats.Intelligence, xOffset, 130); // Hits/stam/mana AddStatTextLabel( World.Player.Hits.ToString(), MobileStats.HealthCurrent, 117, 66, 40, alignment: TEXT_ALIGN_TYPE.TS_CENTER); AddStatTextLabel( World.Player.HitsMax.ToString(), MobileStats.HealthMax, 117, 79, 40, alignment: TEXT_ALIGN_TYPE.TS_CENTER); AddStatTextLabel( World.Player.Stamina.ToString(), MobileStats.StaminaCurrent, 117, 95, 40, alignment: TEXT_ALIGN_TYPE.TS_CENTER); AddStatTextLabel( World.Player.StaminaMax.ToString(), MobileStats.StaminaMax, 117, 108, 40, alignment: TEXT_ALIGN_TYPE.TS_CENTER); AddStatTextLabel( World.Player.Mana.ToString(), MobileStats.ManaCurrent, 117, 124, 40, alignment: TEXT_ALIGN_TYPE.TS_CENTER); AddStatTextLabel(World.Player.ManaMax.ToString(), MobileStats.ManaMax, 117, 137, 40, alignment: TEXT_ALIGN_TYPE.TS_CENTER); // Current over max lines Add(new Line(118, 79, 30, 1, 0xFF383838)); Add(new Line(118, 108, 30, 1, 0xFF383838)); Add(new Line(118, 137, 30, 1, 0xFF383838)); // Followers / max followers AddStatTextLabel($"{World.Player.Followers}/{World.Player.FollowersMax}", MobileStats.Followers, 192, 73, alignment: TEXT_ALIGN_TYPE.TS_CENTER); // Armor, weight / max weight AddStatTextLabel( World.Player.PhysicalResistance.ToString(), MobileStats.AR, 196, 102, alignment: TEXT_ALIGN_TYPE.TS_CENTER); AddStatTextLabel( World.Player.Weight.ToString(), MobileStats.WeightCurrent, 185, 124, 40, alignment: TEXT_ALIGN_TYPE.TS_CENTER); AddStatTextLabel( World.Player.WeightMax.ToString(), MobileStats.WeightMax, 185, 137, 40, alignment: TEXT_ALIGN_TYPE.TS_CENTER); Add(new Line(186, 137, 30, 1, 0xFF383838)); // Hunger satisfaction, murder count, damage, gold AddStatTextLabel( World.Player.Luck.ToString(), // FIXME: packet handling MobileStats.HungerSatisfactionMinutes, 282, 44); AddStatTextLabel( World.Player.StatsCap.ToString(), // FIXME: packet handling MobileStats.MurderCount, 260, 73); AddStatTextLabel( $"{World.Player.DamageMin}-{World.Player.DamageMax}", MobileStats.Damage, 260, 102); AddStatTextLabel( World.Player.Gold.ToString(), MobileStats.Gold, 254, 132); // Timers AddStatTextLabel( World.Player.ColdResistance.ToString(), // FIXME: packet handling MobileStats.CriminalTimerSeconds, 354, 44); AddStatTextLabel( World.Player.FireResistance.ToString(), // FIXME: packet handling MobileStats.MurderCountDecayHours, 354, 73); AddStatTextLabel( World.Player.PoisonResistance.ToString(), // FIXME: packet handling MobileStats.PvpCooldownSeconds, 354, 102); AddStatTextLabel( World.Player.EnergyResistance.ToString(), // FIXME: packet handling MobileStats.BandageTimerSeconds, 354, 131); }
//##Auto Engage Toggle##// public static void Toggle() { GameActions.Print(String.Format("Auto Engage Is:{0}abled", (IsEnabled = !IsEnabled) == true ? "En" : "Dis"), 70); }
private void CreateBook() { Clear(); _pageCornerLeft = _pageCornerRight = null; GetBookInfo(_spellBookType, out Graphic bookGraphic, out Graphic minimizedGraphic, out Graphic iconStartGraphic, out int maxSpellsCount, out int spellsOnPage, out int dictionaryPagesCount); _Iconized = new GumpPic(0, 0, minimizedGraphic, 0); Add(new GumpPic(0, 0, bookGraphic, 0)); Add(_pageCornerLeft = new GumpPic(50, 8, 0x08BB, 0)); _pageCornerLeft.LocalSerial = 0; _pageCornerLeft.Page = int.MaxValue; _pageCornerLeft.MouseUp += PageCornerOnMouseClick; _pageCornerLeft.MouseDoubleClick += PageCornerOnMouseDoubleClick; Add(_pageCornerRight = new GumpPic(321, 8, 0x08BC, 0)); _pageCornerRight.LocalSerial = 1; _pageCornerRight.Page = 1; _pageCornerRight.MouseUp += PageCornerOnMouseClick; _pageCornerRight.MouseDoubleClick += PageCornerOnMouseDoubleClick; int totalSpells = 0; Item item = World.Items.Get(LocalSerial); if (item == null) { Dispose(); return; } for (int circle = 0; circle < 8; circle++) { for (int i = 1; i <= 8; i++) { if (item.HasSpell(circle, i)) { _spells[circle * 8 + i - 1] = true; totalSpells++; } } } _maxPage = (dictionaryPagesCount >> 1) + ((totalSpells + 1) >> 1); int offs = 0; if (_spellBookType == SpellBookType.Magery) { Add(new Button((int)ButtonCircle.Circle_1_2, 0x08B1, 0x08B1) { X = 58, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 1 }); Add(new Button((int)ButtonCircle.Circle_1_2, 0x08B2, 0x08B2) { X = 93, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 1 }); Add(new Button((int)ButtonCircle.Circle_3_4, 0x08B3, 0x08B3) { X = 130, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 2 }); Add(new Button((int)ButtonCircle.Circle_3_4, 0x08B4, 0x08B4) { X = 164, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 2 }); Add(new Button((int)ButtonCircle.Circle_5_6, 0x08B5, 0x08B5) { X = 227, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 3 }); Add(new Button((int)ButtonCircle.Circle_5_6, 0x08B6, 0x08B6) { X = 260, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 3 }); Add(new Button((int)ButtonCircle.Circle_7_8, 0x08B7, 0x08B7) { X = 297, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 4 }); Add(new Button((int)ButtonCircle.Circle_7_8, 0x08B8, 0x08B8) { X = 332, Y = 175, ButtonAction = ButtonAction.Activate, ToPage = 4 }); } int spellDone = 0; for (int i = 1; i <= dictionaryPagesCount >> 1; i++) { int page = i; for (int j = 0; j < 2; j++) { if (page == 1 && _spellBookType == SpellBookType.Chivalry) { Label label = new Label("Tithing points\nAvailable: " + World.Player.TithingPoints, false, 0x0288, font: 6) { X = 62, Y = 162 }; Add(label, page); } int indexX = 106; int dataX = 62; int y = 0; if (j % 2 != 0) { indexX = 269; dataX = 225; } Label text = new Label("INDEX", false, 0x0288, font: 6) { X = indexX, Y = 10 }; Add(text, page); if (_spellBookType == SpellBookType.Magery) { text = new Label(SpellsMagery.CircleNames[(i - 1) * 2 + j % 2], false, 0x0288, font: 6) { X = dataX, Y = 30 }; Add(text, page); } int topage = (dictionaryPagesCount >> 1) + ((spellDone + 1) >> 1); for (int k = 0; k < spellsOnPage; k++) { if (_spells[offs]) { GetSpellNames(offs, out string name, out string abbreviature, out string reagents); if (spellDone % 2 == 0) { topage++; } spellDone++; text = new HoveredLabel(name, false, 0x0288, 0x33, font: 9) { X = dataX, Y = 52 + y, LocalSerial = (uint)topage, AcceptMouseInput = true, Tag = offs + 1 }; text.MouseUp += OnClicked; text.MouseDoubleClick += OnDoubleClicked; Add(text, page); y += 15; } offs++; } } } int page1 = (dictionaryPagesCount >> 1) + 1; int topTextY = 6; for (int i = 0, spellsDone = 0; i < maxSpellsCount; i++) { if (!_spells[i]) { continue; } int iconX = 62; int topTextX = 87; int iconTextX = 112; uint iconSerial = 100 + (uint)i; if (spellsDone > 0) { if (spellsDone % 2 != 0) { iconX = 225; topTextX = 224; iconTextX = 275; iconSerial = 1000 + (uint)i; } else { page1++; } } spellsDone++; GetSpellNames(i, out string name, out string abbreviature, out string reagents); switch (_spellBookType) { case SpellBookType.Magery: { Label text = new Label(SpellsMagery.CircleNames[i >> 3], false, 0x0288, font: 6) { X = topTextX, Y = topTextY + 4 }; Add(text, page1); text = new Label(name, false, 0x0288, 80, 6) { X = iconTextX, Y = 34 }; Add(text, page1); int abbreviatureY = 26; if (text.Height < 24) { abbreviatureY = 31; } abbreviatureY += text.Height; text = new Label(abbreviature, false, 0x0288, font: 8) { X = iconTextX, Y = abbreviatureY }; Add(text, page1); break; } case SpellBookType.Bardic: { Label text = new Label(SpellsBardic.GetUsedSkillName(i), false, 0x0288, font: 6) { X = topTextX, Y = topTextY + 4 }; Add(text, page1); text = new Label(name, false, 0x0288, 80, 6) { X = iconTextX, Y = 34 }; Add(text, page1); break; } default: { Label text = new Label(name, false, 0x0288, font: 6) { X = topTextX, Y = topTextY }; Add(text, page1); if (!string.IsNullOrEmpty(abbreviature)) { text = new Label(abbreviature, false, 0x0288, 80, 6) { X = iconTextX, Y = 34 }; Add(text, page1); } break; } } GumpPic icon = new GumpPic(iconX, 40, (Graphic)(iconStartGraphic + i), 0) { X = iconX, Y = 40, LocalSerial = iconSerial }; GetSpellToolTip(out int toolTipCliloc); if (toolTipCliloc > 0) { string tooltip = FileManager.Cliloc.GetString(toolTipCliloc + i); icon.SetTooltip(tooltip, 150); } icon.MouseDoubleClick += (sender, e) => { if (e.Button == MouseButton.Left) { SpellDefinition def = GetSpellDefinition(sender as Control); if (def != null) { GameActions.CastSpell(def.ID); } } }; icon.DragBegin += (sender, e) => { if (Engine.UI.IsDragging) { return; } SpellDefinition def = GetSpellDefinition(sender as Control); if (def == null) { return; } UseSpellButtonGump gump = new UseSpellButtonGump(def) { X = Mouse.Position.X - 22, Y = Mouse.Position.Y - 22 }; Engine.UI.Add(gump); Engine.UI.AttemptDragControl(gump, Mouse.Position, true); }; Add(icon, page1); if (!string.IsNullOrEmpty(reagents)) { Add(new GumpPicTiled(iconX, 88, 120, 5, 0x0835), page1); Label text = new Label("Reagents:", false, 0x0288, font: 6) { X = iconX, Y = 92 }; Add(text, page1); text = new Label(reagents, false, 0x0288, font: 9) { X = iconX, Y = 114 }; Add(text, page1); } if (_spellBookType != SpellBookType.Magery) { GetSpellRequires(i, out int requiriesY, out string requires); Label text = new Label(requires, false, 0x0288, font: 6) { X = iconX, Y = requiriesY }; Add(text, page1); } } SetActivePage(1); }
public SkillListEntry(Label skillname, Label skillvaluebase, Label skillvalue, Label skillcap, Skill skill) { Height = 20; Label skillName = skillname; Label skillValueBase = skillvaluebase; Label skillValue = skillvalue; Label skillCap = skillcap; _skill = skill; skillName.X = 20; if (skill.IsClickable) { Add(_activeUse = new Button((int)Buttons.ActiveSkillUse, 0x837, 0x838) { X = 0, Y = 4, ButtonAction = ButtonAction.Activate }); } Add(skillName); //====================== skillValueBase.X = 200; Add(skillValueBase); //====================== skillValue.X = 280; Add(skillValue); //====================== skillCap.X = 360; Add(skillCap); GumpPic loc = new GumpPic(425, 4, (Graphic)(skill.Lock == Lock.Up ? 0x983 : skill.Lock == Lock.Down ? 0x985 : 0x82C), 0); Add(loc); loc.MouseClick += (sender, e) => { switch (_skill.Lock) { case Lock.Up: _skill.Lock = Lock.Down; GameActions.ChangeSkillLockStatus((ushort)_skill.Index, (byte)Lock.Down); loc.Graphic = 0x985; loc.Texture = FileManager.Gumps.GetTexture(0x985); break; case Lock.Down: _skill.Lock = Lock.Locked; GameActions.ChangeSkillLockStatus((ushort)_skill.Index, (byte)Lock.Locked); loc.Graphic = 0x82C; loc.Texture = FileManager.Gumps.GetTexture(0x82C); break; case Lock.Locked: _skill.Lock = Lock.Up; GameActions.ChangeSkillLockStatus((ushort)_skill.Index, (byte)Lock.Up); loc.Graphic = 0x983; loc.Texture = FileManager.Gumps.GetTexture(0x983); break; } }; }
private void button2_Click(object sender, EventArgs e) { GameActions.Walk(client, Types.Direction.West); }
public override void Update(double totalMS, double frameMS) { base.Update(totalMS, frameMS); if (IsDisposed) { return; } bool inparty = World.Party.GetPartyMember(_partyMemeberSerial) != null; Hue color = 0; Hue textColor = 0x0386; Hue hitsColor = 0x0386; Mobile = World.Mobiles.Get(LocalSerial); if (Mobile == null || Mobile.IsDisposed) { if (Engine.Profile.Current.CloseHealthBarIfMobileNotExists) { Dispose(); return; } if (!_outOfRange) { _poisoned = false; _yellowHits = false; _normalHits = true; _outOfRange = true; if (inparty) { hitsColor = textColor = 912; if (_partyNameLabel.Hue != textColor) { _partyNameLabel.Hue = textColor; } _buttonHeal1.IsVisible = _buttonHeal2.IsVisible = false; _bars[1].IsVisible = false; _bars[2].IsVisible = false; } else { if (_textBox.Hue != textColor) { _textBox.Hue = textColor; } if (_canChangeName) { _textBox.MouseClick -= TextBoxOnMouseClick; } } if (_background.Hue != color) { _background.Hue = color; } if (_hpLineRed.Hue != hitsColor) { _hpLineRed.Hue = hitsColor; if (_manaLineRed != null && _stamLineRed != null) { _manaLineRed.Hue = _stamLineRed.Hue = hitsColor; } } _bars[0].IsVisible = false; } } if (Mobile != null && !Mobile.IsDisposed) { if (_outOfRange) { if (Mobile.HitsMax == 0) { GameActions.RequestMobileStatus(Mobile); } _outOfRange = false; if (_name != Mobile.Name && !string.IsNullOrEmpty(Mobile.Name)) { _name = Mobile.Name; } hitsColor = 0; color = Notoriety.GetHue(Mobile.NotorietyFlag); if (Mobile.NotorietyFlag == NotorietyFlag.Criminal || Mobile.NotorietyFlag == NotorietyFlag.Gray) { color = 0; } if (inparty) { textColor = color; } else { _canChangeName = Mobile.IsRenamable; if (_canChangeName) { textColor = 0x000E; _textBox.MouseClick += TextBoxOnMouseClick; } } if (_background.Hue != color) { _background.Hue = color; } if (inparty) { if (_partyNameLabel.Hue != textColor) { _partyNameLabel.Hue = textColor; } _buttonHeal1.IsVisible = _buttonHeal2.IsVisible = true; _bars[1].IsVisible = true; _bars[2].IsVisible = true; } else { if (_textBox.Hue != textColor) { _textBox.Hue = textColor; } if (_textBox.Text != _name) { _textBox.Text = _name; } } if (_hpLineRed.Hue != hitsColor) { _hpLineRed.Hue = hitsColor; if (_manaLineRed != null && _stamLineRed != null) { _manaLineRed.Hue = _stamLineRed.Hue = hitsColor; } } _bars[0].IsVisible = true; } if (Mobile.IsPoisoned && !_poisoned) { if (inparty) { _bars[0].Hue = 63; } else { _bars[0].Graphic = LINE_POISONED; } _poisoned = true; _normalHits = false; } else if (Mobile.IsYellowHits && !_yellowHits) { if (inparty) { _bars[0].Hue = 353; } else { _bars[0].Graphic = LINE_YELLOWHITS; } _yellowHits = true; _normalHits = false; } else if (!_normalHits && !Mobile.IsPoisoned && !Mobile.IsYellowHits && (_poisoned || _yellowHits)) { if (inparty) { _bars[0].Hue = 0; } else { _bars[0].Graphic = LINE_BLUE; } _poisoned = false; _yellowHits = false; _normalHits = true; } int hits = CalculatePercents(Mobile.HitsMax, Mobile.Hits, inparty ? 96 : 109); if (hits != _oldHits) { _bars[0].Percent = hits; _oldHits = hits; } } if (CanBeSaved) { if (World.Player.InWarMode != _oldWarMode) { _oldWarMode = !_oldWarMode; _background.Graphic = World.Player.InWarMode ? BACKGROUND_WAR : BACKGROUND_NORMAL; } int mana = CalculatePercents(World.Player.ManaMax, World.Player.Mana, inparty ? 96 : 109); int stam = CalculatePercents(World.Player.StaminaMax, World.Player.Stamina, inparty ? 96 : 109); if (mana != _oldMana) { _bars[1].Percent = mana; _oldMana = mana; } if (stam != _oldStam) { _bars[2].Percent = stam; _oldStam = stam; } } }
public override void OnButtonClick(int buttonID) { switch ((Buttons)buttonID) { case Buttons.Map: MiniMapGump miniMapGump = Engine.UI.GetGump <MiniMapGump>(); if (miniMapGump == null) { Engine.UI.Add(new MiniMapGump()); } else { miniMapGump.SetInScreen(); miniMapGump.BringOnTop(); } break; case Buttons.Paperdoll: PaperDollGump paperdollGump = Engine.UI.GetGump <PaperDollGump>(World.Player); if (paperdollGump == null) { GameActions.OpenPaperdoll(World.Player); } else { paperdollGump.SetInScreen(); paperdollGump.BringOnTop(); } break; case Buttons.Inventory: Item backpack = World.Player.Equipment[(int)Layer.Backpack]; ContainerGump backpackGump = Engine.UI.GetGump <ContainerGump>(backpack); if (backpackGump == null) { GameActions.DoubleClick(backpack); } else { backpackGump.SetInScreen(); backpackGump.BringOnTop(); } break; case Buttons.Journal: JournalGump journalGump = Engine.UI.GetGump <JournalGump>(); if (journalGump == null) { Engine.UI.Add(new JournalGump { X = 64, Y = 64 }); } else { journalGump.SetInScreen(); journalGump.BringOnTop(); } break; case Buttons.Chat: Log.Message(LogTypes.Warning, "Chat button pushed! Not implemented yet!"); break; case Buttons.Help: GameActions.RequestHelp(); break; case Buttons.Debug: DebugGump debugGump = Engine.UI.GetGump <DebugGump>(); if (debugGump == null) { debugGump = new DebugGump { X = Engine.Profile.Current.DebugGumpPosition.X, Y = Engine.Profile.Current.DebugGumpPosition.Y }; Engine.UI.Add(debugGump); } else { debugGump.IsVisible = !debugGump.IsVisible; debugGump.SetInScreen(); } Engine.DropFpsMinMaxValues(); break; } }
public SkillControl(int skillIndexIndex, int maxWidth, string group, MultiSelectionShrinkbox parent) { AcceptMouseInput = true; CanMove = true; _parent = parent; Skill skill = World.Player.Skills[skillIndexIndex]; _skillIndex = skillIndexIndex; if (skill.IsClickable) { Button button = new Button(0, 0x0837, 0x0838, 0x0837); button.MouseUp += (ss, e) => { GameActions.UseSkill(skillIndexIndex); }; Add(button); } Label label = new Label(skill.Name, false, 0x0288, maxWidth, 9) { X = 12 }; Add(label); _labelValue = new Label(skill.Value.ToString("F1"), false, 0x0288, maxWidth - 10, 9, align: TEXT_ALIGN_TYPE.TS_RIGHT); Add(_labelValue); _lock = new GumpPic(maxWidth - 8, 1, GetLockValue(skill.Lock), 0) { AcceptMouseInput = true }; _lock.MouseUp += (sender, e) => { byte slock = (byte)skill.Lock; if (slock < 2) { slock++; } else { slock = 0; } skill.Lock = (Lock)slock; GameActions.ChangeSkillLockStatus((ushort)skill.Index, slock); ushort graphic = GetLockValue(skill.Lock); _lock.Graphic = graphic; _lock.Texture = FileManager.Gumps.GetTexture(graphic); }; Add(_lock); WantUpdateSize = false; Width = maxWidth; Height = label.Height; Group = group; }
internal override void execute(GameEntity.Submarine sub, GameActions.ActionsQueue queue) { queue.addAction(new SubmarinesGameLibrary.GameActions.PlaceMine(sub, queue)); queue.addAction(new SubmarinesGameLibrary.GameActions.ParsePath(sub, path, queue)); }
/// <summary> /// Collect data for settings dialog and open it /// Also stores user choices from settings /// </summary> /// <param name="exeCuteParam"> /// The execute parameter. /// </param> private void OnGameAction(GameActions exeCuteParam) { if (exeCuteParam != GameActions.Settings) { return; } var playerModels = this.players.PlayersList; if (playerModels == null || playerModels.Count > 2) { return; } var notification = new PlayerNotification(playerModels.ElementAt(0), playerModels.ElementAt(1)) { Title = "Player Settings" }; this.PlayerSettingsRequest.Raise( notification, returned => { if (returned == null || !returned.Confirmed || (returned.Player1 == null && returned.Player2 == null)) { return; } if (returned.Player1 != null) { this.players.PlayersList[(int)Player.Player1] = returned.Player1; } if (returned.Player2 != null) { this.players.PlayersList[(int)Player.Player2] = returned.Player2; } }); }