当前位置: 首页>>代码示例>>C#>>正文


C# GamePlayer.RemoveMoney方法代码示例

本文整理汇总了C#中Game.Server.GameObjects.GamePlayer.RemoveMoney方法的典型用法代码示例。如果您正苦于以下问题:C# GamePlayer.RemoveMoney方法的具体用法?C# GamePlayer.RemoveMoney怎么用?C# GamePlayer.RemoveMoney使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Game.Server.GameObjects.GamePlayer的用法示例。


在下文中一共展示了GamePlayer.RemoveMoney方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleCommand

 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;
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:57,代码来源:LargessCommand.cs

示例2: HandleCommand

        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;
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:47,代码来源:UserFirecrackersCommand.cs

示例3: HandleCommand

        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;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:76,代码来源:ContinuationCommand.cs

示例4: HandleCommand


//.........这里部分代码省略.........
                        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;
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:101,代码来源:HymenealCommand.cs

示例5: HandleCommand

        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;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:76,代码来源:LargessCommand.cs

示例6: HandleCommand

        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;
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:67,代码来源:ContinuationCommand.cs


注:本文中的Game.Server.GameObjects.GamePlayer.RemoveMoney方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。