コード例 #1
0
ファイル: ZaapHandler.cs プロジェクト: nightwolf93/Crystal
 public static void SavePosition(World.Network.WorldClient client, int mapid)
 {
     Database.Records.ZaapRecord zaap = Helper.ZaapHelper.GetZaap(mapid);
     if (zaap != null)
     {
         if (client.Character.SaveMap == mapid)
             return;
         client.Character.SaveMap = mapid;
         client.Character.SaveCell = zaap.CellID;
         client.SendImPacket("06");
         client.Character.SaveAndFlush();
     }
 }
コード例 #2
0
ファイル: BasicHandler.cs プロジェクト: nightwolf93/Crystal
        public static void ChatMessage(World.Network.WorldClient client, string packet)
        {
            string[] data = packet.Substring(2).Split('|');
            string channel = data[0];
            string message = data[1];
            if (message.Length > 300)
                return;
            if (client.Action.LastGlobalMessage > Environment.TickCount)
                return;
            client.Action.LastGlobalMessage = Environment.TickCount + 3000;
            if (World.Manager.WorldManager.MutedAccount.Contains(client.Account.Username))
            {
                client.Action.SystemMessage("Impossible de parler ! Veuilliez contacter un administrateur via le site !");
                return;
            }
            switch (channel)
            {
                case Enums.ChannelEnum.Default:
                    if (message.StartsWith("."))
                    {
                        string[] command = message.Split(' ');
                        PlayerCommandExecute(command[0].Substring(1), command, client);
                    }
                    else if (message.StartsWith("!"))
                    {
                        if (client.Account.AdminLevel > 0)
                        {
                            string[] command = message.Split(' ');
                            AdminCommand(client, "BA" + message.Substring(1));
                        }
                        else
                        {
                            client.Action.SystemMessage("Vous n'avez pas les permissions pour executer les commandes Admin !");
                        }
                    }
                    else
                    {
                        if (client.Action.LastMessage != message)
                        {
                            if (client.Character.Fighter != null)
                            {
                                client.Character.Fighter.Team.Fight.Send("cMK|" + client.Character.ID + "|" + client.Character.Nickname + "|" + message);
                            }
                            else
                            {
                                client.Character.Map.Engine.Send("cMK|" + client.Character.ID + "|" + client.Character.Nickname + "|" + message);
                            }
                            client.Action.LastMessage = message;
                        }
                        else
                        {
                            client.SendImPacket("184");
                        }
                    }
                    break;

                case Enums.ChannelEnum.Trade:
                    if (client.Action.LastMessage != message)
                    {
                        if (client.Character.Level >= Utilities.ConfigurationManager.GetIntValue("MinLevelToSpeakInWorldChannel"))
                        {

                            if (Environment.TickCount > client.Action.LastTradeMessage)
                            {
                                SendChatMessageToAll(World.Helper.WorldHelper.GetClientsArray.ToList(), Enums.ChannelEnum.Trade,
                                    "cMK" + Enums.ChannelEnum.Trade + "|" + client.Character.ID + "|" + client.Character.Nickname + "|" + message);
                                client.Action.LastMessage = message;
                                client.Action.LastTradeMessage = Environment.TickCount + Utilities.ConfigurationManager.GetIntValue("TradeMessageInterval");
                            }
                            else
                            {
                                client.Action.SystemMessage("Veuilliez attendre encore un peu avant de pouvoir parler !");
                            }

                        }
                        else
                        {
                            client.SendImPacket("0157", Utilities.ConfigurationManager.GetIntValue("MinLevelToSpeakInWorldChannel").ToString());
                        }
                    }
                    else
                    {
                        client.SendImPacket("184");
                    }
                    break;

                case Enums.ChannelEnum.Recruitment:
                    if (client.Action.LastMessage != message)
                    {
                        if (client.Character.Level >= Utilities.ConfigurationManager.GetIntValue("MinLevelToSpeakInWorldChannel"))
                        {

                            if (Environment.TickCount > client.Action.LastRecruitementMessage)
                            {
                                SendChatMessageToAll(World.Helper.WorldHelper.GetClientsArray.ToList(), Enums.ChannelEnum.Recruitment,
                                    "cMK" + Enums.ChannelEnum.Recruitment + "|" + client.Character.ID + "|" + client.Character.Nickname + "|" + message);
                                client.Action.LastMessage = message;
                                client.Action.LastRecruitementMessage = Environment.TickCount + Utilities.ConfigurationManager.GetIntValue("RecruitementMessageInterval");
                            }
                            else
                            {
                                client.Action.SystemMessage("Veuilliez attendre encore un peu avant de pouvoir parler !");
                            }

                        }
                        else
                        {
                            client.SendImPacket("0157", Utilities.ConfigurationManager.GetIntValue("MinLevelToSpeakInWorldChannel").ToString());
                        }
                    }
                    else
                    {
                        client.SendImPacket("184");
                    }
                    break;

                case Enums.ChannelEnum.Admin:
                    if (client.Account.AdminLevel > 0)
                    {
                        Manager.WorldManager.Server.Clients.FindAll(x => x.Account != null).FindAll(x => x.Account.AdminLevel > 0).ForEach(x => x.Send("cMK" + Enums.ChannelEnum.Admin + "|" + client.Character.ID + "|" + client.Character.Nickname + "|" + message));
                    }
                    break;

                case Enums.ChannelEnum.Party:
                    if (client.Character.Party != null)
                    {
                        SendChatMessageToAll(client.Character.Party.Members, Enums.ChannelEnum.Party, "cMK" + Enums.ChannelEnum.Party + "|" + client.Character.ID + "|" + client.Character.Nickname + "|" + message);
                    }
                    break;

                case Enums.ChannelEnum.Guild:
                    if (client.Action.Guild != null)
                    {
                        client.Action.Guild.Send("cMK" + Enums.ChannelEnum.Guild + "|" + client.Character.ID + "|" + client.Character.Nickname + "|" + message);
                    }
                    break;

                case Enums.ChannelEnum.Osef:

                    break;

                default:
                    string nickname = channel;
                    Network.WorldClient player = Helper.WorldHelper.GetClientByCharacter(nickname);
                    if (player != null)
                    {
                        if (!player.Action.Away && !player.AccountData.EnemiesIDs.Contains(client.AccountData.AccountID))
                        {
                            if (client.Account.AdminLevel == 0)
                            {
                                client.Send("cMKT|" + client.Character.ID + "|" + nickname + "|" + message);
                                player.Send("cMKF|" + client.Character.ID + "|" + client.Character.Nickname + "|" + message);
                            }
                            else
                            {
                                client.Send("cMKT|" + client.Character.ID + "|" + nickname + "|" + message);
                                player.Action.BasicMessage("De <b><a href='asfunction:onHref,ShowPlayerPopupMenu," +
                                            client.Character.Nickname + "'>[MJ]" + client.Character.Nickname + "</a></b> : " + message, "#FF0000");
                            }
                        }
                        else
                        {
                            client.SendImPacket("114", player.Character.Nickname);
                        }
                    }
                    else
                    {
                        client.Send("cMEf" + nickname);
                    }
                    break;
            }

            Interop.PythonScripting.ScriptManager.CallEventPlayerSpeak(client, message, channel);
        }
コード例 #3
0
ファイル: BasicHandler.cs プロジェクト: nightwolf93/Crystal
 public static void WantAwayMode(World.Network.WorldClient client, string packet)
 {
     if (!client.Action.Away)
     {
         client.Action.Away = true;
         client.SendImPacket("037");
     }
     else
     {
         client.Action.Away = false;
         client.SendImPacket("038");
     }
 }
コード例 #4
0
ファイル: ZaapHandler.cs プロジェクト: nightwolf93/Crystal
 public static void UseZaap(World.Network.WorldClient client, string packet)
 {
     int map = int.Parse(packet.Substring(2));
     Database.Records.ZaapRecord zaap = Helper.ZaapHelper.GetZaap(map);
     if (zaap != null)
     {
         int price = GetPriceOfTravel(map, client.Character.MapID);
         if (price <= client.Character.Kamas)
         {
             client.Action.RemoveKamas(price);
             Network.World.GoToMap(client, zaap.MapID, zaap.CellID);
             CloseZaapPanel(client);
         }
         else
         {
             client.SendImPacket("1128");
         }
     }
     else
     {
         client.Action.SystemMessage("Le zaap demander est inexistant !");
     }
 }