Пример #1
0
        /// <summary>
        /// 拆分物品
        /// </summary>
        /// <param name="item"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public bool SplitItem(ItemInfo item, int count, int toSlot)
        {
            if (_bagType == 11)
            {
                ConsortiaInfo info = ConsortiaMgr.FindConsortiaInfo(_player.PlayerCharacter.ConsortiaID);
                if (info != null || toSlot >= info.StoreLevel * 10)
                {
                    _player.Out.SendUpdateInventorySlot(item.Place, true, item, _bagType);
                    return(false);
                }
            }

            if (item.Count > count && m_items[toSlot] == null)
            {
                ItemInfo clone = item.Clone();
                clone.ItemID = -1;
                clone.Count  = count;
                if (AddItemTo(clone, toSlot) != -1)
                {
                    item.Count -= count;
                    _player.Out.SendUpdateInventorySlot(item.Place, true, item, _bagType);
                    _player.Out.SendUpdateInventorySlot(clone.Place, true, clone, _bagType);
                    return(true);
                }
            }
            else
            {
                _player.Out.SendUpdateInventorySlot(item.Place, true, item, _bagType);
            }

            return(false);
        }
Пример #2
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result;

            if (player.PlayerCharacter.ConsortiaID == 0)
            {
                result = 1;
            }
            else
            {
                int bagType    = (int)packet.ReadByte();
                int bagPlace   = packet.ReadInt();
                int storePlace = packet.ReadInt();
                if (bagType == 0 && bagPlace < 31)
                {
                    result = 1;
                }
                else
                {
                    ConsortiaInfo info = ConsortiaMgr.FindConsortiaInfo(player.PlayerCharacter.ConsortiaID);
                    if (info != null)
                    {
                        PlayerInventory storeBag = player.StoreBag;
                        PlayerInventory toBag    = player.GetInventory((eBageType)bagType);
                    }
                    result = 0;
                }
            }
            return(result);
        }
Пример #3
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
            {
                return(0);
            }


            bool   result = false;
            string msg    = "ConsortiaShopUpGradeHandler.Failed";
            //using (ConsortiaBussiness db = new ConsortiaBussiness())
            //{
            //    ConsortiaInfo info = db.GetConsortiaSingle(client.Player.PlayerCharacter.ConsortiaID);
            ConsortiaInfo info = Managers.ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);

            if (info == null)
            {
                msg = "ConsortiaShopUpGradeHandler.NoConsortia";
            }
            else
            {
                using (ConsortiaBussiness cb = new ConsortiaBussiness())
                {
                    if (cb.UpGradeShopConsortia(client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, ref msg))
                    {
                        info.ShopLevel++;
                        GameServer.Instance.LoginServer.SendConsortiaShopUpGrade(info);
                        msg    = "ConsortiaShopUpGradeHandler.Success";
                        result = true;
                    }
                }
            }
            if (info.ShopLevel >= 2)
            {
                string msg1 = LanguageMgr.GetTranslation("ConsortiaShopUpGradeHandler.Notice", client.Player.PlayerCharacter.ConsortiaName, info.ShopLevel);

                GSPacketIn pkg = new GSPacketIn((byte)ePackageType.SYS_NOTICE);
                pkg.WriteInt(2);
                pkg.WriteString(msg1);

                GameServer.Instance.LoginServer.SendPacket(pkg);

                GamePlayer[] players = Game.Server.Managers.WorldMgr.GetAllPlayers();

                foreach (GamePlayer p in players)
                {
                    if (p != client.Player)
                    {
                        p.Out.SendTCP(pkg);
                    }
                }
            }
            //}


            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);
            return(1);
        }
Пример #4
0
        public static bool ConsortiaUpGrade(int consortiaID, int consortiaLevel)
        {
            bool result = false;

            ConsortiaMgr.m_lock.AcquireWriterLock(-1);
            try
            {
                if (ConsortiaMgr._consortia.ContainsKey(consortiaID) && ConsortiaMgr._consortia[consortiaID].IsExist)
                {
                    ConsortiaMgr._consortia[consortiaID].Level = consortiaLevel;
                }
                else
                {
                    ConsortiaInfo info = new ConsortiaInfo();
                    info.BuildDate = DateTime.Now;
                    info.Level     = consortiaLevel;
                    info.IsExist   = true;
                    ConsortiaMgr._consortia.Add(consortiaID, info);
                }
            }
            catch (Exception ex)
            {
                ConsortiaMgr.log.Error("ConsortiaUpGrade", ex);
            }
            finally
            {
                ConsortiaMgr.m_lock.ReleaseWriterLock();
            }
            return(result);
        }
Пример #5
0
        public static bool AddConsortia(int consortiaID, string chairmanName)
        {
            bool result = false;

            ConsortiaMgr.m_lock.AcquireWriterLock(-1);
            try
            {
                if (!ConsortiaMgr._consortia.ContainsKey(consortiaID))
                {
                    ConsortiaInfo info = new ConsortiaInfo();
                    info.BuildDate    = DateTime.Now;
                    info.Level        = 1;
                    info.IsExist      = true;
                    info.ChairmanName = chairmanName;
                    info.ConsortiaID  = consortiaID;
                    ConsortiaMgr._consortia.Add(consortiaID, info);
                }
            }
            catch (Exception ex)
            {
                ConsortiaMgr.log.Error("ConsortiaUpGrade", ex);
            }
            finally
            {
                ConsortiaMgr.m_lock.ReleaseWriterLock();
            }
            return(result);
        }
Пример #6
0
        public static bool AddConsortia(int consortiaID)
        {
            bool result = false;

            ConsortiaMgr.m_lock.AcquireWriterLock(15000);
            try
            {
                if (!ConsortiaMgr._consortia.ContainsKey(consortiaID))
                {
                    ConsortiaInfo consortiaInfo = new ConsortiaInfo();
                    consortiaInfo.BuildDate     = DateTime.Now;
                    consortiaInfo.Level         = 1;
                    consortiaInfo.IsExist       = true;
                    consortiaInfo.ConsortiaName = "";
                    consortiaInfo.ConsortiaID   = consortiaID;
                    ConsortiaMgr._consortia.Add(consortiaID, consortiaInfo);
                }
            }
            catch (Exception exception)
            {
                ConsortiaMgr.log.Error("ConsortiaUpGrade", exception);
            }
            finally
            {
                ConsortiaMgr.m_lock.ReleaseWriterLock();
            }
            return(result);
        }
Пример #7
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            //TODO: 储存物品
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
            {
                return(1);
            }

            int bagType    = packet.ReadByte();
            int bagPlace   = packet.ReadInt();
            int storePlace = packet.ReadInt();

            if (bagType == 0 && bagPlace < 31)
            {
                return(1);
            }

            ConsortiaInfo info = ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);

            if (info != null)
            {
                PlayerInventory storeBag = client.Player.StoreBag;
                PlayerInventory toBag    = client.Player.GetInventory((eBageType)bagType);
                // client.Player.StoreBag.MoveToStore(storeBag, storePlace, bagPlace, toBag, info.StoreLevel * 10);
            }

            return(0);
        }
Пример #8
0
 public static XElement CreateConsortiaInfo(ConsortiaInfo info)
 {
     return(new XElement("Item", new object[]
     {
         new XAttribute("ConsortiaID", info.ConsortiaID),
         new XAttribute("BuildDate", info.BuildDate.ToString("yyyy-MM-dd HH:mm:ss")),
         new XAttribute("CelebCount", info.CelebCount),
         new XAttribute("ChairmanID", info.ChairmanID),
         new XAttribute("ChairmanName", (info.ChairmanName == null) ? "" : info.ChairmanName),
         new XAttribute("ConsortiaName", (info.ConsortiaName == null) ? "" : info.ConsortiaName),
         new XAttribute("CreatorID", info.CreatorID),
         new XAttribute("CreatorName", (info.CreatorName == null) ? "" : info.CreatorName),
         new XAttribute("Description", (info.Description == null) ? "" : info.Description),
         new XAttribute("Honor", info.Honor),
         new XAttribute("IP", info.IP),
         new XAttribute("Level", info.Level),
         new XAttribute("MaxCount", info.MaxCount),
         new XAttribute("Placard", (info.Placard == null) ? "" : info.Placard),
         new XAttribute("Repute", info.Repute),
         new XAttribute("Count", info.Count),
         new XAttribute("Riches", info.Riches),
         new XAttribute("FightPower", info.FightPower),
         new XAttribute("DeductDate", info.DeductDate.ToString("yyyy-MM-dd HH:mm:ss")),
         new XAttribute("AddDayHonor", info.AddDayHonor),
         new XAttribute("AddDayRiches", info.AddDayRiches),
         new XAttribute("AddWeekHonor", info.AddWeekHonor),
         new XAttribute("AddWeekRiches", info.AddWeekRiches),
         new XAttribute("LastDayRiches", info.LastDayRiches),
         new XAttribute("OpenApply", info.OpenApply),
         new XAttribute("StoreLevel", info.StoreLevel),
         new XAttribute("SmithLevel", info.SmithLevel),
         new XAttribute("ShopLevel", info.ShopLevel),
         new XAttribute("Port", info.Port)
     }));
 }
Пример #9
0
        public static bool AddConsortia(int consortiaID)
        {
            bool result = false;

            m_lock.AcquireWriterLock(Timeout.Infinite);
            try
            {
                if (!_consortia.ContainsKey(consortiaID))
                {
                    ConsortiaInfo info = new ConsortiaInfo();
                    info.BuildDate     = DateTime.Now;
                    info.Level         = 1;
                    info.IsExist       = true;
                    info.ConsortiaName = "";
                    info.ConsortiaID   = consortiaID;
                    _consortia.Add(consortiaID, info);
                }
            }
            catch (Exception ex)
            {
                log.Error("ConsortiaUpGrade", ex);
            }
            finally
            {
                m_lock.ReleaseWriterLock();
            }

            return(result);
        }
Пример #10
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result2;

            if (player.PlayerCharacter.ConsortiaID == 0)
            {
                result2 = 0;
            }
            else
            {
                bool          result = false;
                string        msg    = "ConsortiaSmithUpGradeHandler.Failed";
                ConsortiaInfo info   = ConsortiaMgr.FindConsortiaInfo(player.PlayerCharacter.ConsortiaID);
                if (info == null)
                {
                    msg = "ConsortiaSmithUpGradeHandler.NoConsortia";
                }
                else
                {
                    using (ConsortiaBussiness cb = new ConsortiaBussiness())
                    {
                        if (cb.UpGradeSmithConsortia(player.PlayerCharacter.ConsortiaID, player.PlayerCharacter.ID, ref msg))
                        {
                            info.SmithLevel++;
                            GameServer.Instance.LoginServer.SendConsortiaSmithUpGrade(info);
                            msg    = "ConsortiaSmithUpGradeHandler.Success";
                            result = true;
                        }
                    }
                }
                if (info.SmithLevel >= 3 && info.Level <= 10)
                {
                    string msg2 = LanguageMgr.GetTranslation("ConsortiaSmithUpGradeHandler.Notice", new object[]
                    {
                        player.PlayerCharacter.ConsortiaName,
                        info.SmithLevel
                    });
                    GSPacketIn pkg = new GSPacketIn(10);
                    pkg.WriteInt(2);
                    pkg.WriteString(msg2);
                    GameServer.Instance.LoginServer.SendPacket(pkg);
                    GamePlayer[] players = WorldMgr.GetAllPlayers();
                    GamePlayer[] array   = players;
                    for (int i = 0; i < array.Length; i++)
                    {
                        GamePlayer p = array[i];
                        if (p != player)
                        {
                            p.Out.SendTCP(pkg);
                        }
                    }
                }
                packet.WriteBoolean(result);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                player.Out.SendTCP(packet);
                result2 = 1;
            }
            return(result2);
        }
Пример #11
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result2;

            if (player.PlayerCharacter.ConsortiaID != 0)
            {
                result2 = 0;
            }
            else
            {
                int    id            = packet.ReadInt();
                bool   result        = false;
                int    consortiaID   = 0;
                string consortiaName = "";
                string msg           = "ConsortiaInvitePassHandler.Failed";
                int    tempID        = 0;
                string tempName      = "";
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    int consortiaRepute    = 0;
                    ConsortiaUserInfo info = new ConsortiaUserInfo();
                    if (db.PassConsortiaInviteUsers(id, player.PlayerCharacter.ID, player.PlayerCharacter.NickName, ref consortiaID, ref consortiaName, ref msg, info, ref tempID, ref tempName, ref consortiaRepute))
                    {
                        player.PlayerCharacter.ConsortiaID   = consortiaID;
                        player.PlayerCharacter.ConsortiaName = consortiaName;
                        player.PlayerCharacter.DutyLevel     = info.Level;
                        player.PlayerCharacter.DutyName      = info.DutyName;
                        player.PlayerCharacter.Right         = info.Right;
                        ConsortiaInfo consotia = ConsortiaMgr.FindConsortiaInfo(consortiaID);
                        if (consotia != null)
                        {
                            player.PlayerCharacter.ConsortiaLevel = consotia.Level;
                        }
                        msg                = "ConsortiaInvitePassHandler.Success";
                        result             = true;
                        info.UserID        = player.PlayerCharacter.ID;
                        info.UserName      = player.PlayerCharacter.NickName;
                        info.Grade         = player.PlayerCharacter.Grade;
                        info.Offer         = player.PlayerCharacter.Offer;
                        info.RichesOffer   = player.PlayerCharacter.RichesOffer;
                        info.RichesRob     = player.PlayerCharacter.RichesRob;
                        info.Win           = player.PlayerCharacter.Win;
                        info.Total         = player.PlayerCharacter.Total;
                        info.Escape        = player.PlayerCharacter.Escape;
                        info.ConsortiaID   = consortiaID;
                        info.ConsortiaName = consortiaName;
                        GameServer.Instance.LoginServer.SendConsortiaUserPass(tempID, tempName, info, true, consortiaRepute, player.PlayerCharacter.UserName, player.PlayerCharacter.FightPower, player.PlayerCharacter.AchievementPoint, player.PlayerCharacter.Honor);
                    }
                }
                packet.WriteBoolean(result);
                packet.WriteInt(consortiaID);
                packet.WriteString(consortiaName);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                player.Out.SendTCP(packet);
                result2 = 0;
            }
            return(result2);
        }
        public void HandleConsortiaUserPass(GSPacketIn packet)
        {
            packet.ReadInt();
            packet.ReadBoolean();
            int    num           = packet.ReadInt();
            string consortiaName = packet.ReadString();
            int    num2          = packet.ReadInt();

            packet.ReadString();
            packet.ReadInt();
            packet.ReadString();
            packet.ReadInt();
            string dutyName = packet.ReadString();

            packet.ReadInt();
            packet.ReadInt();
            packet.ReadInt();
            packet.ReadDateTime();
            packet.ReadInt();
            int dutyLevel = packet.ReadInt();

            packet.ReadInt();
            packet.ReadBoolean();
            int right = packet.ReadInt();

            packet.ReadInt();
            packet.ReadInt();
            packet.ReadInt();
            int consortiaRepute = packet.ReadInt();

            GamePlayer[] allPlayers = WorldMgr.GetAllPlayers();
            GamePlayer[] array      = allPlayers;
            for (int i = 0; i < array.Length; i++)
            {
                GamePlayer gamePlayer = array[i];
                if (gamePlayer.PlayerCharacter.ID == num2)
                {
                    gamePlayer.BeginChanges();
                    gamePlayer.PlayerCharacter.ConsortiaID     = num;
                    gamePlayer.PlayerCharacter.ConsortiaName   = consortiaName;
                    gamePlayer.PlayerCharacter.DutyName        = dutyName;
                    gamePlayer.PlayerCharacter.DutyLevel       = dutyLevel;
                    gamePlayer.PlayerCharacter.Right           = right;
                    gamePlayer.PlayerCharacter.ConsortiaRepute = consortiaRepute;
                    ConsortiaInfo consortiaInfo = ConsortiaMgr.FindConsortiaInfo(num);
                    if (consortiaInfo != null)
                    {
                        gamePlayer.PlayerCharacter.ConsortiaLevel = consortiaInfo.Level;
                    }
                    gamePlayer.CommitChanges();
                }
                if (gamePlayer.PlayerCharacter.ConsortiaID == num)
                {
                    gamePlayer.Out.SendTCP(packet);
                }
            }
        }
        public void SendConsortiaKillUpGrade(ConsortiaInfo info)
        {
            GSPacketIn gSPacketIn = new GSPacketIn(128);

            gSPacketIn.WriteByte(13);
            gSPacketIn.WriteInt(info.ConsortiaID);
            gSPacketIn.WriteString(info.ConsortiaName);
            gSPacketIn.WriteInt(info.SkillLevel);
            this.SendTCP(gSPacketIn);
        }
Пример #14
0
        public void SendConsortiaStoreUpGrade(ConsortiaInfo info)
        {
            GSPacketIn pkg = new GSPacketIn((byte)eChatServerPacket.CONSORTIA_RESPONSE);

            pkg.WriteByte(12);
            pkg.WriteInt(info.ConsortiaID);
            pkg.WriteString(info.ConsortiaName);
            pkg.WriteInt(info.StoreLevel);
            SendTCP(pkg);
        }
Пример #15
0
        public void SendConsortiaStoreUpGrade(ConsortiaInfo info)
        {
            GSPacketIn pkg = new GSPacketIn(128);

            pkg.WriteByte(12);
            pkg.WriteInt(info.ConsortiaID);
            pkg.WriteString(info.ConsortiaName);
            pkg.WriteInt(info.StoreLevel);
            this.SendTCP(pkg);
        }
Пример #16
0
        public void HandleConsortiaUserPass(GSPacketIn packet)
        {
            int      cid             = packet.ReadInt();
            bool     isInvite        = packet.ReadBoolean();
            int      consortiaID     = packet.ReadInt();
            string   consortiaName   = packet.ReadString();
            int      id              = packet.ReadInt();
            string   userName        = packet.ReadString();
            int      inviteUserID    = packet.ReadInt();
            string   inviteUserName  = packet.ReadString();
            int      dutyID          = packet.ReadInt();
            string   dutyName        = packet.ReadString();
            int      offer           = packet.ReadInt();
            int      richesOffer     = packet.ReadInt();
            int      richesRob       = packet.ReadInt();
            DateTime lastDate        = packet.ReadDateTime();
            int      grade           = packet.ReadInt();
            int      level           = packet.ReadInt();
            int      state           = packet.ReadInt();
            bool     sex             = packet.ReadBoolean();
            int      right           = packet.ReadInt();
            int      win             = packet.ReadInt();
            int      total           = packet.ReadInt();
            int      escape          = packet.ReadInt();
            int      consortiaRepute = packet.ReadInt();

            GamePlayer[] players = WorldMgr.GetAllPlayers();
            foreach (GamePlayer p in players)
            {
                if (p.PlayerCharacter.ID == id)
                {
                    p.BeginChanges();

                    p.PlayerCharacter.ConsortiaID     = consortiaID;
                    p.PlayerCharacter.ConsortiaName   = consortiaName;
                    p.PlayerCharacter.DutyName        = dutyName;
                    p.PlayerCharacter.DutyLevel       = level;
                    p.PlayerCharacter.Right           = right;
                    p.PlayerCharacter.ConsortiaRepute = consortiaRepute;
                    ConsortiaInfo consotia = ConsortiaMgr.FindConsortiaInfo(consortiaID);
                    if (consotia != null)
                    {
                        p.PlayerCharacter.ConsortiaLevel = consotia.Level;
                    }

                    p.CommitChanges();
                }

                if (p.PlayerCharacter.ConsortiaID == consortiaID)
                {
                    p.Out.SendTCP(packet);
                }
            }
        }
Пример #17
0
        private SqlDataProvider.Data.ItemInfo getitem(GameClient client, int type, string color, string skin, int id)
        {
            ConsortiaInfo info             = ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);
            ShopItemInfo  shopItemInfoById = ShopMgr.GetShopItemInfoById(id);
            bool          flag             = false;

            SqlDataProvider.Data.ItemInfo info3 = null;
            if (shopItemInfoById != null)
            {
                info3 = SqlDataProvider.Data.ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(shopItemInfoById.TemplateID), 1, 102);
                if (0 == shopItemInfoById.BuyType)
                {
                    if (1 == type)
                    {
                        info3.ValidDate = shopItemInfoById.AUnit;
                    }
                    if (2 == type)
                    {
                        info3.ValidDate = shopItemInfoById.BUnit;
                    }
                    if (3 == type)
                    {
                        info3.ValidDate = shopItemInfoById.CUnit;
                    }
                }
                else
                {
                    if (1 == type)
                    {
                        info3.Count = shopItemInfoById.AUnit;
                    }
                    if (2 == type)
                    {
                        info3.Count = shopItemInfoById.BUnit;
                    }
                    if (3 == type)
                    {
                        info3.Count = shopItemInfoById.CUnit;
                    }
                }
                if ((info3 != null) || (shopItemInfoById != null))
                {
                    info3.Color = (color == null) ? "" : color;
                    info3.Skin  = (skin == null) ? "" : skin;
                    if (flag)
                    {
                        info3.IsBinds = true;
                        return(info3);
                    }
                    info3.IsBinds = Convert.ToBoolean(shopItemInfoById.IsBind);
                }
            }
            return(info3);
        }
Пример #18
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int result;

            if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked)
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked", new object[0]));
                result = 0;
            }
            else
            {
                int           consortiaID = packet.ReadInt();
                ConsortiaInfo consortia   = ConsortiaMgr.FindConsortiaInfo(consortiaID);
                if (consortia.ChairmanName != client.Player.PlayerCharacter.NickName)
                {
                    result = 0;
                }
                else
                {
                    eBageType bagType         = (eBageType)packet.ReadByte();
                    int       place           = packet.ReadInt();
                    string    newConsotiaName = packet.ReadString();
                    string    message         = "";
                    ItemInfo  info            = client.Player.GetItemAt(bagType, place);
                    if (info != null)
                    {
                        if (info.TemplateID == 11993)
                        {
                            string userName = client.Player.PlayerCharacter.UserName;
                            string nickName = client.Player.PlayerCharacter.NickName;
                            using (PlayerBussiness db = new PlayerBussiness())
                            {
                                if (db.RenameConsortiaNameByCard(userName, nickName, newConsotiaName, ref message))
                                {
                                    client.Player.RemoveItem(info, eItemRemoveType.Use);
                                    packet.WriteString(LanguageMgr.GetTranslation("Tank.Request.RenameConsortiaName.Success", new object[0]));
                                    client.Out.SendTCP(packet);
                                }
                                else
                                {
                                    client.Out.SendMessage(eMessageType.Normal, message);
                                }
                            }
                        }
                    }
                    result = 0;
                }
            }
            return(result);
        }
Пример #19
0
        public static int CanConsortiaFight(int consortiaID1, int consortiaID2)
        {
            if (consortiaID1 == 0 || consortiaID2 == 0 || consortiaID1 == consortiaID2)
            {
                return(-1);
            }
            ConsortiaInfo consortiaInfo  = ConsortiaMgr.FindConsortiaInfo(consortiaID1);
            ConsortiaInfo consortiaInfo2 = ConsortiaMgr.FindConsortiaInfo(consortiaID2);

            if (consortiaInfo == null || consortiaInfo2 == null || consortiaInfo.Level < 3 || consortiaInfo2.Level < 3)
            {
                return(-1);
            }
            return(ConsortiaMgr.FindConsortiaAlly(consortiaID1, consortiaID2));
        }
Пример #20
0
 private static bool LoadConsortia(Dictionary <int, ConsortiaInfo> consortia)
 {
     using (ConsortiaBussiness consortiaBussiness = new ConsortiaBussiness())
     {
         ConsortiaInfo[] consortiaAll = consortiaBussiness.GetConsortiaAll();
         ConsortiaInfo[] array        = consortiaAll;
         for (int i = 0; i < array.Length; i++)
         {
             ConsortiaInfo consortiaInfo = array[i];
             if (consortiaInfo.IsExist && !consortia.ContainsKey(consortiaInfo.ConsortiaID))
             {
                 consortia.Add(consortiaInfo.ConsortiaID, consortiaInfo);
             }
         }
     }
     return(true);
 }
Пример #21
0
        public void ProcessRequest(HttpContext context)
        {
            bool   value   = false;
            string message = "Fail!";
            int    total   = 0;

            XElement result = new XElement("Result");

            try
            {
                int id = int.Parse(context.Request["id"]);

                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaInfo info = db.GetConsortiaSingle(id);
                    if (info != null)
                    {
                        result.Add(new XAttribute("Level", info.Level));
                        result.Add(new XAttribute("Repute", info.Repute));
                    }
                }

                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaUserInfo[] infos = db.GetConsortiaUsersPage(1, 1000, ref total, -1, id, -1, -1);
                    foreach (ConsortiaUserInfo info in infos)
                    {
                        result.Add(FlashUtils.CreateConsortiaIMInfo(info));
                    }

                    value   = true;
                    message = "Success!";
                }
            }
            catch (Exception ex)
            {
                log.Error("ConsortiaIMList", ex);
            }

            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));
            context.Response.Write(result.ToString(false));
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
            {
                return(0);
            }

            bool   result = false;
            string msg    = "ConsortiaStoreUpGradeHandler.Failed";
            //using (ConsortiaBussiness db = new ConsortiaBussiness())
            //{
            //    ConsortiaInfo info = db.GetConsortiaSingle(client.Player.PlayerCharacter.ConsortiaID);

            ConsortiaInfo info = Managers.ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);

            if (info == null)
            {
                msg = "ConsortiaStoreUpGradeHandler.NoConsortia";
            }
            else
            {
                using (ConsortiaBussiness cb = new ConsortiaBussiness())
                {
                    if (cb.UpGradeStoreConsortia(client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, ref msg))
                    {
                        info.StoreLevel++;
                        GameServer.Instance.LoginServer.SendConsortiaStoreUpGrade(info);
                        msg    = "ConsortiaStoreUpGradeHandler.Success";
                        result = true;
                    }
                }
            }

            //}


            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return(1);
        }
Пример #23
0
 private static bool LoadConsortia(Dictionary <int, ConsortiaInfo> consortia)
 {
     using (ConsortiaBussiness db = new ConsortiaBussiness())
     {
         ConsortiaInfo[] infos = db.GetConsortiaAll();
         ConsortiaInfo[] array = infos;
         for (int i = 0; i < array.Length; i++)
         {
             ConsortiaInfo info = array[i];
             if (info.IsExist)
             {
                 if (!consortia.ContainsKey(info.ConsortiaID))
                 {
                     consortia.Add(info.ConsortiaID, info);
                 }
             }
         }
     }
     return(true);
 }
Пример #24
0
        public override bool IsCompleted(GamePlayer player)
        {
            bool result   = false;
            int  tempComp = 0;

            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                ConsortiaInfo info = db.GetConsortiaSingle(player.PlayerCharacter.ConsortiaID);
                switch (m_info.Para1)
                {
                case 0:      //公会人数
                    tempComp = info.Count;
                    break;

                case 1:      //公会贡献度
                    tempComp = player.PlayerCharacter.RichesOffer + player.PlayerCharacter.RichesRob;
                    break;

                case 2:      //公会铁匠铺等级
                    tempComp = info.SmithLevel;
                    break;

                case 3:      //公会商城等级
                    tempComp = info.ShopLevel;
                    break;

                case 4:      //公会保管箱等级
                    tempComp = info.StoreLevel;
                    break;

                default:
                    break;
                }
                if (tempComp >= m_info.Para2)
                {
                    Value  = 0;
                    result = true;
                }
                return(result);
            }
        }
Пример #25
0
        public override bool IsCompleted(GamePlayer player)
        {
            bool flag = false;
            int  num  = 0;
            bool result;

            using (ConsortiaBussiness consortiaBussiness = new ConsortiaBussiness())
            {
                ConsortiaInfo consortiaSingle = consortiaBussiness.GetConsortiaSingle(player.PlayerCharacter.ConsortiaID);
                switch (this.m_info.Para1)
                {
                case 0:
                    num = consortiaSingle.Count;
                    break;

                case 1:
                    num = player.PlayerCharacter.RichesOffer + player.PlayerCharacter.RichesRob;
                    break;

                case 2:
                    num = consortiaSingle.SmithLevel;
                    break;

                case 3:
                    num = consortiaSingle.ShopLevel;
                    break;

                case 4:
                    num = consortiaSingle.StoreLevel;
                    break;
                }
                if (num >= this.m_info.Para2)
                {
                    base.Value = 0;
                    flag       = true;
                }
                result = flag;
            }
            return(result);
        }
Пример #26
0
        public override bool IsCompleted(GamePlayer player)
        {
            bool result   = false;
            int  tempComp = 0;
            bool result2;

            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                ConsortiaInfo info = db.GetConsortiaSingle(player.PlayerCharacter.ConsortiaID);
                switch (this.m_info.Para1)
                {
                case 0:
                    tempComp = info.Count;
                    break;

                case 1:
                    tempComp = player.PlayerCharacter.RichesOffer + player.PlayerCharacter.RichesRob;
                    break;

                case 2:
                    tempComp = info.SmithLevel;
                    break;

                case 3:
                    tempComp = info.ShopLevel;
                    break;

                case 4:
                    tempComp = info.StoreLevel;
                    break;
                }
                if (tempComp >= this.m_info.Para2)
                {
                    base.Value = 0;
                    result     = true;
                }
                result2 = result;
            }
            return(result2);
        }
Пример #27
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
            {
                return(1);
            }
            int num  = (int)packet.ReadByte();
            int num2 = packet.ReadInt();

            packet.ReadInt();
            if (num == 0 && num2 < 31)
            {
                return(1);
            }
            ConsortiaInfo consortiaInfo = ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);

            if (consortiaInfo != null)
            {
                PlayerInventory arg_57_0 = client.Player.ConsortiaBag;
                client.Player.GetInventory((eBageType)num);
            }
            return(0);
        }
Пример #28
0
        public static int CanConsortiaFight(int consortiaID1, int consortiaID2)
        {
            int result;

            if (consortiaID1 == 0 || consortiaID2 == 0 || consortiaID1 == consortiaID2)
            {
                result = -1;
            }
            else
            {
                ConsortiaInfo consortia  = ConsortiaMgr.FindConsortiaInfo(consortiaID1);
                ConsortiaInfo consortia2 = ConsortiaMgr.FindConsortiaInfo(consortiaID2);
                if (consortia == null || consortia2 == null || consortia.Level < 3 || consortia2.Level < 3)
                {
                    result = -1;
                }
                else
                {
                    result = ConsortiaMgr.FindConsortiaAlly(consortiaID1, consortiaID2);
                }
            }
            return(result);
        }
Пример #29
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result2;

            if (player.PlayerCharacter.ConsortiaID == 0)
            {
                result2 = 0;
            }
            else
            {
                bool          result = false;
                string        msg    = "ConsortiaStoreUpGradeHandler.Failed";
                ConsortiaInfo info   = ConsortiaMgr.FindConsortiaInfo(player.PlayerCharacter.ConsortiaID);
                if (info == null)
                {
                    msg = "ConsortiaStoreUpGradeHandler.NoConsortia";
                }
                else
                {
                    using (ConsortiaBussiness cb = new ConsortiaBussiness())
                    {
                        if (cb.UpGradeStoreConsortia(player.PlayerCharacter.ConsortiaID, player.PlayerCharacter.ID, ref msg))
                        {
                            info.StoreLevel++;
                            GameServer.Instance.LoginServer.SendConsortiaStoreUpGrade(info);
                            msg    = "ConsortiaStoreUpGradeHandler.Success";
                            result = true;
                        }
                    }
                }
                packet.WriteBoolean(result);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                player.Out.SendTCP(packet);
                result2 = 1;
            }
            return(result2);
        }
Пример #30
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            GSPacketIn    gSPacketIn         = new GSPacketIn(58, client.Player.PlayerCharacter.ID);
            StringBuilder stringBuilder      = new StringBuilder();
            int           pRICE_COMPOSE_GOLD = GameProperties.PRICE_COMPOSE_GOLD;

            if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked)
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked", new object[0]));
                return(0);
            }
            if (client.Player.PlayerCharacter.Gold < pRICE_COMPOSE_GOLD)
            {
                client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("ItemComposeHandler.NoMoney", new object[0]));
                return(0);
            }
            int      num           = -1;
            int      num2          = -1;
            bool     flag          = false;
            bool     flag2         = packet.ReadBoolean();
            ItemInfo itemAt        = client.Player.StoreBag.GetItemAt(1);
            ItemInfo itemAt2       = client.Player.StoreBag.GetItemAt(2);
            ItemInfo itemInfo      = null;
            ItemInfo itemInfo2     = null;
            string   beginProperty = null;
            string   text          = null;

            using (ItemRecordBussiness itemRecordBussiness = new ItemRecordBussiness())
            {
                itemRecordBussiness.PropertyString(itemAt, ref beginProperty);
            }
            if (itemAt != null && itemAt2 != null && itemAt.Template.CanCompose && (itemAt.Template.CategoryID < 10 || (itemAt2.Template.CategoryID == 11 && itemAt2.Template.Property1 == 1)))
            {
                flag = (flag || itemAt.IsBinds);
                flag = (flag || itemAt2.IsBinds);
                stringBuilder.Append(string.Concat(new object[]
                {
                    itemAt.ItemID,
                    ":",
                    itemAt.TemplateID,
                    ",",
                    itemAt2.ItemID,
                    ":",
                    itemAt2.TemplateID,
                    ","
                }));
                bool   flag3 = false;
                byte   b     = 1;
                double num3  = ItemComposeHandler.composeRate[itemAt2.Template.Quality - 1] * 100.0;
                if (client.Player.StoreBag.GetItemAt(0) != null)
                {
                    itemInfo = client.Player.StoreBag.GetItemAt(0);
                    if (itemInfo != null && itemInfo.Template.CategoryID == 11 && itemInfo.Template.Property1 == 3)
                    {
                        flag = (flag || itemInfo.IsBinds);
                        object obj = text;
                        text = string.Concat(new object[]
                        {
                            obj,
                            "|",
                            itemInfo.ItemID,
                            ":",
                            itemInfo.Template.Name,
                            "|",
                            itemAt2.ItemID,
                            ":",
                            itemAt2.Template.Name
                        });
                        stringBuilder.Append(string.Concat(new object[]
                        {
                            itemInfo.ItemID,
                            ":",
                            itemInfo.TemplateID,
                            ","
                        }));
                        num3 += num3 * (double)itemInfo.Template.Property2 / 100.0;
                    }
                }
                else
                {
                    num3 += num3 * 1.0 / 100.0;
                }
                if (num2 != -1)
                {
                    itemInfo2 = client.Player.PropBag.GetItemAt(num2);
                    if (itemInfo2 != null && itemInfo2.Template.CategoryID == 11 && itemInfo2.Template.Property1 == 7)
                    {
                        flag = (flag || itemInfo2.IsBinds);
                        stringBuilder.Append(string.Concat(new object[]
                        {
                            itemInfo2.ItemID,
                            ":",
                            itemInfo2.TemplateID,
                            ","
                        }));
                        object obj2 = text;
                        text = string.Concat(new object[]
                        {
                            obj2,
                            ",",
                            itemInfo2.ItemID,
                            ":",
                            itemInfo2.Template.Name
                        });
                    }
                    else
                    {
                        itemInfo2 = null;
                    }
                }
                if (flag2)
                {
                    ConsortiaInfo             consortiaInfo        = ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);
                    ConsortiaBussiness        consortiaBussiness   = new ConsortiaBussiness();
                    ConsortiaEquipControlInfo consortiaEuqipRiches = consortiaBussiness.GetConsortiaEuqipRiches(client.Player.PlayerCharacter.ConsortiaID, 0, 2);
                    if (consortiaInfo == null)
                    {
                        client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemStrengthenHandler.Fail", new object[0]));
                    }
                    else
                    {
                        if (client.Player.PlayerCharacter.Riches < consortiaEuqipRiches.Riches)
                        {
                            client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("ItemStrengthenHandler.FailbyPermission", new object[0]));
                            return(1);
                        }
                        num3 *= 1.0 + 0.1 * (double)consortiaInfo.SmithLevel;
                    }
                }
                num3 = Math.Floor(num3 * 10.0) / 10.0;
                int num4 = ItemComposeHandler.random.Next(100);
                switch (itemAt2.Template.Property3)
                {
                case 1:
                    if (itemAt2.Template.Property4 > itemAt.AttackCompose)
                    {
                        flag3 = true;
                        if (num3 > (double)num4)
                        {
                            b = 0;
                            itemAt.AttackCompose = itemAt2.Template.Property4;
                        }
                    }
                    break;

                case 2:
                    if (itemAt2.Template.Property4 > itemAt.DefendCompose)
                    {
                        flag3 = true;
                        if (num3 > (double)num4)
                        {
                            b = 0;
                            itemAt.DefendCompose = itemAt2.Template.Property4;
                        }
                    }
                    break;

                case 3:
                    if (itemAt2.Template.Property4 > itemAt.AgilityCompose)
                    {
                        flag3 = true;
                        if (num3 > (double)num4)
                        {
                            b = 0;
                            itemAt.AgilityCompose = itemAt2.Template.Property4;
                        }
                    }
                    break;

                case 4:
                    if (itemAt2.Template.Property4 > itemAt.LuckCompose)
                    {
                        flag3 = true;
                        if (num3 > (double)num4)
                        {
                            b = 0;
                            itemAt.LuckCompose = itemAt2.Template.Property4;
                        }
                    }
                    break;
                }
                if (flag3)
                {
                    itemAt.IsBinds = flag;
                    if (b != 0)
                    {
                        stringBuilder.Append("false!");
                        flag3 = false;
                    }
                    else
                    {
                        stringBuilder.Append("true!");
                        flag3 = true;
                        client.Player.OnItemCompose(itemAt2.TemplateID);
                    }
                    LogMgr.LogItemAdd(client.Player.PlayerCharacter.ID, LogItemType.Compose, beginProperty, itemAt, text, Convert.ToInt32(flag3));
                    client.Player.StoreBag.RemoveTemplate(itemAt2.TemplateID, 1);
                    if (itemInfo != null)
                    {
                        client.Player.StoreBag.RemoveTemplate(itemInfo.TemplateID, 1);
                    }
                    if (itemInfo2 != null)
                    {
                        client.Player.RemoveItem(itemInfo2);
                    }
                    client.Player.RemoveGold(pRICE_COMPOSE_GOLD);
                    client.Player.StoreBag.UpdateItem(itemAt);
                    gSPacketIn.WriteByte(b);
                    client.Out.SendTCP(gSPacketIn);
                    if (num < 31)
                    {
                        client.Player.MainBag.UpdatePlayerProperties();
                    }
                }
                else
                {
                    client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemComposeHandler.NoLevel", new object[0]));
                }
            }
            else
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemComposeHandler.Fail", new object[0]));
            }
            return(0);
        }