Ejemplo n.º 1
0
 public bool HandleCommand(TankHotSpringLogicProcessor process, GamePlayer player, GSPacketIn packet)
 {
     if (player.CurrentHotSpringRoom != null)
     {
         int num = packet.ReadInt();
         if (num <= 0)
         {
             return false;
         }
         if (player.PlayerCharacter.Money >= num)
         {
             player.RemoveMoney(num);
             LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Gift, player.PlayerCharacter.ID, num, player.PlayerCharacter.Money, 0, 0, 0, "", "", "");
             using (PlayerBussiness bussiness = new PlayerBussiness())
             {
                 string translation = LanguageMgr.GetTranslation("LargessCommand.Content", new object[] { player.PlayerCharacter.NickName, num / 2 });
                 string str2 = LanguageMgr.GetTranslation("LargessCommand.Title", new object[] { player.PlayerCharacter.NickName });
                 MailInfo mail = new MailInfo {
                     Annex1 = "",
                     Content = translation,
                     Gold = 0,
                     IsExist = true,
                     Money = num / 2,
                     Receiver = player.CurrentHotSpringRoom.Info.playerName,
                     ReceiverID = player.CurrentHotSpringRoom.Info.playerID,
                     Sender = LanguageMgr.GetTranslation("LargessCommand.Sender", new object[0]),
                     SenderID = 0,
                     Title = str2,
                     Type = 14
                 };
                 bussiness.SendMail(mail);
                 player.Out.SendMailResponse(mail.ReceiverID, eMailRespose.Receiver);
                 MailInfo info2 = new MailInfo {
                     Annex1 = "",
                     Content = translation,
                     Gold = 0,
                     IsExist = true,
                     Money = num / 2,
                     Receiver = player.CurrentHotSpringRoom.Info.GroomName,
                     ReceiverID = player.CurrentHotSpringRoom.Info.GroomID,
                     Sender = LanguageMgr.GetTranslation("LargessCommand.Sender", new object[0]),
                     SenderID = 0,
                     Title = str2,
                     Type = 14
                 };
                 bussiness.SendMail(info2);
                 player.Out.SendMailResponse(info2.ReceiverID, eMailRespose.Receiver);
             }
             player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("LargessCommand.Succeed", new object[0]));
             GSPacketIn @in = player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("LargessCommand.Notice", new object[] { player.PlayerCharacter.NickName, num }));
             player.CurrentHotSpringRoom.SendToPlayerExceptSelf(@in, player);
             return true;
         }
         player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough", new object[0]));
     }
     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;
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
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 needMoney = GameProperties.PRICE_PROPOSE;
            if(player.CurrentMarryRoom.Info.IsHymeneal)
            {
                if (player.PlayerCharacter.Money < needMoney)
                {
                    player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("UserFirecrackersCommand.MoneyNotEnough"));
                    return false;
                }
            }

            GamePlayer Groom = player.CurrentMarryRoom.GetPlayerByUserID(player.CurrentMarryRoom.Info.GroomID);
            if(Groom == null)
            {
                player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("HymenealCommand.NoGroom"));
                return false;
            }

            GamePlayer Bride = player.CurrentMarryRoom.GetPlayerByUserID(player.CurrentMarryRoom.Info.BrideID);
            if (Bride == null)
            {
                player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("HymenealCommand.NoBride"));
                return false;
            }

            bool result = false;
            bool isFirst = false;
            GSPacketIn pkg = packet.Clone();

            int hymenealState = packet.ReadInt();

            if (1 == hymenealState)
            {
                player.CurrentMarryRoom.RoomState = eRoomState.FREE;
            }
            else
            {
                player.CurrentMarryRoom.RoomState = eRoomState.Hymeneal;
                player.CurrentMarryRoom.BeginTimerForHymeneal(170 * 1000);

                if (!player.PlayerCharacter.IsGotRing)
                {
                    isFirst = true;
                    ItemTemplateInfo ringTemplate = ItemMgr.FindItemTemplate(9022);
                    ItemInfo ring1 = ItemInfo.CreateFromTemplate(ringTemplate, 1, (int)ItemAddType.webing);
                    ring1.IsBinds = true;
                    //Groom.CurrentInventory.AddItem(ring1, 11);
                    using (PlayerBussiness pb = new PlayerBussiness())
                    {
                        ring1.UserID = 0;
                        pb.AddGoods(ring1);

                        string content = LanguageMgr.GetTranslation("HymenealCommand.Content", Bride.PlayerCharacter.NickName);

                        MailInfo mail = new MailInfo();
                        mail.Annex1 = ring1.ItemID.ToString();
                        mail.Content = content;
                        mail.Gold = 0;
                        mail.IsExist = true;
                        mail.Money = 0;
                        mail.Receiver = Groom.PlayerCharacter.NickName;
                        mail.ReceiverID = Groom.PlayerCharacter.ID;
                        mail.Sender = LanguageMgr.GetTranslation("HymenealCommand.Sender");
                        mail.SenderID = 0;
                        mail.Title = LanguageMgr.GetTranslation("HymenealCommand.Title");
                        mail.Type = (int)eMailType.Marry;
                        if (pb.SendMail(mail))
                        {
                            result = true;
                        }
                        player.Out.SendMailResponse(mail.ReceiverID, eMailRespose.Receiver);
                    }

                    ItemInfo ring2 = ItemInfo.CreateFromTemplate(ringTemplate, 1, (int)ItemAddType.webing);
                    ring2.IsBinds = true;
                    //Bride.CurrentInventory.AddItem(ring2, 11);
                    using (PlayerBussiness pb = new PlayerBussiness())
                    {
                        ring2.UserID = 0;
                        pb.AddGoods(ring2);

                        string content = LanguageMgr.GetTranslation("HymenealCommand.Content", Groom.PlayerCharacter.NickName);

                        MailInfo mail = new MailInfo();
                        mail.Annex1 = ring2.ItemID.ToString();
                        mail.Content = content;
                        mail.Gold = 0;
                        mail.IsExist = true;
                        mail.Money = 0;
                        mail.Receiver = Bride.PlayerCharacter.NickName;
                        mail.ReceiverID = Bride.PlayerCharacter.ID;
                        mail.Sender = LanguageMgr.GetTranslation("HymenealCommand.Sender");
                        mail.SenderID = 0;
                        mail.Title = LanguageMgr.GetTranslation("HymenealCommand.Title");
                        mail.Type = (int)eMailType.Marry;
                        if (pb.SendMail(mail))
                        {
                            result = true;
                        }
                        player.Out.SendMailResponse(mail.ReceiverID, eMailRespose.Receiver);
                    }

                    player.CurrentMarryRoom.Info.IsHymeneal = true;

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

                        //更新IsGotRing的数据库
                        db.UpdatePlayerGotRingProp(Groom.PlayerCharacter.ID,Bride.PlayerCharacter.ID);

                        //通过数据库读入PlayerCharacter内存
                        Groom.LoadMarryProp();
                        Bride.LoadMarryProp();
                    }

                    //Groom.PlayerCharacter.IsGotRing = true;
                    //Bride.PlayerCharacter.IsGotRing = true;

                }
                else
                {
                    isFirst = false;
                    result = true;
                }

                if (!isFirst)
                {
                    //player.SetMoney(-needMoney, MoneyRemoveType.Marry);
                    player.RemoveMoney(needMoney);
                    LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Hymeneal, player.PlayerCharacter.ID, needMoney, player.PlayerCharacter.Money, 0, 0, 0,0, "", "", "");
                    CountBussiness.InsertSystemPayCount(player.PlayerCharacter.ID, needMoney, 0, (int)eConsumerType.Marry, (int)eSubConsumerType.Marry_Hymeneal);
                }

                pkg.WriteInt(player.CurrentMarryRoom.Info.ID);
                pkg.WriteBoolean(result);
                //0 player.CurrentMarryRoom.SendToAll(pkg);
                //0 player.CurrentMarryRoom.SendToAllForScene(pkg,1);
                player.CurrentMarryRoom.SendToAll(pkg);

                if(result)
                {
                    string msg = LanguageMgr.GetTranslation("HymenealCommand.Succeed", Groom.PlayerCharacter.NickName, Bride.PlayerCharacter.NickName);
                    GSPacketIn message = player.Out.SendMessage(eMessageType.ChatNormal, msg);
                    player.CurrentMarryRoom.SendToPlayerExceptSelfForScene(message, player);
                }
            }

            return true;
        }
Ejemplo n.º 5
0
        public bool HandleCommand(TankHotSpringLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            if (player.CurrentHotSpringRoom == null /*|| player.CurrentHotSpringRoom.RoomState != eRoomState.FREE*/)
            {
                return false;
            }

            //if (player.PlayerCharacter.ID == player.CurrentHotSpringRoom.Info.GroomID || player.PlayerCharacter.ID == player.CurrentHotSpringRoom.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, "", "", "");
                }
                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.CurrentHotSpringRoom.Info.BrideName;
                    mail1.ReceiverID = player.CurrentHotSpringRoom.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.CurrentHotSpringRoom.Info.GroomName;
                    mail2.ReceiverID = player.CurrentHotSpringRoom.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.CurrentHotSpringRoom.SendToPlayerExceptSelf(msg,player);

                return true;
            }
      
            return false;
        }
Ejemplo n.º 6
0
        public bool HandleCommand(TankHotSpringLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            if (player.CurrentHotSpringRoom == null)
            {
                return false;
            }
            if ((player.PlayerCharacter.ID != player.CurrentHotSpringRoom.Info.GroomID) && (player.PlayerCharacter.ID != player.CurrentHotSpringRoom.Info.playerID))
            {
                return false;
            }
            int time = packet.ReadInt();
            string[] strArray = GameProperties.PRICE_MARRY_ROOM.Split(new char[] { ',' });
            if (strArray.Length < 3)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("HotSpringRoomCreateMoney node in configuration file is wrong");
                }
                return false;
            }
            int num2 = 0;
            switch (time)
            {
                case 2:
                    num2 = int.Parse(strArray[0]);
                    break;

                case 3:
                    num2 = int.Parse(strArray[1]);
                    break;

                case 4:
                    num2 = int.Parse(strArray[2]);
                    break;

                default:
                    num2 = int.Parse(strArray[2]);
                    time = 4;
                    break;
            }
            if (player.PlayerCharacter.Money < num2)
            {
                player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg1", new object[0]));
                return false;
            }
            player.RemoveMoney(num2);
            //LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_RoomAdd, player.PlayerCharacter.ID, num2, player.PlayerCharacter.Money, 0, 0, 0, "", "", "");
            CountBussiness.InsertSystemPayCount(player.PlayerCharacter.ID, num2, 0, 0, 6);
            player.CurrentHotSpringRoom.RoomContinuation(time);
            GSPacketIn pkg = player.Out.SendContinuation(player, player.CurrentHotSpringRoom.Info);
            int playerId = 0;
            if (player.PlayerCharacter.ID == player.CurrentHotSpringRoom.Info.GroomID)
            {
                playerId = player.CurrentHotSpringRoom.Info.playerID;
            }
            else
            {
                playerId = player.CurrentHotSpringRoom.Info.GroomID;
            }
            GamePlayer playerById = WorldMgr.GetPlayerById(playerId);
            if (playerById != null)
            {
                playerById.Out.SendTCP(pkg);
            }
            player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ContinuationCommand.Successed"));
            return true;
        }