Пример #1
0
 public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet)
 {
     if (player.CurrentMarryRoom != null && player.CurrentMarryRoom.RoomState == eRoomState.FREE)
     {
         player.X = packet.ReadInt();
         player.Y = packet.ReadInt();
         //0 player.CurrentMarryRoom.ReturnPacket(player, packet);
         player.CurrentMarryRoom.ReturnPacketForScene(player, packet);
         return true;
     }
     return false;
 }
Пример #2
0
 public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet)
 {
     if (player.CurrentMarryRoom != null && player.CurrentMarryRoom.RoomState == eRoomState.FREE)
     {
         if(player.PlayerCharacter.ID == player.CurrentMarryRoom.Info.GroomID || player.PlayerCharacter.ID == player.CurrentMarryRoom.Info.BrideID)
         {
             int userID = packet.ReadInt();
             player.CurrentMarryRoom.KickPlayerByUserID(player, userID);
             return true;
         }
     }
     return false;
 }
        public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            if (player.CurrentMarryRoom != null/* && player.CurrentMarryRoom.RoomState == eRoomState.FREE*/)
            {
                int userID = packet.ReadInt();
                int templateID = packet.ReadInt();

                //ItemTemplateInfo template = ItemMgr.FindItemTemplate(templateID);
                ShopItemInfo temp = ShopMgr.FindShopbyTemplatID(templateID).FirstOrDefault();
                if (temp != null)
                {

                    if(temp.APrice1 == -2)
                    {
                        if(player.PlayerCharacter.Gold >= temp.AValue1)
                        {
                            player.RemoveGold(temp.AValue1);
                            //0 player.CurrentMarryRoom.ReturnPacket(player, packet);
                            player.CurrentMarryRoom.ReturnPacketForScene(player, packet);
                            player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("UserFirecrackersCommand.Successed1", temp.AValue1));
                            return true;
                        }
                        else
                        {
                            player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("UserFirecrackersCommand.GoldNotEnough"));
                        }
                    }
                    if (temp.APrice1 == -1)
                    {
                        if (player.PlayerCharacter.Money >= temp.AValue1)
                        {
                            player.RemoveMoney(temp.AValue1);
                            LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Flower, player.PlayerCharacter.ID, temp.AValue1, player.PlayerCharacter.Money, 0, 0, 0,0, "", "", "");
                            player.CurrentMarryRoom.ReturnPacketForScene(player, packet);
                            player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("UserFirecrackersCommand.Successed2", temp.AValue1));
                            return true;
                        }
                        else
                        {
                            player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough"));
                        }
                    }
                }

            }
            return false;
        }
Пример #4
0
        public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            if (player.CurrentMarryRoom != null /*&& player.PlayerCharacter.ID == player.CurrentMarryRoom.Info.PlayerID*/ )
            {
                if (player.PlayerCharacter.ID == player.CurrentMarryRoom.Info.GroomID || player.PlayerCharacter.ID == player.CurrentMarryRoom.Info.BrideID)
                {
                    int userID = packet.ReadInt();
                    if (userID != player.CurrentMarryRoom.Info.BrideID && userID != player.CurrentMarryRoom.Info.GroomID)
                    {
                        player.CurrentMarryRoom.KickPlayerByUserID(player, userID);
                        player.CurrentMarryRoom.SetUserForbid(userID);
                    }

                    return true;
                }
            }
            return false;
        }
Пример #5
0
        public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            if (player.CurrentMarryRoom == null || player.CurrentMarryRoom.RoomState != eRoomState.FREE)
            {
                return false;
            }

            if (player.CurrentMarryRoom.Info.GuestInvite == false)
            {
                if( player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.GroomID && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.BrideID)
                {
                    return false;
                }
            }
            
            GSPacketIn pkg = packet.Clone();
            pkg.ClearContext();

            int id = packet.ReadInt();
            GamePlayer invitedplayer = Managers.WorldMgr.GetPlayerById(id);
            if (invitedplayer != null && invitedplayer.CurrentRoom == null && invitedplayer.CurrentMarryRoom == null)
            {
                pkg.WriteByte((byte)MarryCmdType.INVITE);
                pkg.WriteInt(player.PlayerCharacter.ID);
                pkg.WriteString(player.PlayerCharacter.NickName);
                pkg.WriteInt(player.CurrentMarryRoom.Info.ID);
                //pkg.WriteInt(player.CurrentMarryRoom.Info.MapIndex);
                pkg.WriteString(player.CurrentMarryRoom.Info.Name);
                pkg.WriteString(player.CurrentMarryRoom.Info.Pwd);
                pkg.WriteInt(player.MarryMap);

                invitedplayer.Out.SendTCP(pkg);

                return true;
            }

            return false;

        }
Пример #6
0
        public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            if (player.CurrentMarryRoom == null)
            {
                return false;
            }

            if (player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.GroomID && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.BrideID)
            {
                return false;
            }

            int hour = packet.ReadInt();
            string[] money = GameProperties.PRICE_MARRY_ROOM.Split(',');
            if (money.Length < 3)
            {
                if (log.IsErrorEnabled)
                    log.Error("MarryRoomCreateMoney node in configuration file is wrong");

                return false;
            }

            int needMoney = 0;
            switch (hour)
            {
                case 2:
                    needMoney = int.Parse(money[0]);
                    break;
                case 3:
                    needMoney = int.Parse(money[1]);
                    break;
                case 4:
                    needMoney = int.Parse(money[2]);
                    break;
                default:
                    needMoney = int.Parse(money[2]);
                    hour = 4;
                    break;
            }

            if (player.PlayerCharacter.Money < needMoney)
            {
                player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg1"));
                return false;
            }

            //player.SetMoney(-needMoney, MoneyRemoveType.Marry);
            player.RemoveMoney(needMoney);
            LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_RoomAdd, player.PlayerCharacter.ID, needMoney, player.PlayerCharacter.Money, 0, 0, 0, "", "", "");

            CountBussiness.InsertSystemPayCount(player.PlayerCharacter.ID, needMoney, 0, (int)eConsumerType.Marry, (int)eSubConsumerType.Marry_MarryRoom);

            player.CurrentMarryRoom.RoomContinuation(hour);

            GSPacketIn pkg = player.Out.SendContinuation(player, player.CurrentMarryRoom.Info);

            int spouseID = 0;
            if (player.PlayerCharacter.ID == player.CurrentMarryRoom.Info.GroomID)
            {
                spouseID = player.CurrentMarryRoom.Info.BrideID;
            }
            else
            {
                spouseID = player.CurrentMarryRoom.Info.GroomID;
            }

            GamePlayer spouse = WorldMgr.GetPlayerById(spouseID);
            if (spouse != null)
            {
                spouse.Out.SendTCP(pkg);
            }
            
            player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ContinuationCommand.Successed"));
            
            return true;
        }
Пример #7
0
        public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            if (player.CurrentMarryRoom != null/* && player.CurrentMarryRoom.RoomState == eRoomState.FREE*/)
            {
                int userID = packet.ReadInt();
                int templateID = packet.ReadInt();


                ItemTemplateInfo template = ItemMgr.FindItemTemplate(templateID);

                if(template != null)
                {
                    if (player.CurrentMarryRoom.Info.IsGunsaluteUsed == false && (player.CurrentMarryRoom.Info.GroomID == player.PlayerCharacter.ID
                        || player.CurrentMarryRoom.Info.BrideID == player.PlayerCharacter.ID))
                    {
                        player.CurrentMarryRoom.ReturnPacketForScene(player, packet);
                        player.CurrentMarryRoom.Info.IsGunsaluteUsed = true;
                        GSPacketIn msg = player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("GunsaluteCommand.Successed1", player.PlayerCharacter.NickName));
                        player.CurrentMarryRoom.SendToPlayerExceptSelfForScene(msg,player);
                        GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(player.CurrentMarryRoom.Info.GroomID, true, player.CurrentMarryRoom.Info);
                        GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(player.CurrentMarryRoom.Info.BrideID, true, player.CurrentMarryRoom.Info);

                        using (PlayerBussiness db = new PlayerBussiness())
                        {
                            db.UpdateMarryRoomInfo(player.CurrentMarryRoom.Info);
                        }

                        return true;
                    }
                    //未开始
                    //if(template.PayType == 0)
                    //{
                    //    if(player.PlayerCharacter.Gold >= template.Price1)
                    //    {
                    //        player.RemoveGold(template.Price1, GoldRemoveType.Firecrackers);
                    //        CountBussiness.InsertSystemPayCount(player.PlayerCharacter.ID, 0, template.Price1, (int)eConsumerType.Marry, (int)eSubConsumerType.Marry_Gunsalute);
                    //        //0 player.CurrentMarryRoom.ReturnPacket(player, packet);
                    //        player.CurrentMarryRoom.ReturnPacketForScene(player, packet);
                    //        GSPacketIn msg = player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("GunsaluteCommand.Successed1", player.PlayerCharacter.NickName));
                    //        player.CurrentMarryRoom.SendToPlayerExceptSelfForScene(msg, player);
                    //        return true;
                    //    }
                    //    else
                    //    {
                    //        player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("GunsaluteCommand.GoldNotEnough"));
                    //    }
                    //}
                    //else
                    //{
                    //    if(player.PlayerCharacter.Money >= template.Price1)
                    //    {
                    //        player.RemoveMoney(template.Price1, MoneyRemoveType.Firecrackers);
                    //        CountBussiness.InsertSystemPayCount(player.PlayerCharacter.ID, template.Price1, 0, (int)eConsumerType.Marry, (int)eSubConsumerType.Marry_Gunsalute);
                    //        //0 player.CurrentMarryRoom.ReturnPacket(player, packet);
                    //        player.CurrentMarryRoom.ReturnPacketForScene(player, packet);
                    //        GSPacketIn msg = player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("GunsaluteCommand.Successed1", player.PlayerCharacter.NickName));
                    //        player.CurrentMarryRoom.SendToPlayerExceptSelfForScene(msg, player);
                    //        return true;
                    //    }
                    //    else
                    //    {
                    //        player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("GunsaluteCommand.MoneyNotEnough"));
                    //    }
                    //}
                }
            }
            return false;
        }
Пример #8
0
        public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            if (player.CurrentMarryRoom == null /*|| player.CurrentMarryRoom.RoomState != eRoomState.FREE*/)
            {
                return false;
            }

            //if (player.PlayerCharacter.ID == player.CurrentMarryRoom.Info.GroomID || player.PlayerCharacter.ID == player.CurrentMarryRoom.Info.BrideID)
            //{
            //    return false;
            //}

            int num = packet.ReadInt();

            if (num > 0)
            {
                if (player.PlayerCharacter.Money >= num)
                {
                    //player.SetMoney(-num, MoneyAddType.Marry);
                    player.RemoveMoney(num);
                    LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Gift, player.PlayerCharacter.ID, num, player.PlayerCharacter.Money, 0, 0, 0,0, "", "", "");
                }
                else
                {
                    player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough"));
                    return false;
                }

                using (PlayerBussiness pb = new PlayerBussiness())
                {
                    string content = LanguageMgr.GetTranslation("LargessCommand.Content",player.PlayerCharacter.NickName,num / 2);
                    string title = LanguageMgr.GetTranslation("LargessCommand.Title",player.PlayerCharacter.NickName);

                    MailInfo mail1 = new MailInfo();
                    mail1.Annex1 = "";
                    mail1.Content = content;
                    mail1.Gold = 0;
                    mail1.IsExist = true;
                    mail1.Money = num / 2;
                    mail1.Receiver = player.CurrentMarryRoom.Info.BrideName;
                    mail1.ReceiverID = player.CurrentMarryRoom.Info.BrideID;
                    mail1.Sender = LanguageMgr.GetTranslation("LargessCommand.Sender");
                    mail1.SenderID = 0;
                    mail1.Title = title;
                    mail1.Type = (int)eMailType.Marry;
                    pb.SendMail(mail1);

                    player.Out.SendMailResponse(mail1.ReceiverID, eMailRespose.Receiver);

                    MailInfo mail2 = new MailInfo();
                    mail2.Annex1 = "";
                    mail2.Content = content;
                    mail2.Gold = 0;
                    mail2.IsExist = true;
                    mail2.Money = num / 2;
                    mail2.Receiver = player.CurrentMarryRoom.Info.GroomName;
                    mail2.ReceiverID = player.CurrentMarryRoom.Info.GroomID;
                    mail2.Sender = LanguageMgr.GetTranslation("LargessCommand.Sender");
                    mail2.SenderID = 0;
                    mail2.Title = title;
                    mail2.Type = (int)eMailType.Marry;
                    pb.SendMail(mail2);

                    player.Out.SendMailResponse(mail2.ReceiverID, eMailRespose.Receiver);
                }

                player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("LargessCommand.Succeed"));
                GSPacketIn msg = player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("LargessCommand.Notice", player.PlayerCharacter.NickName, num));
                player.CurrentMarryRoom.SendToPlayerExceptSelf(msg,player);

                return true;
            }

            return false;
        }