コード例 #1
0
        //修改:  Xiaov
        //时间:  2009-11-7
        //描述:  获取用户装备<已测试>
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            bool type = packet.ReadBoolean();//_loc_3.writeBoolean(true);
            int id = packet.ReadInt();
            string nickname;
            if (!type)
                nickname = packet.ReadString();
            GamePlayer player = Managers.WorldMgr.GetPlayerById(id);
            PlayerInfo info;
            List<ItemInfo> items;
            if (player != null)
            {
                info = player.PlayerCharacter;
                items = player.MainBag.GetItems(0, 31);
            }
            else
            {
                using (PlayerBussiness pb = new PlayerBussiness())
                {
                    info = pb.GetUserSingleByUserID(id);
                    items = pb.GetUserEuqip(id);
                }
            }

            if (info != null && items != null)
                client.Out.SendUserEquip(info, items);
            return 0;
        }
コード例 #2
0
ファイル: csFunction.cs プロジェクト: vancourt/BaseGunnyII
        public static string BuildCelebConsortia(string file, int order, string fileNotCompress)
        {
            bool value = false;
            string message = "Fail!";
            XElement result = new XElement("Result");
            int total = 0;

            try
            {
                int page = 1;
                int size = 50;
                //int order = 10;
                int consortiaID = -1;
                string name = "";
                int level = -1;

                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaInfo[] infos = db.GetConsortiaPage(page, size, ref total, order, name, consortiaID, level,-1);
                    foreach (ConsortiaInfo info in infos)
                    {
                        XElement node = FlashUtils.CreateConsortiaInfo(info);

                        if (info.ChairmanID != 0)
                        {
                            using (PlayerBussiness pb = new PlayerBussiness())
                            {
                                PlayerInfo player = pb.GetUserSingleByUserID(info.ChairmanID);
                                if (player != null)
                                {
                                    node.Add(FlashUtils.CreateCelebInfo(player));
                                }
                            }
                        }
                        result.Add(node);
                    }

                    value = true;
                    message = "Success!";
                }
            }
            catch (Exception ex)
            {
                log.Error(file + " is fail!", ex);
            }

            result.Add(new XAttribute("total", total));
            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));
            result.Add(new XAttribute("date", System.DateTime.Today.ToString("yyyy-MM-dd")));

            if (!string.IsNullOrEmpty(fileNotCompress))
            {
                csFunction.CreateCompressXml(result, fileNotCompress, false);
            }

            return csFunction.CreateCompressXml(result, file, true);
        }
コード例 #3
0
ファイル: TestDB.cs プロジェクト: geniushuai/DDTank-3.0
        public void TestMethod2()
        {
            PlayerBussiness pb = new PlayerBussiness();

            for (int i = 2000; i < 3000; i++)
            {
                PlayerInfo info = pb.GetUserSingleByUserID(i);
                Assert.IsNotNull(info);
            }
        }
コード例 #4
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            bool result = packet.ReadBoolean();
            int UserID = packet.ReadInt();
            int AnswerId = packet.ReadInt();   //答复对话框ID
            //先判断自已有没有结婚
            if (result && client.Player.PlayerCharacter.IsMarried)
            {
                client.Player.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("MarryApplyReplyHandler.Msg2"));                
            }

            using (PlayerBussiness db = new PlayerBussiness())
            {
                PlayerInfo tempSpouse = db.GetUserSingleByUserID(UserID);
                //发送好人卡
                if (!result)
                {
                    SendGoodManCard(tempSpouse.NickName, tempSpouse.ID, client.Player.PlayerCharacter.NickName, client.Player.PlayerCharacter.ID, db);
                    GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(tempSpouse.ID);                    
                }

                //判断对方有没有结婚                
                if (tempSpouse == null || tempSpouse.Sex == client.Player.PlayerCharacter.Sex)
                {
                    return 1;
                }
                if (tempSpouse.IsMarried)
                {
                    client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyReplyHandler.Msg3"));
                }

                MarryApplyInfo info = new MarryApplyInfo();
                info.UserID = UserID;
                info.ApplyUserID = client.Player.PlayerCharacter.ID;
                info.ApplyUserName = client.Player.PlayerCharacter.NickName;
                info.ApplyType = 2;
                info.LoveProclamation = "";
                info.ApplyResult = result;
                int id = 0;
                if (db.SavePlayerMarryNotice(info, AnswerId, ref id))
                {
                    if (result)
                    {                        
                        client.Player.Out.SendMarryApplyReply(client.Player, tempSpouse.ID, tempSpouse.NickName, result, false, id);
                        client.Player.LoadMarryProp();
                        SendSYSMessages(client.Player, tempSpouse);
                    }
                    GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(tempSpouse.ID);
                    return 0;
                }
            }
            return 1;
        }
コード例 #5
0
ファイル: PetHandler.cs プロジェクト: vancourt/BaseGunnyII
        protected void HandleUPDATE_PET(GameClient client, int ID)
        {
            GamePlayer player = Managers.WorldMgr.GetPlayerById(ID);
            PlayerInfo info;
            List<ItemInfo> items;
            if (player != null)
            {
                info = player.PlayerCharacter;
                items = player.CardBag.GetItems(0, 6);
            }
            else
            {
                using (PlayerBussiness pb = new PlayerBussiness())
                {
                    info = pb.GetUserSingleByUserID(ID);
                    items = pb.GetUserCardEuqip(ID);
                }
            }

            if (info != null && items != null)
                client.Out.SendUpdatePetInfo(info, items);
        }
コード例 #6
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int UserID = packet.ReadInt();

            GamePlayer Spouse = WorldMgr.GetPlayerById(UserID);

            if (Spouse != null)
            {
                client.Player.Out.SendPlayerMarryStatus(client.Player, Spouse.PlayerCharacter.ID, Spouse.PlayerCharacter.IsMarried);
            }
            else
            { 
                using (PlayerBussiness db = new PlayerBussiness())
                {                                                                                   
                    PlayerInfo tempSpouse = db.GetUserSingleByUserID(UserID);
                    client.Player.Out.SendPlayerMarryStatus(client.Player, tempSpouse.ID, tempSpouse.IsMarried);
                }

            }

            return 0;
        }
コード例 #7
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int user_id = packet.ReadInt();
            GamePlayer player = Managers.WorldMgr.GetPlayerById(user_id);
            PlayerInfo info;
            List<ItemInfo> items;
            if (player != null)
            {
                info = player.PlayerCharacter;
                items = player.CardBag.GetItems(0, 6);
            }
            else
            {
                using (PlayerBussiness pb = new PlayerBussiness())
                {
                    info = pb.GetUserSingleByUserID(user_id);
                    items = pb.GetUserCardEuqip(user_id);
                }
            }

            if (info != null && items != null)
            client.Out.SendPlayerCardInfo(info, items);
            return 0;
        }
コード例 #8
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (!client.Player.PlayerCharacter.IsMarried)
            {
                return 1;
            }

            if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked)
            {

                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked"));
                return 0;
            }

            if(client.Player.PlayerCharacter.IsCreatedMarryRoom)
            {
                client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("DivorceApplyHandler.Msg2"));
                return 1;

            }

            int needMoney = GameProperties.PRICE_DIVORCED;
            if (client.Player.PlayerCharacter.Money < needMoney)
            {
                client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("DivorceApplyHandler.Msg1"));
                return 1;
            }
            else
            {
                client.Player.RemoveMoney(needMoney);
                LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Unmarry, client.Player.PlayerCharacter.ID, needMoney, client.Player.PlayerCharacter.Money, 0, 0, 0,0, "", "", "");
                CountBussiness.InsertSystemPayCount(client.Player.PlayerCharacter.ID, needMoney, 0, (int)eConsumerType.Marry, (int)eSubConsumerType.Marry_Divorce);

                using (PlayerBussiness db = new PlayerBussiness())
                {
                    PlayerInfo tempSpouse = db.GetUserSingleByUserID(client.Player.PlayerCharacter.SpouseID);
                    if (tempSpouse == null || tempSpouse.Sex == client.Player.PlayerCharacter.Sex)
                    {
                        return 1;
                    }

                    MarryApplyInfo info = new MarryApplyInfo();
                    info.UserID = client.Player.PlayerCharacter.SpouseID;
                    info.ApplyUserID = client.Player.PlayerCharacter.ID;
                    info.ApplyUserName = client.Player.PlayerCharacter.NickName;
                    info.ApplyType = 3;
                    info.LoveProclamation = "";
                    info.ApplyResult = false;
                    int id = 0;
                    if (db.SavePlayerMarryNotice(info,0, ref id))
                    {
                        GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(tempSpouse.ID);
                        client.Player.LoadMarryProp();
                    }
                }

                client.Player.QuestInventory.ClearMarryQuest(); //离婚后清除结婚后任务.
                client.Player.Out.SendPlayerDivorceApply(client.Player, true,true);
                client.Player.SendMessage(LanguageMgr.GetTranslation("DivorceApplyHandler.Msg3"));
            }

            return 0;
        }
コード例 #9
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            //判断是否结婚
            if(client.Player.PlayerCharacter.IsMarried)  
            {
                return 1;
            }
            //是否有二级密码
            if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked)
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked"));
                return 1;
            }
            //开始求婚,购买戒指
            int SpouseID = packet.ReadInt();
            string loveProclamation = packet.ReadString();
            bool Broadcast = packet.ReadBoolean();
            bool result = false;
            bool removeRing = true;
            string SpouseName = "";
            using (PlayerBussiness db = new PlayerBussiness())
            {
                PlayerInfo tempSpouse = db.GetUserSingleByUserID(SpouseID);
                if (tempSpouse == null || tempSpouse.Sex == client.Player.PlayerCharacter.Sex)
                {
                    return 1;
                }
                if (tempSpouse.IsMarried)
                {
                    client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg2"));
                    return 1;
                }
                ItemInfo WeddingRing = client.Player.PropBag.GetItemByTemplateID(0,11103);
                if (WeddingRing == null)
                {                    
                    ShopItemInfo tempRing = ShopMgr.FindShopbyTemplatID(11103).FirstOrDefault();
                    if (tempRing != null)
                    {
                        //玩家身上钱是否足够。
                        if (client.Player.PlayerCharacter.Money >= tempRing.AValue1)
                        {
                            removeRing = false;
                        }
                        else
                        {
                            client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg1"));
                            return 1;
                        }
                    }
                    else
                    {
                        client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg6"));
                        return 1;
                    }
                }
                //插入结婚消息
                MarryApplyInfo info = new MarryApplyInfo();
                info.UserID = SpouseID;
                info.ApplyUserID = client.Player.PlayerCharacter.ID;
                info.ApplyUserName = client.Player.PlayerCharacter.NickName;
                info.ApplyType = 1;
                info.LoveProclamation = loveProclamation;
                info.ApplyResult = false;
                int id=0;
                if (db.SavePlayerMarryNotice(info,0,ref id))
                {
                    if (removeRing)
                    {
                        client.Player.RemoveItem(WeddingRing);
                    }
                    else
                    {
                        //未开始                        
                        ShopItemInfo tempRing = ShopMgr.FindShopbyTemplatID(11103).FirstOrDefault();
                        client.Player.RemoveMoney(tempRing.AValue1);
                        LogMgr.LogMoneyAdd(LogMoneyType.Marry, LogMoneyType.Marry_Spark, client.Player.PlayerCharacter.ID, tempRing.AValue1, client.Player.PlayerCharacter.Money, 0, 0, 0, "", tempRing.TemplateID.ToString(), "1");
                    }
                    client.Player.Out.SendPlayerMarryApply(client.Player, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, loveProclamation,id);  //发送求婚信息
                    //发送消息给中心服务器
                    GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(SpouseID);
                    SpouseName = tempSpouse.NickName;
                    result = true;

                    client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryApplyHandler.Msg3"));
                }

            }
            if (result && Broadcast && SpouseName != "")
            {
                string msg = LanguageMgr.GetTranslation("MarryApplyHandler.Msg5", client.Player.PlayerCharacter.NickName, SpouseName);
                GSPacketIn pkg = new GSPacketIn((byte)ePackageType.SYS_NOTICE);
                pkg.WriteInt(2);
                pkg.WriteString(msg);
                GameServer.Instance.LoginServer.SendPacket(pkg);
                GamePlayer[] players = WorldMgr.GetAllPlayers();
                foreach (GamePlayer p in players)
                {
                    p.Out.SendTCP(pkg);
                }
            }           
            return 0;
        }
コード例 #10
0
        public void ProcessRequest(HttpContext context)
        {
            bool value = false;
            string message = "Fail!";

            XElement result = new XElement("Result");
            try
            {
               // int userid = int.Parse(context.Request.Params["ID"]);
                int userid = int.Parse(context.Request["ID"]);
                using (PlayerBussiness pb = new PlayerBussiness())
                {
                    PlayerInfo info = pb.GetUserSingleByUserID(userid);
                    result.Add(new XAttribute("Agility", info.Agility),
                        new XAttribute("Attack", info.Attack),
                        new XAttribute("Colors", info.Colors),
                        new XAttribute("Skin", info.Skin),
                        new XAttribute("Defence", info.Defence),
                        new XAttribute("GP", info.GP),
                        new XAttribute("Grade", info.Grade),
                        new XAttribute("Luck", info.Luck),
                        new XAttribute("Hide", info.Hide),
                        new XAttribute("Repute", info.Repute),
                        new XAttribute("Offer", info.Offer),
                        new XAttribute("NickName", info.NickName),
                        new XAttribute("ConsortiaName", info.ConsortiaName),
                        new XAttribute("ConsortiaID", info.ConsortiaID),
                        new XAttribute("ReputeOffer", info.ReputeOffer),
                        new XAttribute("ConsortiaHonor", info.ConsortiaHonor),
                        new XAttribute("ConsortiaLevel", info.ConsortiaLevel),
                        new XAttribute("ConsortiaRepute", info.ConsortiaRepute),
                        new XAttribute("WinCount", info.Win),
                        new XAttribute("TotalCount", info.Total),
                        new XAttribute("EscapeCount", info.Escape),
                        new XAttribute("Sex", info.Sex),
                        new XAttribute("Style", info.Style),
                        new XAttribute("FightPower",info.FightPower));




                    ItemInfo[] items = pb.GetUserEuqip(userid).ToArray();
                    foreach (ItemInfo g in items)
                    {
                        result.Add(Road.Flash.FlashUtils.CreateGoodsInfo(g));
                    }

                    //XElement item = new XElement("Item");
                    //ItemInfo[] items = pb.GetUserEuqip(userid);
                    //foreach (ItemInfo g in items)
                    //{
                    //    item.Add(Road.Flash.FlashUtils.CreateGoodsInfo(g));
                    //}

                    //XElement buff = new XElement("Buff");
                    //BuffInfo[] buffs = pb.GetUserBuff(userid);
                    //foreach (BuffInfo b in buffs)
                    //{
                    //    if (!b.IsValid())
                    //        continue;
                    //    buff.Add(Road.Flash.FlashUtils.CreateBuffInfo(b));
                    //}

                   // result.Add(item);
                    //result.Add(buff);
                }


                value = true;
                message = "Success!";

            }
            catch(Exception ex)
            {
                log.Error("LoadUserEquip", ex);
            }

            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));

            context.Response.ContentType = "text/plain";
            context.Response.Write(result.ToString(false));
        }
コード例 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int result = 1;
            try
            {
                string IP = Context.Request.UserHostAddress;
                if (ValidLoginIP(IP))
                {
                    string content = HttpUtility.UrlDecode(Request["content"]);
                    string site = Request["site"] == null ? "" : HttpUtility.UrlDecode(Request["site"]).ToLower();
                    string nickname = Request["nickname"] == null ? "" : HttpUtility.UrlDecode(Request["nickname"]);

                    BaseInterface inter = BaseInterface.CreateInterface();
                    string[] str = inter.UnEncryptCharge(content, ref result, site);
                    if (str.Length > 5)
                    {
                        string chargeID = str[0];
                        string userName = str[1].Trim();
                        int money = int.Parse(str[2]);
                        string payWay = str[3];
                        decimal needMoney = decimal.Parse(str[4]);

                        if (!string.IsNullOrEmpty(userName))
                        {
                            userName= BaseInterface.GetNameBySite(userName, site);
                            if (money > 0)
                            {
                                using (PlayerBussiness db = new PlayerBussiness())
                                {
                                    int userID;
                                    DateTime date = DateTime.Now;
                                    if (db.AddChargeMoney(chargeID, userName, money, payWay, needMoney, out userID, ref result, date, IP, nickname))
                                    {
                                        result = 0;
                                        using (CenterServiceClient temp = new CenterServiceClient())
                                        {
                                            temp.ChargeMoney(userID, chargeID);
                                            using (PlayerBussiness pb = new PlayerBussiness())
                                            {
                                                PlayerInfo player = pb.GetUserSingleByUserID(userID);
                                                if (player != null)
                                                    StaticsMgr.Log(date, userName, player.Sex, money, payWay,needMoney);
                                                else
                                                {
                                                    StaticsMgr.Log(date, userName, true, money, payWay, needMoney);
                                                    log.Error("ChargeMoney_StaticsMgr:Player is null!");
                                                }
                                            }

                                        }
                                    }
                                }
                            }
                            else
                            {
                                result = 3;
                            }
                        }
                        else
                        {
                            result = 2;
                        }
                    }
                }
                else
                {
                    result = 5;
                }
            }
            catch (Exception ex)
            {
                log.Error("ChargeMoney:", ex);
            }
            Response.Write(result);
        }
コード例 #12
0
ファイル: GamePlayer.cs プロジェクト: vancourt/BaseGunnyII
 public bool LoadFromDatabase()
 {
     using (PlayerBussiness db = new PlayerBussiness())
     {
         PlayerInfo detail = db.GetUserSingleByUserID(m_character.ID);
         if (detail == null)
         {
             Out.SendKitoff(LanguageMgr.GetTranslation("UserLoginHandler.Forbid"));
             Client.Disconnect();
             return false;
         }
         else
         {
             m_character = detail;
         }
         ChargeToUser();
         int[] sole = new int[] { 0, 1, 2 };
         Out.SendUpdateInventorySlot(FightBag, sole);
         UpdateItemForUser(1);
         UpdateVIPForUser();
         //AddGP(0);
         UpdateWeapon(m_mainBag.GetItemAt(6));
         UpdateSecondWeapon(m_mainBag.GetItemAt(15));
         m_pvepermissions = string.IsNullOrEmpty(detail.PvePermission) ? InitPvePermission() : m_converter.GetBytes(detail.PvePermission);
         _friends = new Dictionary<int, int>();
         _friends = db.GetFriendsIDAll(m_character.ID);
         m_character.State = 1;
         db.UpdatePlayer(m_character);
         //  db.UpdateVIPInfo(m_character);
         return true;
     }
 }