Exemplo n.º 1
0
        public void OnRemoveMapItem(MapItem mapItem, int index)
        {
            ServerCommand command = new ServerCommand(ServerCommand.CommandType.RemoveMapItem);

            command.SetParameter("MapID", _mapID);
            command.SetParameter("ItemIndex", index);
            for (int i = 0; i < _clients.Count; i++)
            {
                _clients[i].AddServerCommand(command);
            }
        }
Exemplo n.º 2
0
        public void OnRemoveTradeItem(int otherID, int itemID, int count)
        {
            GameClient other = _serverMap.FindGameClient(otherID);

            if (other != null)
            {
                ServerCommand command = new ServerCommand(ServerCommand.CommandType.RemoveTradeItem);
                command.SetParameter("ItemIndex", itemID);
                command.SetParameter("Count", count);
                other.AddServerCommand(command);
            }
        }
Exemplo n.º 3
0
        public void OnRequestTrade(int otherID)
        {
            GameClient otherClient = _serverMap.FindGameClient(otherID);

            if (otherClient != null)
            {
                ServerCommand command = new ServerCommand(ServerCommand.CommandType.TradeRequest);
                command.SetParameter("PlayerID", _mapPlayer.GetPlayerPacket().PlayerID);
                command.SetParameter("PlayerName", _mapPlayer.GetPlayerPacket().Username);
                otherClient.AddServerCommand(command);
            }
        }
Exemplo n.º 4
0
        public void OnUpdateMapItem(MapItem mapItem, int index)
        {
            ServerCommand command = new ServerCommand(ServerCommand.CommandType.UpdateMapItem);

            command.SetParameter("MapID", _mapID);
            command.SetParameter("ItemIndex", index);
            command.SetParameter("PlayerID", mapItem.PlayerID);
            command.SetParameter("Count", mapItem.Count);
            for (int i = 0; i < _clients.Count; i++)
            {
                _clients[i].AddServerCommand(command);
            }
        }
Exemplo n.º 5
0
        private void OnAddMapEnemy(MapEnemy mapEnemy, int index)
        {
            ServerCommand serverCommand = new ServerCommand(ServerCommand.CommandType.AddMapEnemy);

            serverCommand.SetParameter("EnemyID", mapEnemy.GetEnemyID());
            serverCommand.SetParameter("MapID", _mapID);
            serverCommand.SetParameter("MapX", mapEnemy.MapX);
            serverCommand.SetParameter("MapY", mapEnemy.MapY);
            serverCommand.SetParameter("OnBridge", mapEnemy.OnBridge);

            for (int i = 0; i < _clients.Count; i++)
            {
                _clients[i].AddServerCommand(serverCommand);
            }
        }
Exemplo n.º 6
0
        public void OnShowWorkbench(int workbenchID)
        {
            ServerCommand command = new ServerCommand(ServerCommand.CommandType.ShowWorkbench);

            command.SetParameter("WorkbenchID", workbenchID);
            this.AddServerCommand(command);
        }
Exemplo n.º 7
0
        public void OnShowShop(int shopID)
        {
            ServerCommand serverCommand = new ServerCommand(ServerCommand.CommandType.ShowShop);

            serverCommand.SetParameter("ShopID", shopID);
            this.AddServerCommand(serverCommand);
        }
Exemplo n.º 8
0
        private void OnUpdateMapEventEnabled(MapEvent mapEvent, int eventIndex)
        {
            if (mapEvent.EnabledChanged)
            {
                ServerCommand serverCommand = new ServerCommand(ServerCommand.CommandType.ChangeMapEventEnabled);
                serverCommand.SetParameter("EventID", eventIndex);
                serverCommand.SetParameter("MapID", _mapID);
                serverCommand.SetParameter("Enabled", mapEvent.Enabled);

                for (int i = 0; i < _clients.Count; i++)
                {
                    _clients[i].AddServerCommand(serverCommand);
                }
                mapEvent.EnabledChanged = false;
            }
        }
Exemplo n.º 9
0
        private void OnUpdateMapEventRenderPriority(MapEvent mapEvent, int eventIndex)
        {
            if (mapEvent.RenderPriorityChanged)
            {
                ServerCommand serverCommand = new ServerCommand(ServerCommand.CommandType.ChangeMapEventRenderPriority);
                serverCommand.SetParameter("EventID", eventIndex);
                serverCommand.SetParameter("MapID", _mapID);
                serverCommand.SetParameter("RenderPriority", (int)mapEvent.Priority);

                for (int i = 0; i < _clients.Count; i++)
                {
                    _clients[i].AddServerCommand(serverCommand);
                }
                mapEvent.RenderPriorityChanged = false;
            }
        }
Exemplo n.º 10
0
        public void OnStartTrade(int otherID)
        {
            GameClient other = _serverMap.FindGameClient(otherID);

            if (other != null)
            {
                ServerCommand sCommand = new ServerCommand(ServerCommand.CommandType.StartTrade);
                sCommand.SetParameter("PlayerID", other.GetMapPlayer().PlayerID);
                sCommand.SetParameter("PlayerName", other.GetMapPlayer().Username);
                AddServerCommand(sCommand);

                sCommand = new ServerCommand(ServerCommand.CommandType.StartTrade);
                sCommand.SetParameter("PlayerID", _mapPlayer.PlayerID);
                sCommand.SetParameter("PlayerName", _mapPlayer.Username);
                other.AddServerCommand(sCommand);
            }
        }
Exemplo n.º 11
0
        public void OnShowMessage(string message, string options)
        {
            ServerCommand serverCommand;

            if (options == null)
            {
                serverCommand = new ServerCommand(ServerCommand.CommandType.ShowMessage);
                serverCommand.SetParameter("Message", message);
                AddServerCommand(serverCommand);
            }
            else
            {
                serverCommand = new ServerCommand(ServerCommand.CommandType.ShowOptions);
                serverCommand.SetParameter("Message", message);
                serverCommand.SetParameter("Options", options);
                AddServerCommand(serverCommand);
            }
        }
Exemplo n.º 12
0
        private void OnUpdateMapEnemy(MapEnemy mapEnemy, int index)
        {
            if (mapEnemy.Changed)
            {
                ServerCommand serverCommand = new ServerCommand(ServerCommand.CommandType.UpdateMapEnemy);
                serverCommand.SetParameter("EnemyIndex", index);
                serverCommand.SetParameter("MapID", _mapID);
                serverCommand.SetParameter("HP", mapEnemy.HP);
                serverCommand.SetParameter("MapX", mapEnemy.MapX);
                serverCommand.SetParameter("MapY", mapEnemy.MapY);
                serverCommand.SetParameter("RealX", mapEnemy.RealX);
                serverCommand.SetParameter("RealY", mapEnemy.RealY);
                serverCommand.SetParameter("Direction", (int)mapEnemy.Direction);
                serverCommand.SetParameter("OnBridge", mapEnemy.OnBridge);
                serverCommand.SetParameter("Dead", mapEnemy.Dead);

                for (int i = 0; i < _clients.Count; i++)
                {
                    _clients[i].AddServerCommand(serverCommand);
                }
            }
        }
Exemplo n.º 13
0
        public void OnAddMapProjectile(MapProjectile mapProjectile, int index)
        {
            ServerCommand command = new ServerCommand(ServerCommand.CommandType.AddProjectile);

            command.SetParameter("MapID", _mapID);
            command.SetParameter("DataID", mapProjectile.ProjectileID);
            command.SetParameter("RealX", mapProjectile.Position.X);
            command.SetParameter("RealY", mapProjectile.Position.Y);
            command.SetParameter("VelocityX", mapProjectile.Velocity.X);
            command.SetParameter("VelocityY", mapProjectile.Velocity.Y);
            command.SetParameter("Direction", (int)mapProjectile.Direction);
            command.SetParameter("OnBridge", mapProjectile.OnBridge);

            for (int i = 0; i < _clients.Count; i++)
            {
                _clients[i].AddServerCommand(command);
            }
        }
Exemplo n.º 14
0
        private void OnUpdateMapEventMovement(MapEvent mapEvent, int eventIndex)
        {
            if (mapEvent.PositionChanged)
            {
                ServerCommand serverCommand = new ServerCommand(ServerCommand.CommandType.UpdateMapEvent);
                serverCommand.SetParameter("EventID", eventIndex);
                serverCommand.SetParameter("MapID", _mapID);
                serverCommand.SetParameter("MapX", mapEvent.MapX);
                serverCommand.SetParameter("MapY", mapEvent.MapY);
                serverCommand.SetParameter("RealX", mapEvent.RealX);
                serverCommand.SetParameter("RealY", mapEvent.RealY);
                serverCommand.SetParameter("Direction", (int)mapEvent.EventDirection);
                serverCommand.SetParameter("OnBridge", mapEvent.OnBridge);

                for (int i = 0; i < _clients.Count; i++)
                {
                    _clients[i].AddServerCommand(serverCommand);
                }
                mapEvent.PositionChanged = false;
            }
        }
Exemplo n.º 15
0
 public void OnAddMapItem(MapItem mapItem, int index)
 {
     if (mapItem.Changed)
     {
         ServerCommand command = new ServerCommand(ServerCommand.CommandType.AddMapItem);
         command.SetParameter("MapID", _mapID);
         command.SetParameter("ItemID", mapItem.ItemID);
         command.SetParameter("Count", mapItem.Count);
         command.SetParameter("MapX", mapItem.MapX);
         command.SetParameter("MapY", mapItem.MapY);
         command.SetParameter("PlayerID", mapItem.PlayerID);
         command.SetParameter("OnBridge", mapItem.OnBridge);
         for (int i = 0; i < _clients.Count; i++)
         {
             _clients[i].AddServerCommand(command);
         }
     }
 }
Exemplo n.º 16
0
 public void OnUpdateMapProjectile(MapProjectile mapProjectile, int index)
 {
     if (mapProjectile.Changed)
     {
         ServerCommand serverCommand = new ServerCommand(ServerCommand.CommandType.UpdateProjectile);
         serverCommand.SetParameter("MapID", _mapID);
         serverCommand.SetParameter("ProjectileID", index);
         serverCommand.SetParameter("RealX", mapProjectile.Position.X);
         serverCommand.SetParameter("RealY", mapProjectile.Position.Y);
         serverCommand.SetParameter("OnBridge", mapProjectile.OnBridge);
         serverCommand.SetParameter("Destroyed", mapProjectile.Destroyed);
         for (int i = 0; i < _clients.Count; i++)
         {
             _clients[i].AddServerCommand(serverCommand);
         }
     }
 }