public void HandleConsortiaCreate(GSPacketIn packet)
        {
            int consortiaID = packet.ReadInt();

            packet.ReadInt();
            ConsortiaMgr.AddConsortia(consortiaID);
        }
Пример #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
        /// <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);
        }
Пример #4
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);
        }
Пример #5
0
        public void HandleConsortiaCreate(GSPacketIn packet)
        {
            int    consortiaID  = packet.ReadInt();
            int    offer        = packet.ReadInt();
            string chairmanName = packet.ReadString();

            ConsortiaMgr.AddConsortia(consortiaID, chairmanName);
        }
Пример #6
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);
                }
            }
        }
Пример #8
0
        private ItemInfo getitem(GameClient client, int type, string color, string skin, int id)
        {
            ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);
            ShopItemInfo shopItemInfoById = ShopMgr.GetShopItemInfoById(id);
            bool         flag             = false;
            ItemInfo     itemInfo         = null;

            if (shopItemInfoById != null)
            {
                itemInfo = ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(shopItemInfoById.TemplateID), 1, 102);
                if (shopItemInfoById.BuyType == 0)
                {
                    if (1 == type)
                    {
                        itemInfo.ValidDate = shopItemInfoById.AUnit;
                    }
                    if (2 == type)
                    {
                        itemInfo.ValidDate = shopItemInfoById.BUnit;
                    }
                    if (3 == type)
                    {
                        itemInfo.ValidDate = shopItemInfoById.CUnit;
                    }
                }
                else
                {
                    if (1 == type)
                    {
                        itemInfo.Count = shopItemInfoById.AUnit;
                    }
                    if (2 == type)
                    {
                        itemInfo.Count = shopItemInfoById.BUnit;
                    }
                    if (3 == type)
                    {
                        itemInfo.Count = shopItemInfoById.CUnit;
                    }
                }
                if (itemInfo != null || shopItemInfoById != null)
                {
                    itemInfo.Color = ((color == null) ? "" : color);
                    itemInfo.Skin  = ((skin == null) ? "" : skin);
                    if (flag)
                    {
                        itemInfo.IsBinds = true;
                        return(itemInfo);
                    }
                    itemInfo.IsBinds = Convert.ToBoolean(shopItemInfoById.IsBind);
                }
            }
            return(itemInfo);
        }
Пример #9
0
        public void SendConsortiaAlly(int consortiaID1, int consortiaID2, int state)
        {
            GSPacketIn pkg = new GSPacketIn(128);

            pkg.WriteByte(7);
            pkg.WriteInt(consortiaID1);
            pkg.WriteInt(consortiaID2);
            pkg.WriteInt(state);
            this.SendTCP(pkg);
            ConsortiaMgr.UpdateConsortiaAlly(consortiaID1, consortiaID2, state);
        }
Пример #10
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);
        }
Пример #11
0
        public void HandleConsortiaAlly(GSPacketIn packet)
        {
            int consortiaID  = packet.ReadInt();
            int consortiaID2 = packet.ReadInt();
            int state        = packet.ReadInt();

            ConsortiaMgr.UpdateConsortiaAlly(consortiaID, consortiaID2, state);
            GamePlayer[] players = WorldMgr.GetAllPlayers();
            GamePlayer[] array   = players;
            for (int i = 0; i < array.Length; i++)
            {
                GamePlayer p = array[i];
                if (p.PlayerCharacter.ConsortiaID == consortiaID || p.PlayerCharacter.ConsortiaID == consortiaID2)
                {
                    p.Out.SendTCP(packet);
                }
            }
        }
        public void HandleConsortiaAlly(GSPacketIn packet)
        {
            int num   = packet.ReadInt();
            int num2  = packet.ReadInt();
            int state = packet.ReadInt();

            ConsortiaMgr.UpdateConsortiaAlly(num, num2, state);
            GamePlayer[] allPlayers = WorldMgr.GetAllPlayers();
            GamePlayer[] array      = allPlayers;
            for (int i = 0; i < array.Length; i++)
            {
                GamePlayer gamePlayer = array[i];
                if (gamePlayer.PlayerCharacter.ConsortiaID == num || gamePlayer.PlayerCharacter.ConsortiaID == num2)
                {
                    gamePlayer.Out.SendTCP(packet);
                }
            }
        }
Пример #13
0
        public void HandleConsortiaSmithUpGrade(GSPacketIn packet)
        {
            int    consortiaID   = packet.ReadInt();
            string consortiaName = packet.ReadString();
            int    smithLevel    = packet.ReadInt();

            ConsortiaMgr.ConsortiaSmithUpGrade(consortiaID, smithLevel);
            GamePlayer[] players = WorldMgr.GetAllPlayers();
            GamePlayer[] array   = players;
            for (int i = 0; i < array.Length; i++)
            {
                GamePlayer p = array[i];
                if (p.PlayerCharacter.ConsortiaID == consortiaID)
                {
                    p.PlayerCharacter.SmithLevel = smithLevel;
                    p.Out.SendTCP(packet);
                }
            }
        }
        public void HandleConsortiaSmithUpGrade(GSPacketIn packet)
        {
            int num = packet.ReadInt();

            packet.ReadString();
            int smithLevel = packet.ReadInt();

            ConsortiaMgr.ConsortiaSmithUpGrade(num, smithLevel);
            GamePlayer[] allPlayers = WorldMgr.GetAllPlayers();
            GamePlayer[] array      = allPlayers;
            for (int i = 0; i < array.Length; i++)
            {
                GamePlayer gamePlayer = array[i];
                if (gamePlayer.PlayerCharacter.ConsortiaID == num)
                {
                    gamePlayer.PlayerCharacter.SmithLevel = smithLevel;
                    gamePlayer.Out.SendTCP(packet);
                }
            }
        }
Пример #15
0
        public void KillPerson(GamePlayer killPlayer)
        {
            if (killPlayer.CurrentTeamIndex == CurrentIndex.CurrentTeamIndex || CurrentIndex.CurrentGame == null)
            {
                return;
            }

            persons[CurrentIndex.CurrentTeamIndex].TatolKill++;
            Players[CurrentIndex].TotalKill++;

            int state = ConsortiaMgr.KillPlayer(CurrentIndex, killPlayer, Players, CurrentIndex.CurrentGame.RoomType, CurrentIndex.CurrentGame.GameClass);

            //int state = ConsortiaMgr.FindConsortiaAlly(CurrentIndex.PlayerCharacter.ConsortiaID,killPlayer.PlayerCharacter.ConsortiaID);

            CurrentIndex.QuestInventory.CheckKillPlayer(MapIndex, (int)CurrentIndex.CurrentGame.GameMode,
                                                        CurrentIndex.CurrentGame.ScanTime, Players[CurrentIndex].IsCaptain, killPlayer.PlayerCharacter.Grade,
                                                        persons[CurrentIndex.CurrentTeamIndex].TeamPerson, TotalPerson - persons[CurrentIndex.CurrentTeamIndex].TeamPerson, state, (int)CurrentIndex.CurrentGame.RoomType);


            //GameServer.Instance.LoginServer.SendConsortiaOffer(killPlayer.PlayerCharacter.ConsortiaID
        }
Пример #16
0
        public void HandleConsortiaDuty(GSPacketIn packet)
        {
            int    updateType  = (int)packet.ReadByte();
            int    consortiaID = packet.ReadInt();
            int    playerID    = packet.ReadInt();
            string playerName  = packet.ReadString();
            int    dutyLevel   = packet.ReadInt();
            string dutyName    = packet.ReadString();
            int    right       = packet.ReadInt();

            if (updateType == 9)
            {
                ConsortiaMgr.ConsortiaChangChairman(consortiaID, playerName);
            }
            GamePlayer[] players = WorldMgr.GetAllPlayers();
            GamePlayer[] array   = players;
            for (int i = 0; i < array.Length; i++)
            {
                GamePlayer p = array[i];
                if (p.PlayerCharacter.ConsortiaID == consortiaID)
                {
                    if (updateType == 2 && p.PlayerCharacter.DutyLevel == dutyLevel)
                    {
                        p.PlayerCharacter.DutyName = dutyName;
                    }
                    else
                    {
                        if (p.PlayerCharacter.ID == playerID && (updateType == 5 || updateType == 6 || updateType == 7 || updateType == 8 || updateType == 9))
                        {
                            p.PlayerCharacter.DutyLevel = dutyLevel;
                            p.PlayerCharacter.DutyName  = dutyName;
                            p.PlayerCharacter.Right     = right;
                        }
                    }
                    p.Out.SendTCP(packet);
                }
            }
        }