internal static void ResumeStory(Client client, int storyNum) { client.Player.LoadingStory = true; Messenger.SendLoadingStoryTo(client); client.Player.CurrentChapter = Stories[storyNum]; Messenger.SendDataTo(client, TcpPacket.CreatePacket("storycheck", storyNum.ToString(), Stories[storyNum].Revision.ToString())); }
private void SelectItem(int itemNum) { switch (itemNum) { case 0: { Messenger.SendPacket(TcpPacket.CreatePacket("overwritemove", "0")); } break; case 1: { Messenger.SendPacket(TcpPacket.CreatePacket("overwritemove", "1")); } break; case 2: { Messenger.SendPacket(TcpPacket.CreatePacket("overwritemove", "2")); } break; case 3: { Messenger.SendPacket(TcpPacket.CreatePacket("overwritemove", "3")); } break; } MenuSwitcher.CloseAllMenus(); }
public static void AddNewClass(Client client, string ClassName) { if (System.IO.File.Exists(GetTempFolder(client) + ClassName + ".cs") == false) { System.IO.File.WriteAllText(GetTempFolder(client) + ClassName + ".cs", "using Server;\nusing Server.Scripting;\nusing Server.Database;\nusing System;\nusing System.Drawing;\nusing System.Xml;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Windows.Forms;\n\nnamespace Script \n{\npublic class " + ClassName + "\n{\n\n}\n}"); Messenger.SendDataTo(client, TcpPacket.CreatePacket("scriptfiledata", ClassName, GetScriptFile(client, ClassName))); } }
private void saveFileToolStripMenuItem_Click(object sender, EventArgs e) { ScriptFileTab tab = tabControl1.SelectedTab.Tag as ScriptFileTab; if (tab != null) { Messenger.SendPacket(TcpPacket.CreatePacket("savescript", tab.File.Replace(".cs", ""), tab.SyntaxBox.Document.Text.Replace(TcpPacket.SEP_CHAR, '/'))); } }
public static void RunScript(Client client, int script, string param1, string param2, string param3, bool wait) { if (wait) { ScriptManager.InvokeSub("StoryScript", client, script, param1, param2, param3, wait); Messenger.SendDataTo(client, TcpPacket.CreatePacket("storyscriptcomplete")); } else { Messenger.SendDataTo(client, TcpPacket.CreatePacket("storyscriptcomplete")); ScriptManager.InvokeSub("StoryScript", client, script, param1, param2, param3, wait); } }
private static void StartStoryCheck(Client client, int storyNum) { if (client.Player.GetStoryState(storyNum) == false) { if (Stories[storyNum].StoryStart != 0) { if (client.Player.GetStoryState(Stories[storyNum].StoryStart - 1) == false) { return; } } client.Player.LoadingStory = true; Messenger.SendLoadingStoryTo(client); client.Player.CurrentChapter = Stories[storyNum]; Messenger.SendDataTo(client, TcpPacket.CreatePacket("storycheck", storyNum.ToString(), Stories[storyNum].Revision.ToString())); } }
private void SetupPacketSecurity() { Messenger.SendDataTo(this, TcpPacket.CreatePacket("cryptkey", "----" + Server.Math.Rand(1, 20000))); packetModifiers.SetKey(null); }
private void button1_Click(object sender, EventArgs e) { Messenger.SendPacket(TcpPacket.CreatePacket("requesteditscriptfile", (string)comboBox1.SelectedItem)); }
private void frmScriptEditor_FormClosing(object sender, FormClosingEventArgs e) { Messenger.SendPacket(TcpPacket.CreatePacket("scripteditexit")); }
private void addToolStripMenuItem1_Click(object sender, EventArgs e) { Messenger.SendPacket(TcpPacket.CreatePacket("addnewclass", toolStripTextBox1.Text)); }
private void numericUpDown1_ValueChanged(object sender, EventArgs e) { Messenger.SendPacket(TcpPacket.CreatePacket("getscriptparam", (string)comboBox3.Items[0], (string)comboBox3.SelectedItem, numericUpDown1.Value.ToString())); }
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { Messenger.SendPacket(TcpPacket.CreatePacket("getscriptmethods", (string)comboBox2.SelectedItem)); }
private void reloadToolStripMenuItem_Click(object sender, EventArgs e) { Messenger.SendPacket(TcpPacket.CreatePacket("reloadscripts")); }
public bool UseMoveKey(IMap currentMap, Move move, int moveSlot) { bool doorOpened = false; int x = 0; int y = 0; switch (owner.Player.Direction) { case Enums.Direction.Up: { if (owner.Player.Y > 0) { x = owner.Player.X; y = owner.Player.Y - 1; } else { return(false); } } break; case Enums.Direction.Down: { if (owner.Player.Y < currentMap.MaxY) { x = owner.Player.X; y = owner.Player.Y + 1; } else { return(false); } } break; case Enums.Direction.Left: { if (owner.Player.X > 0) { x = owner.Player.X - 1; y = owner.Player.Y; } else { return(false); } } break; case Enums.Direction.Right: { if (owner.Player.X < currentMap.MaxX) { x = owner.Player.X + 1; y = owner.Player.Y; } else { return(false); } } break; } // Check if a key exists if (currentMap.Tile[x, y].Type == Enums.TileType.Key) { // Check if the key they are using matches the map key if (move.KeyItem == currentMap.Tile[x, y].Data1) { currentMap.Tile[x, y].DoorOpen = true; currentMap.Tile[x, y].DoorTimer = Core.GetTickCount(); Messenger.SendDataToMap(MapID, TcpPacket.CreatePacket("mapkey", x.ToString(), y.ToString(), "1")); if (string.IsNullOrEmpty(currentMap.Tile[x, y].String1)) { //Messenger.PlayerMsg(Owner, "A door has been unlocked!", Text.White); } else { Messenger.PlayerMsg(Owner, currentMap.Tile[x, y].String1.Trim(), Text.White); } Messenger.PlaySoundToMap(MapID, "key.wav"); Messenger.SpellAnim(Moves[moveSlot].MoveNum, currentMap.MapID, x, y); doorOpened = true; } } if (currentMap.Tile[x, y].Type == Enums.TileType.Door) { currentMap.Tile[x, y].DoorOpen = true; currentMap.Tile[x, y].DoorTimer = Core.GetTickCount(); Messenger.SendDataToMap(MapID, TcpPacket.CreatePacket("mapkey", x.ToString(), y.ToString(), "1")); Messenger.PlaySoundToMap(MapID, "key.wav"); } return(doorOpened); }
void btnMissions_Click(object sender, SdlDotNet.Widgets.MouseButtonEventArgs e) { this.Close(); Messenger.SendPacket(TcpPacket.CreatePacket("requesteditmission")); return; }
void btnSpells_Click(object sender, SdlDotNet.Widgets.MouseButtonEventArgs e) { this.Close(); Messenger.SendPacket(TcpPacket.CreatePacket("requesteditmove")); }
public void ProcessAI() { try { TickCount tickCount = Core.GetTickCount(); PacketHitList packetList = null; PacketHitList.MethodStart(ref packetList); if (map.IsSaving == false) { // Keys/Other timed tile stuff for (int x = 0; x <= map.MaxX; x++) { for (int y = 0; y <= map.MaxY; y++) { if (map.Tile[x, y] != null) { if (tickCount.Elapsed(map.Tile[x, y].DoorTimer, 5000)) { if ((map.Tile[x, y].Type == Enums.TileType.Key || map.Tile[x, y].Type == Enums.TileType.Door) && map.Tile[x, y].DoorOpen == true) { map.Tile[x, y].DoorOpen = false; packetList.AddPacketToMap(map, TcpPacket.CreatePacket("mapkey", x.ToString(), y.ToString(), "0")); } } } } } Scripting.ScriptManager.InvokeSub("OnMapTick", map); if (map.ProcessingPaused == false) { int livingNpcs = 0; for (int mapNpcSlot = 0; mapNpcSlot < Constants.MAX_MAP_NPCS; mapNpcSlot++) { int npcNum = map.ActiveNpc[mapNpcSlot].Num; MapNpc mapNpc = map.ActiveNpc[mapNpcSlot]; if (npcNum > 0) { livingNpcs++; Npc npc = NpcManager.Npcs[npcNum]; if (npc.Behavior != Enums.NpcBehavior.FullyScriptedAI || npc.AIScript == "" || npc.AIScript.ToLower() == "none") { #region Used for attacking on sight if (npc.Behavior == Enums.NpcBehavior.AttackOnSight || npc.Behavior == Enums.NpcBehavior.Guard) { foreach (Client i in map.GetClients()) { if (i.Player.MapID == map.MapID && map.ActiveNpc[mapNpcSlot].Target == null && !i.Player.Dead && i.Player.Hunted && map.Tile[i.Player.X, i.Player.Y].Type != Enums.TileType.NPCAvoid && i.Player.Hunted) { if (MovementProcessor.CanCharacterSeeCharacter(map, map.ActiveNpc[mapNpcSlot], i.Player.GetActiveRecruit())) { if (npc.Behavior == Enums.NpcBehavior.AttackOnSight /* || i.Player.PK == true*/) { //if (!string.IsNullOrEmpty(npc.AttackSay)) { // packetList.AddPacket(i, PacketBuilder.CreateChatMsg("A " + npc.Name + " : " + npc.AttackSay, Text.Grey)); //} map.ActiveNpc[mapNpcSlot].Target = i; } } } } } #endregion #region Used for walking/targetting/picking up items if (npcNum > 0) { bool hasNpcWalked; if (map.ActiveNpc[mapNpcSlot].Target != null && map.ActiveNpc[mapNpcSlot].Target.IsPlaying() && map.ActiveNpc[mapNpcSlot].Target.Player.MapID == map.MapID && (map.Tile[map.ActiveNpc[mapNpcSlot].Target.Player.X, map.ActiveNpc[mapNpcSlot].Target.Player.Y].Type == Enums.TileType.NPCAvoid || !map.ActiveNpc[mapNpcSlot].Target.Player.Hunted || map.ActiveNpc[mapNpcSlot].Target.Player.Dead || !MovementProcessor.CanCharacterSeeCharacter(map, map.ActiveNpc[mapNpcSlot], map.ActiveNpc[mapNpcSlot].Target.Player.GetActiveRecruit()))) { map.ActiveNpc[mapNpcSlot].Target = null; } Client target = map.ActiveNpc[mapNpcSlot].Target; if (npc.Behavior != Enums.NpcBehavior.Shopkeeper) { if (target != null) { if (target.IsPlaying() && target.Player.MapID == map.MapID) { hasNpcWalked = false; int dir = Math.Rand(0, 5); hasNpcWalked = AIProcessor.MoveNpcInDirection((Enums.Direction)dir, map, target, packetList, mapNpcSlot); if (!hasNpcWalked) { foreach (Enums.Direction direction in Enum.GetValues(typeof(Enums.Direction))) { if (direction != (Enums.Direction)dir) { if (AIProcessor.MoveNpcInDirection(direction, map, target, packetList, mapNpcSlot)) { break; } } } } if (hasNpcWalked == false) { if (map.ActiveNpc[mapNpcSlot].X - 1 == target.Player.X && map.ActiveNpc[mapNpcSlot].Y == target.Player.Y) { if (map.ActiveNpc[mapNpcSlot].Direction != Enums.Direction.Left) { MovementProcessor.ChangeNpcDir(packetList, map, mapNpcSlot, Enums.Direction.Left); } hasNpcWalked = true; } if (map.ActiveNpc[mapNpcSlot].X + 1 == target.Player.X && map.ActiveNpc[mapNpcSlot].Y == target.Player.Y) { if (map.ActiveNpc[mapNpcSlot].Direction != Enums.Direction.Right) { MovementProcessor.ChangeNpcDir(packetList, map, mapNpcSlot, Enums.Direction.Right); } hasNpcWalked = true; } if (map.ActiveNpc[mapNpcSlot].X == target.Player.X && map.ActiveNpc[mapNpcSlot].Y - 1 == target.Player.Y) { if (map.ActiveNpc[mapNpcSlot].Direction != Enums.Direction.Up) { MovementProcessor.ChangeNpcDir(packetList, map, mapNpcSlot, Enums.Direction.Up); } hasNpcWalked = true; } if (map.ActiveNpc[mapNpcSlot].X == target.Player.X && map.ActiveNpc[mapNpcSlot].Y + 1 == target.Player.Y) { if (map.ActiveNpc[mapNpcSlot].Direction != Enums.Direction.Down) { MovementProcessor.ChangeNpcDir(packetList, map, mapNpcSlot, Enums.Direction.Down); } hasNpcWalked = true; } } if (hasNpcWalked == false) { int val = Math.Rand(0, 2); if (val == 1) { val = Math.Rand(0, 4); if (MovementProcessor.CanNpcMove(map, mapNpcSlot, (Enums.Direction)val)) { MovementProcessor.NpcMove(packetList, map, mapNpcSlot, map.ActiveNpc[mapNpcSlot].Direction, Enums.Speed.Walking); } } } } else { map.ActiveNpc[mapNpcSlot].Target = null; } } else { int shouldWalk = Math.Rand(0, 2); if (npc.Behavior != Enums.NpcBehavior.Friendly) { for (int i = 0; i < Constants.MAX_MAP_ITEMS; i++) { if (map.ActiveItem[i].X == map.ActiveNpc[mapNpcSlot].X && map.ActiveItem[i].Y == map.ActiveNpc[mapNpcSlot].Y && map.ActiveItem[i].Num > -1 && map.ActiveNpc[mapNpcSlot].HeldItem == null) { map.ActiveNpc[mapNpcSlot].MapGetItem(); shouldWalk = 1; } } } else if (npc.Behavior == Enums.NpcBehavior.Friendly) { foreach (Client i in map.GetClients()) { if (i.Player.X >= map.ActiveNpc[mapNpcSlot].X - 1 && i.Player.X <= map.ActiveNpc[mapNpcSlot].X + 1 && i.Player.Y >= map.ActiveNpc[mapNpcSlot].Y - 1 && i.Player.Y <= map.ActiveNpc[mapNpcSlot].Y + 1) { shouldWalk = Math.Rand(0, 10); break; } } } if (shouldWalk == 0) { shouldWalk = Math.Rand(0, 5); if (MovementProcessor.CanNpcMove(map, mapNpcSlot, (Enums.Direction)shouldWalk)) { MovementProcessor.NpcMove(packetList, map, mapNpcSlot, map.ActiveNpc[mapNpcSlot].Direction, Enums.Speed.Walking); } } } } } #endregion #region Used for attacking players if (npcNum > 0) { Client target = map.ActiveNpc[mapNpcSlot].Target; if (target != null) { if (target.IsPlaying() && target.Player.MapID == map.MapID) { // Make sure npcs dont attack more then once a second if (Core.GetTickCount().Elapsed(map.ActiveNpc[mapNpcSlot].AttackTimer, 1000)) { int usableMoveCount = 0; for (int i = 0; i < mapNpc.Moves.Length; i++) { if (mapNpc.Moves[i].MoveNum > -1 && mapNpc.Moves[i].CurrentPP > 0) { usableMoveCount++; } } if (usableMoveCount == 0) { if (BattleProcessor.ShouldUseMove(map, mapNpc, -1)) { mapNpc.UseMove(-1); } } else { // Try to use a move, up to 50 times for (int i = 0; i < 50; i++) { int moveSlotToUse = Server.Math.Rand(0, 5) - 1; if (moveSlotToUse == -1) { // A standard attack if (BattleProcessor.ShouldUseMove(map, mapNpc, moveSlotToUse)) { mapNpc.UseMove(moveSlotToUse); break; } } else { if (mapNpc.Moves[moveSlotToUse].MoveNum > -1 && mapNpc.Moves[moveSlotToUse].CurrentPP > 0) { // Use a move if (BattleProcessor.ShouldUseMove(map, mapNpc, moveSlotToUse)) { mapNpc.UseMove(moveSlotToUse); break; } } } } } } } else { map.ActiveNpc[mapNpcSlot].Target = null; } } } #endregion if (npcNum > 0 && map.ActiveNpc[mapNpcSlot].HPChanged) { map.ActiveNpc[mapNpcSlot].SendHPToMap(packetList, map, mapNpcSlot); } } else { // Scripted AI: Reimplement? //Globals.AIScriptManager.CallAIProcessSub(NpcManager.Npcs[map.Npc[x].NpcNum].AIScript, tickCount, map.MapNum, x); } } } //try and spawn something if (map.NpcSpawnWait == null) { map.NpcSpawnWait = Core.GetTickCount(); } if (Core.GetTickCount().Tick > map.NpcSpawnWait.Tick) { if (livingNpcs < map.MaxNpcs) { map.SpawnNpc(true); } map.NpcSpawnWait = new TickCount(map.NpcSpawnWait.Tick + map.NpcSpawnTime * 1000); } } } //lock (MapManager.ActiveMapLockObject) { bool shouldRemove = false; if (map.PlayersOnMap.Count == 0 && tickCount.Elapsed(map.ActivationTime, AIProcessor.MapTTL)) { if (map.IsProcessingComplete()) { shouldRemove = true; for (int i = 1; i < 9; i++) { IMap borderingMap = MapManager.RetrieveActiveBorderingMap(map, (Enums.MapID)i); if (borderingMap != null) { if (borderingMap.PlayersOnMap.Count > 0) { shouldRemove = false; } } } if (shouldRemove) { MapManager.rwLock.EnterWriteLock(); try { if (map.MapType == Enums.MapType.House) { // Only save the map here when logging out - otherwise, the map is saved when the player is saved map.Save(); } if ((map.MapType == Enums.MapType.RDungeonMap || map.MapType == Enums.MapType.Instanced)) { using (Database.DatabaseConnection dbConnection = new Database.DatabaseConnection(Database.DatabaseID.Data)) { if (MapManager.GetTotalPlayersOnMap(dbConnection, map.MapID) == 0) { DataManager.Maps.MapDataManager.DeleteMap(dbConnection.Database, map.MapID); } else { map.Save(); } } } MapManager.UnsafeRemoveActiveMap(map.MapID); } finally { MapManager.rwLock.ExitWriteLock(); } } } } //} PacketHitList.MethodEnded(ref packetList); } catch (Exception ex) { Server.Exceptions.ErrorLogger.WriteToErrorLog(ex, "MapAIProcessor"); } }
public void SendCloseMenu(Client client, string menuName) { Messenger.SendDataTo(client, TcpPacket.CreatePacket("closemenu", menuName)); MenuClosed(client, menuName); }
public static void ProcessCommand(string command, Enums.ChatChannel chatChannel) { if (string.IsNullOrEmpty(command)) { return; } if (Players.PlayerManager.MyPlayer.TempMuteTimer > Globals.Tick) { return; } else if (Players.PlayerManager.MyPlayer.TalkTimer > Globals.Tick + 6000) { Players.PlayerManager.MyPlayer.TempMuteTimer = Globals.Tick + 8000; ExpKit.Modules.kitChat chat = (ExpKit.Modules.kitChat)Windows.WindowSwitcher.ExpKit.KitContainer.ModuleSwitcher.FindKitModule(Enums.ExpKitModules.Chat); chat.AppendChat("You stop to catch your breath.\n", new SdlDotNet.Widgets.CharRenderOptions(Color.Violet)); return; } else if (Players.PlayerManager.MyPlayer.TalkTimer < Globals.Tick) { Players.PlayerManager.MyPlayer.TalkTimer = Globals.Tick + 3000; } else { Players.PlayerManager.MyPlayer.TalkTimer += 3000; } // Broadcast Message if ((command.StartsWith("'") || chatChannel == Enums.ChatChannel.Global) && (command.StartsWith("/") == false && command.StartsWith("!") == false && command.StartsWith("=") == false)) { string message = command; if (command.StartsWith("'")) { message = command.Substring(1); } else if (chatChannel == Enums.ChatChannel.Global) { message = command; } Messenger.BroadcastMsg(message); return; } if (command.StartsWith("!")) { PMDCP.Core.Command com = PMDCP.Core.CommandProcessor.ParseCommand(command); if (com.CommandArgs.Count == 2) { Messenger.PlayerMsg(com[0].Substring(1), com[1]); } return; } if (command.StartsWith("/edithouse")) { Messenger.SendPacket(TcpPacket.CreatePacket("requestedithouse")); return; } if (command.StartsWith("/refresh")) { Messenger.SendRefresh(); return; } //if (command.StartsWith("/ping")) { // Messenger.SendPing(); // return; //} if (Ranks.IsAllowed(Players.PlayerManager.MyPlayer, Enums.Rank.Monitor)) { // Global Message if (command.StartsWith("/announce")) { Messenger.GlobalMsg(command.Substring(9)); return; } // Admin Message if ((command.StartsWith("=") || chatChannel == Enums.ChatChannel.Staff) && (command.StartsWith("/") == false)) { string message = command; if (command.StartsWith("=")) { message = command.Substring(1); } else if (chatChannel == Enums.ChatChannel.Staff) { message = command; } Messenger.AdminMsg(message); return; } } if (Ranks.IsAllowed(Players.PlayerManager.MyPlayer, Enums.Rank.Mapper)) { // Map Editor if (command.StartsWith("/editmap")) { Messenger.SendPacket(TcpPacket.CreatePacket("requesteditmap")); return; } } if (Ranks.IsAllowed(Players.PlayerManager.MyPlayer, Enums.Rank.Monitor)) { if (command.StartsWith("/loc")) { Logic.Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.DisplayLocation = !Logic.Graphics.Renderers.Screen.ScreenRenderer.RenderOptions.DisplayLocation; return; } } if (command.StartsWith("/ping")) { IO.Options.Ping = !IO.Options.Ping; return; } if (command.StartsWith("/fps")) { IO.Options.FPS = !IO.Options.FPS; return; } if (Ranks.IsAllowed(Players.PlayerManager.MyPlayer, Enums.Rank.Scriptor)) { if (command == "/editscript") { bool syntaxFileExists = System.IO.File.Exists(IO.Paths.StartupPath + "Script/CSharp.syn"); Messenger.SendPacket(TcpPacket.CreatePacket("requesteditscript", syntaxFileExists.ToIntString())); } } #if DEBUG // Just a small test of the music player if (Ranks.IsAllowed(Players.PlayerManager.MyPlayer, Enums.Rank.Scriptor)) { if (command == "/test") { // TODO: Re-enabletest command //Music.Music.AudioPlayer.RunTest(); } } #endif // Test for scripted commands if (command.StartsWith("/")) { //for (int i = 0; i < MaxInfo.MaxEmoticons; i++) //{ // if (Emotions.EmotionHelper.Emotions[i].Command != "/" && Emotions.EmotionHelper.Emotions[i].Command == command) // { // Messenger.SendPacket(TcpPacket.CreatePacket("checkemoticons", i.ToString())); // } //} Messenger.SendPacket(TcpPacket.CreatePacket("checkcommands", command)); return; } if (chatChannel == Enums.ChatChannel.Local) { Messenger.SendMapMsg(command); } else if (chatChannel == Enums.ChatChannel.Guild) { Messenger.SendPacket(TcpPacket.CreatePacket("checkcommands", "/g " + command)); } }
public static bool CanMove(Enums.Direction dirToTest) { Maps.Map map = Maps.MapHelper.ActiveMap; Players.MyPlayer player = Players.PlayerManager.MyPlayer; Enums.Direction dir = player.Direction; int x, y; //Make sure they aren't asleep, or frozen if (player.StatusAilment == Enums.StatusAilment.Freeze || player.StatusAilment == Enums.StatusAilment.Sleep) { return(false); } // Make sure they aren't trying to move when they are already moving if (player.MovementSpeed != Enums.MovementSpeed.Standing || Globals.GettingMap) { return(false); } player.Direction = dirToTest; //make sure they aren't exceeding speed limit if (player.SpeedLimit == Enums.MovementSpeed.Standing && map.Tile[player.Location.X, player.Location.Y].Type != Enums.TileType.Slippery) { Messenger.SendPlayerDir(); return(false); } //test against post-attack cooldown if (!(Players.PlayerManager.MyPlayer.PauseTimer < Globals.Tick)) { Messenger.SendPlayerDir(); return(false); } x = player.Location.X; y = player.Location.Y; switch (dirToTest) { case Enums.Direction.Up: x = player.Location.X; y = player.Location.Y - 1; player.Direction = Enums.Direction.Up; if (y < 0) { if (map.Up > 0 && Windows.WindowSwitcher.GameWindow.inMapEditor == false) { if (Logic.Graphics.Renderers.Maps.SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Up)) { return(true); } else { Messenger.SendPlayerRequestNewMap(false); Globals.GettingMap = true; return(false); } } else { return(false); } } break; case Enums.Direction.Down: x = player.Location.X; y = player.Location.Y + 1; if (y > map.MaxY) { if (map.Down > 0 && Windows.WindowSwitcher.GameWindow.inMapEditor == false) { if (Logic.Graphics.Renderers.Maps.SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Down)) { return(true); } else { Messenger.SendPlayerRequestNewMap(false); Globals.GettingMap = true; return(false); } } else { return(false); } } break; case Enums.Direction.Left: x = player.Location.X - 1; y = player.Location.Y; if (x < 0) { if (map.Left > 0 && Windows.WindowSwitcher.GameWindow.inMapEditor == false) { if (Logic.Graphics.Renderers.Maps.SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Left)) { return(true); } else { Messenger.SendPlayerRequestNewMap(false); Globals.GettingMap = true; return(false); } } else { return(false); } } break; case Enums.Direction.Right: x = player.Location.X + 1; y = player.Location.Y; if (x > map.MaxX) { if (map.Right > 0 && Windows.WindowSwitcher.GameWindow.inMapEditor == false) { if (Logic.Graphics.Renderers.Maps.SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Right)) { return(true); } else { Messenger.SendPlayerRequestNewMap(false); Globals.GettingMap = true; return(false); } } else { return(false); } } break; } if (x < 0 || x > map.MaxX || y < 0 || y > map.MaxY) { return(false); } Maps.Tile tile = map.Tile[x, y]; switch (tile.Type) { case Enums.TileType.Blocked: case Enums.TileType.Sign: case Enums.TileType.ScriptedSign: if (dir != dirToTest) { Messenger.SendPlayerDir(); } return(false); case Enums.TileType.Warp: { if (Windows.WindowSwitcher.GameWindow.inMapEditor) { if (dir != dirToTest) { Messenger.SendPlayerDir(); } return(false); } } break; case Enums.TileType.LevelBlock: if (player.Level > tile.Data1) { return(true); } else { if (dir != dirToTest) { Messenger.SendPlayerDir(); } return(false); } case Enums.TileType.Story: Messenger.SendPacket(TcpPacket.CreatePacket("isstory", x.ToString(), y.ToString())); if (dir != dirToTest) { Messenger.SendPlayerDir(); } return(true); case Enums.TileType.SpriteBlock: if (tile.Data1 == 1) { if (player.Sprite == tile.Data2 || player.Sprite == tile.Data3) { return(true); } else { if (dir != dirToTest) { Messenger.SendPlayerDir(); } return(false); } } else if (tile.Data1 == 2) { if (player.Sprite != tile.Data2 || player.Sprite != tile.Data3) { return(true); } else { if (dir != dirToTest) { Messenger.SendPlayerDir(); } return(false); } } else { if (dir != dirToTest) { Messenger.SendPlayerDir(); } return(false); } case Enums.TileType.MobileBlock: { int mobilityList = tile.Data1; for (int i = 0; i < 16; i++) { if (mobilityList % 2 == 1 && !player.Mobility[i]) { if (dir != dirToTest) { Messenger.SendPlayerDir(); } return(false); } mobilityList /= 2; } // use mobility return(true); } //if (tile.Data1 == player.GetActiveRecruit().Class) { // return true; //} else if (tile.Data2 == player.GetActiveRecruit().Class) { // return true; //} else if (tile.Data3 == player.GetActiveRecruit().Class) { // return true; //} else { // if (dir != dirToTest) { // Tcp.Messenger.SendPlayerDir(); // } // return false; //} case Enums.TileType.Key: case Enums.TileType.Door: if (tile.DoorOpen == false) { if (dir != dirToTest) { Messenger.SendPlayerDir(); } return(false); } break; case Enums.TileType.LinkShop: case Enums.TileType.Assembly: case Enums.TileType.Guild: case Enums.TileType.Bank: case Enums.TileType.Shop: //player.MovementLocked = true; return(true); } foreach (IPlayer playerToTest in PlayerManager.Players.GetAllPlayers()) { if (playerToTest.MapID == map.MapID && playerToTest.ScreenActive) { if (playerToTest.Location.X == x && playerToTest.Location.Y == y) { if (player.Solid == true) { if (dir != dirToTest) { Messenger.SendPlayerDir(); } return(false); } } } } for (int i = 0; i < MaxInfo.MAX_MAP_NPCS; i++) { if (map.MapNpcs[i].Num > 0 && map.MapNpcs[i].ScreenActive) { if (map.MapNpcs[i].Location.X == x && map.MapNpcs[i].Location.Y == y) { if (dir != dirToTest) { Messenger.SendPlayerDir(); } return(false); } } } if (dir != dirToTest) { Messenger.SendPlayerDir(); } return(true); }
private void finalizeScriptToolStripMenuItem_Click(object sender, EventArgs e) { Messenger.SendPacket(TcpPacket.CreatePacket("finalizescript")); }