public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.CurrentMarryRoom != null && client.Player.PlayerCharacter.ID == client.Player.CurrentMarryRoom.Info.PlayerID)
            {
                string roomName = packet.ReadString();

                bool isPwdChanged = packet.ReadBoolean();

                string pwd = packet.ReadString();
                
                string introduction = packet.ReadString();

                MarryRoom room = client.Player.CurrentMarryRoom;

                room.Info.RoomIntroduction = introduction;
                room.Info.Name = roomName;
                if (isPwdChanged)
                {
                    room.Info.Pwd = pwd;
                }
                

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

                room.SendMarryRoomInfoUpdateToScenePlayers(room);

                client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("MarryRoomInfoUpdateHandler.Successed"));
                return 0;
            }

            return 1;
        }
Beispiel #2
0
 public void RoomContinuation(int time)
 {
     TimeSpan timeLeft = DateTime.Now - Info.BeginTime;
     int newTime = Info.AvailTime * 60 - timeLeft.Minutes + time * 60;
     Info.AvailTime += time;
     //更新数据库
     using(PlayerBussiness db = new PlayerBussiness())
     {
         db.UpdateMarryRoomInfo(Info);
     }
     BeginTimer(60 * 1000 * newTime);
 }
        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;
        }
        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;
        }