public static void Process(GameSession session, string command) { string[] args = command.ToLower().Split(" ", 2); switch (args[0]) { case "item": ProcessItemCommand(session, args.Length > 1 ? args[1] : ""); break; case "npc": ProcessNpcCommand(session, args.Length > 1 ? args[1] : ""); break; case "map": ProcessMapCommand(session, args.Length > 1 ? args[1] : ""); break; case "coord": session.SendNotice(session.FieldPlayer.Coord.ToString()); break; case "battleof": session.Send(UserBattlePacket.UserBattle(session.FieldPlayer, false)); break; case "notice": if (args.Length <= 1) { break; } MapleServer.BroadcastPacketAll(NoticePacket.Notice(args[1])); break; } }
private Task StartCombatEnd(CancellationTokenSource ct) { return(Task.Run(async() => { await Task.Delay(5000); if (!ct.Token.IsCancellationRequested) { CombatCTS = null; ct.Dispose(); Session.Send(UserBattlePacket.UserBattle(Session.FieldPlayer, false)); } }, ct.Token)); }
private Task StartCombatStance(CancellationTokenSource ct) { Session.FieldManager.BroadcastPacket(UserBattlePacket.UserBattle(Session.FieldPlayer, true)); return(Task.Run(async() => { await Task.Delay(5000); if (!ct.Token.IsCancellationRequested) { CombatCTS = null; ct.Dispose(); Session?.FieldManager.BroadcastPacket(UserBattlePacket.UserBattle(Session.FieldPlayer, false)); } }, ct.Token)); }
public Task StartCombatStance() { // Refresh out-of-combat timer CombatCTS?.Cancel(); CancellationTokenSource cts = new(); cts.Token.Register(() => cts.Dispose()); CombatCTS = cts; // Enter combat Value.Session.FieldManager.BroadcastPacket(UserBattlePacket.UserBattle(this, true)); return(Task.Run(async() => { await Task.Delay(5000); if (!cts.Token.IsCancellationRequested) { CombatCTS = null; cts.Dispose(); Value.Session?.FieldManager.BroadcastPacket(UserBattlePacket.UserBattle(this, false)); } }, cts.Token)); }
private static void HandlePickup(GameSession session, PacketReader packet) { byte[] coords = packet.Read(3); // Convert to signed byte array sbyte[] sCoords = Array.ConvertAll(coords, b => unchecked ((sbyte)b)); // Default to rainbow tree int weaponId = 18000004; // Find matching mapObject foreach (MapObject mapObject in MapEntityStorage.GetObjects(session.Player.MapId)) { if (mapObject.Coord.Equals(CoordB.From(sCoords[0], sCoords[1], sCoords[2]))) { weaponId = mapObject.WeaponId; break; } } // Pickup item then set battle state to true session.Send(ResponseCubePacket.Pickup(session, weaponId, coords)); session.Send(UserBattlePacket.UserBattle(session.FieldPlayer, true)); }
public static void Process(GameSession session, string command) { string[] args = command.ToLower().Split(" ", 2); switch (args[0]) { case "setprestigelevel": session.Player.Levels.SetPrestigeLevel(ParseInt(session, args.Length > 1 ? args[1] : "")); break; case "setlevel": session.Player.Levels.SetLevel(ParseShort(session, args.Length > 1 ? args[1] : "")); break; case "gainprestigeexp": session.Player.Levels.GainPrestigeExp(ParseLong(session, args.Length > 1 ? args[1] : "")); break; case "gainexp": session.Player.Levels.GainExp(ParseInt(session, args.Length > 1 ? args[1] : "")); break; case "setvalor": session.Player.Wallet.ValorToken.SetAmount(ParseLong(session, args.Length > 1 ? args[1] : "")); break; case "settreva": session.Player.Wallet.Treva.SetAmount(ParseLong(session, args.Length > 1 ? args[1] : "")); break; case "setrue": session.Player.Wallet.Rue.SetAmount(ParseLong(session, args.Length > 1 ? args[1] : "")); break; case "sethavi": session.Player.Wallet.HaviFruit.SetAmount(ParseLong(session, args.Length > 1 ? args[1] : "")); break; case "setmeso": session.Player.Wallet.Meso.SetAmount(ParseLong(session, args.Length > 1 ? args[1] : "")); break; case "setmeret": session.Player.Wallet.Meret.SetAmount(ParseLong(session, args.Length > 1 ? args[1] : "")); break; case "item": ProcessItemCommand(session, args.Length > 1 ? args[1] : ""); break; case "npc": ProcessNpcCommand(session, args.Length > 1 ? args[1] : ""); break; case "mob": ProcessMobCommand(session, args.Length > 1 ? args[1] : ""); break; case "map": ProcessMapCommand(session, args.Length > 1 ? args[1] : ""); break; case "coord": session.SendNotice(session.FieldPlayer.Coord.ToString()); break; case "battleoff": session.Send(UserBattlePacket.UserBattle(session.FieldPlayer, false)); break; case "notice": if (args.Length <= 1) { break; } MapleServer.BroadcastPacketAll(NoticePacket.Notice(args[1])); break; } }
private static void HandleDrop(GameSession session) { // Drop item then set battle state to false session.Send(ResponseCubePacket.Drop(session.FieldPlayer)); session.Send(UserBattlePacket.UserBattle(session.FieldPlayer, false)); }