Esempio n. 1
0
 public static XElement CreateConsortiaEquipControlInfo(ConsortiaEquipControlInfo info)
 {
     return(new XElement("Item", new XAttribute("ConsortiaID", info.ConsortiaID),
                         new XAttribute("Level", info.Level),
                         new XAttribute("Riches", info.Riches),
                         new XAttribute("Type", info.Type)));
 }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //context.Response.Write("Hello World");


            bool     value   = false;
            string   message = "Fail!";
            XElement result  = new XElement("Result");
            int      total   = 0;

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


                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    for (int i = 1; i < 3; i++)
                    {
                        for (int j = 1; j < 11; j++)
                        {
                            ConsortiaEquipControlInfo cecInfo = db.GetConsortiaEuqipRiches(consortiaID, j, i);
                            if (cecInfo != null)
                            {
                                result.Add(new XElement("Item", new XAttribute("type", cecInfo.Type), new XAttribute("level", cecInfo.Level), new XAttribute("riches", cecInfo.Riches)));
                                total++;
                            }
                        }
                    }

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

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

            context.Response.ContentType = "text/plain";
            context.Response.Write(result.ToString(false));
        }
Esempio n. 3
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result2;

            if (player.PlayerCharacter.ConsortiaID == 0)
            {
                result2 = 0;
            }
            else
            {
                bool   result = false;
                string msg    = "ConsortiaEquipControlHandler.Fail";
                ConsortiaEquipControlInfo info = new ConsortiaEquipControlInfo();
                info.ConsortiaID = player.PlayerCharacter.ConsortiaID;
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    for (int i = 0; i < 5; i++)
                    {
                        info.Riches = packet.ReadInt();
                        info.Type   = 1;
                        info.Level  = i + 1;
                        db.AddAndUpdateConsortiaEuqipControl(info, player.PlayerCharacter.ID, ref msg);
                    }
                    info.Riches = packet.ReadInt();
                    info.Type   = 2;
                    info.Level  = 0;
                    db.AddAndUpdateConsortiaEuqipControl(info, player.PlayerCharacter.ID, ref msg);
                    msg    = "ConsortiaEquipControlHandler.Success";
                    result = true;
                }
                packet.WriteBoolean(result);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                player.Out.SendTCP(packet);
                result2 = 0;
            }
            return(result2);
        }
Esempio n. 4
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
            {
                return(0);
            }
            //Type 1表示商城,2表示铁匠铺

            bool   result = false;
            string msg    = "ConsortiaEquipControlHandler.Fail";
            ConsortiaEquipControlInfo info = new ConsortiaEquipControlInfo();

            info.ConsortiaID = client.Player.PlayerCharacter.ConsortiaID;
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                for (int i = 0; i < 5; i++)
                {
                    info.Riches = packet.ReadInt();
                    info.Type   = 1;
                    info.Level  = i + 1;

                    db.AddAndUpdateConsortiaEuqipControl(info, client.Player.PlayerCharacter.ID, ref msg);
                }
                info.Riches = packet.ReadInt();
                info.Type   = 2;
                info.Level  = 0;
                db.AddAndUpdateConsortiaEuqipControl(info, client.Player.PlayerCharacter.ID, ref msg);
                msg    = "ConsortiaEquipControlHandler.Success";
                result = true;
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return(0);
        }
Esempio n. 5
0
        public static void Process(IHttpRequest Request, IHttpResponse Response)
        {
            bool     value   = false;
            string   message = "Fail!";
            XElement result  = new XElement("Result");
            int      total   = 0;

            try
            {
                int page        = 1;
                int size        = 10;
                int order       = 1;
                int consortiaID = int.Parse(Request.Uri.QueryString["consortiaID"]);
                int level       = int.Parse(Request.Uri.QueryString["level"]);
                int type        = int.Parse(Request.Uri.QueryString["type"]);
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaEquipControlInfo[] infos = db.GetConsortiaEquipControlPage(page, size, ref total, order, consortiaID, level, type);
                    ConsortiaEquipControlInfo[] array = infos;
                    for (int i = 0; i < array.Length; i++)
                    {
                        ConsortiaEquipControlInfo info = array[i];
                        result.Add(FlashUtils.CreateConsortiaEquipControlInfo(info));
                    }
                    value   = true;
                    message = "Success!";
                }
            }
            catch (Exception ex)
            {
            }
            result.Add(new XAttribute("total", total));
            result.Add(new XAttribute("vaule", value));
            result.Add(new XAttribute("message", message));
            Response.Write(result.ToString(false));
        }
        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);
        }
Esempio n. 7
0
        public static bool CanBuy(int shopID, int consortiaShopLevel, ref bool isBinds, int cousortiaID, int playerRiches)
        {
            bool result = false;

            using (ConsortiaBussiness consortiaBussiness = new ConsortiaBussiness())
            {
                switch (shopID)
                {
                case 1:
                    result  = true;
                    isBinds = false;
                    break;

                case 2:
                    result  = true;
                    isBinds = false;
                    break;

                case 3:
                    result  = true;
                    isBinds = false;
                    break;

                case 4:
                    result  = true;
                    isBinds = false;
                    break;

                case 11:
                {
                    ConsortiaEquipControlInfo consortiaEuqipRiches = consortiaBussiness.GetConsortiaEuqipRiches(cousortiaID, 1, 1);
                    if (consortiaShopLevel >= consortiaEuqipRiches.Level && playerRiches >= consortiaEuqipRiches.Riches)
                    {
                        result  = true;
                        isBinds = true;
                    }
                    break;
                }

                case 12:
                {
                    ConsortiaEquipControlInfo consortiaEuqipRiches = consortiaBussiness.GetConsortiaEuqipRiches(cousortiaID, 2, 1);
                    if (consortiaShopLevel >= consortiaEuqipRiches.Level && playerRiches >= consortiaEuqipRiches.Riches)
                    {
                        result  = true;
                        isBinds = true;
                    }
                    break;
                }

                case 13:
                {
                    ConsortiaEquipControlInfo consortiaEuqipRiches = consortiaBussiness.GetConsortiaEuqipRiches(cousortiaID, 3, 1);
                    if (consortiaShopLevel >= consortiaEuqipRiches.Level && playerRiches >= consortiaEuqipRiches.Riches)
                    {
                        result  = true;
                        isBinds = true;
                    }
                    break;
                }

                case 14:
                {
                    ConsortiaEquipControlInfo consortiaEuqipRiches = consortiaBussiness.GetConsortiaEuqipRiches(cousortiaID, 4, 1);
                    if (consortiaShopLevel >= consortiaEuqipRiches.Level && playerRiches >= consortiaEuqipRiches.Riches)
                    {
                        result  = true;
                        isBinds = true;
                    }
                    break;
                }

                case 15:
                {
                    ConsortiaEquipControlInfo consortiaEuqipRiches = consortiaBussiness.GetConsortiaEuqipRiches(cousortiaID, 5, 1);
                    if (consortiaShopLevel >= consortiaEuqipRiches.Level && playerRiches >= consortiaEuqipRiches.Riches)
                    {
                        result  = true;
                        isBinds = true;
                    }
                    break;
                }
                }
            }
            return(result);
        }
Esempio n. 8
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            GSPacketIn pkg = packet.Clone();

            pkg.ClearContext();
            StringBuilder str      = new StringBuilder();
            int           mustGold = AppConfig.AppSettings["ComposeGold"].ConvertToInt(1000);
            int           result2;

            if (player.PlayerCharacter.HasBagPassword && player.PlayerCharacter.IsLocked)
            {
                player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked", new object[0]));
                result2 = 0;
            }
            else
            {
                if (player.PlayerCharacter.Gold < mustGold)
                {
                    player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("ItemComposeHandler.NoMoney", new object[0]));
                    result2 = 0;
                }
                else
                {
                    bool     isBinds       = false;
                    bool     consortia     = packet.ReadBoolean();
                    ItemInfo item          = player.HideBag.GetItemAt(1);
                    ItemInfo stone         = player.HideBag.GetItemAt(2);
                    ItemInfo luck          = null;
                    string   BeginProperty = "";
                    if (item != null)
                    {
                        BeginProperty = item.GetPropertyString();
                    }
                    string AddItem = null;
                    if (item != null && stone != null && item.Template.CanCompose && (item.Template.CategoryID < 10 || item.Template.CategoryID >= 18) && stone.Template.CategoryID == 11 && stone.Template.Property1 == 1)
                    {
                        isBinds = (isBinds || item.IsBinds);
                        isBinds = (isBinds || stone.IsBinds);
                        str.Append(string.Concat(new object[]
                        {
                            item.ItemID,
                            ":",
                            item.TemplateID,
                            ",",
                            stone.ItemID,
                            ":",
                            stone.TemplateID,
                            ","
                        }));
                        bool   result      = false;
                        byte   isSuccess   = 1;
                        bool   isGod       = false;
                        double probability = (double)stone.Template.Property2;
                        luck = player.HideBag.GetItemAt(0);
                        if (luck != null)
                        {
                            if (luck.Template.CategoryID == 11 && luck.Template.Property1 == 3)
                            {
                                isBinds = (isBinds || luck.IsBinds);
                                object obj = AddItem;
                                AddItem = string.Concat(new object[]
                                {
                                    obj,
                                    "|",
                                    luck.ItemID,
                                    ":",
                                    luck.Template.Name,
                                    "|",
                                    stone.ItemID,
                                    ":",
                                    stone.Template.Name
                                });
                                probability *= (double)(luck.Template.Property2 + 100);
                                str.Append(string.Concat(new object[]
                                {
                                    luck.ItemID,
                                    ":",
                                    luck.TemplateID,
                                    ","
                                }));
                            }
                            else
                            {
                                probability *= 100.0;
                                luck         = null;
                            }
                        }
                        else
                        {
                            probability *= 100.0;
                        }
                        if (consortia)
                        {
                            ConsortiaInfo info = ConsortiaMgr.FindConsortiaInfo(player.PlayerCharacter.ConsortiaID);
                            using (ConsortiaBussiness csbs = new ConsortiaBussiness())
                            {
                                ConsortiaEquipControlInfo cecInfo = csbs.GetConsortiaEuqipRiches(player.PlayerCharacter.ConsortiaID, 0, 2);
                                if (info == null)
                                {
                                    player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemStrengthenHandler.Fail", new object[0]));
                                }
                                else
                                {
                                    if (player.PlayerCharacter.Riches < cecInfo.Riches)
                                    {
                                        player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("ItemStrengthenHandler.FailbyPermission", new object[0]));
                                        result2 = 1;
                                        return(result2);
                                    }
                                    probability *= 1.0 + 0.1 * (double)info.SmithLevel;
                                }
                            }
                        }
                        int rand = ItemComposeHandler.random.Next(10000);
                        switch (stone.Template.Property3)
                        {
                        case 1:
                            if (stone.Template.Property4 > item.AttackCompose)
                            {
                                result = true;
                                if (probability > (double)rand)
                                {
                                    isSuccess          = 0;
                                    item.AttackCompose = stone.Template.Property4;
                                }
                                else
                                {
                                    if (!isGod)
                                    {
                                    }
                                }
                            }
                            break;

                        case 2:
                            if (stone.Template.Property4 > item.DefendCompose)
                            {
                                result = true;
                                if (probability > (double)rand)
                                {
                                    isSuccess          = 0;
                                    item.DefendCompose = stone.Template.Property4;
                                }
                                else
                                {
                                    if (!isGod)
                                    {
                                    }
                                }
                            }
                            break;

                        case 3:
                            if (stone.Template.Property4 > item.AgilityCompose)
                            {
                                result = true;
                                if (probability > (double)rand)
                                {
                                    isSuccess           = 0;
                                    item.AgilityCompose = stone.Template.Property4;
                                }
                                else
                                {
                                    if (!isGod)
                                    {
                                    }
                                }
                            }
                            break;

                        case 4:
                            if (stone.Template.Property4 > item.LuckCompose)
                            {
                                result = true;
                                if (probability > (double)rand)
                                {
                                    isSuccess        = 0;
                                    item.LuckCompose = stone.Template.Property4;
                                }
                                else
                                {
                                    if (!isGod)
                                    {
                                    }
                                }
                            }
                            break;
                        }
                        if (result)
                        {
                            item.IsBinds = isBinds;
                            if (isSuccess != 0)
                            {
                                str.Append("false!");
                                result = false;
                                if (!isGod)
                                {
                                    if (item.Template.Level < 3)
                                    {
                                    }
                                }
                            }
                            else
                            {
                                str.Append("true!");
                                result = true;
                                player.OnItemCompose(stone.TemplateID);
                            }
                            //LogMgr.LogItemAdd(player.PlayerCharacter.ID, LogItemType.Compose, BeginProperty, item, AddItem, Convert.ToInt32(result));
                            stone.Count--;
                            player.UpdateItem(stone);
                            if (luck != null)
                            {
                                luck.Count--;
                                player.UpdateItem(luck);
                            }
                            player.RemoveGold(mustGold);
                            player.HideBag.UpdateItem(item);
                            pkg.WriteByte(isSuccess);
                            player.Out.SendTCP(pkg);
                            player.SaveIntoDatabase();
                        }
                        else
                        {
                            player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemComposeHandler.NoLevel", new object[0]));
                        }
                    }
                    else
                    {
                        player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemComposeHandler.Fail", new object[0]));
                    }
                    result2 = 0;
                }
            }
            return(result2);
        }
Esempio n. 9
0
        public static int countConnect = 0; public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (countConnect >= 3000)
            {
                client.Disconnect(); return(0);
            }
            GSPacketIn pkg = packet.Clone();

            pkg.ClearContext();

            StringBuilder str      = new StringBuilder();
            int           mustGold = GameProperties.PRICE_COMPOSE_GOLD;

            if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked)
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked"));
                return(0);
            }
            if (client.Player.PlayerCharacter.Gold < mustGold)
            {
                client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("ItemComposeHandler.NoMoney"));
                return(0);
            }

            int  itemPlace = -1;
            int  godPlace  = -1;
            bool isBinds   = false;
            bool consortia = packet.ReadBoolean();

            ItemInfo item  = client.Player.StoreBag2.GetItemAt(1);
            ItemInfo stone = client.Player.StoreBag2.GetItemAt(2);
            ItemInfo luck  = null;
            ItemInfo god   = null;

            string BeginProperty = null;
            string AddItem       = null;

            using (ItemRecordBussiness db = new ItemRecordBussiness())
            {
                db.PropertyString(item, ref BeginProperty);
            }
            if (item != null && stone != null && item.Template.CanCompose && (item.Template.CategoryID < 10 || stone.Template.CategoryID == 11 && stone.Template.Property1 == 1))
            {
                isBinds = isBinds ? true : item.IsBinds;
                isBinds = isBinds ? true : stone.IsBinds;
                str.Append(item.ItemID + ":" + item.TemplateID + "," + stone.ItemID + ":" + stone.TemplateID + ",");
                ThreadSafeRandom random    = new ThreadSafeRandom();
                bool             result    = false;
                byte             isSuccess = 1;
                //bool isGod = false;
                double probability = composeRate[(stone.Template.Quality - 1)] * 100;//stone.Template.Property2;
                if (client.Player.StoreBag2.GetItemAt(0) != null)
                {
                    luck = client.Player.StoreBag2.GetItemAt(0);
                    if (luck != null && luck.Template.CategoryID == 11 && luck.Template.Property1 == 3)
                    {
                        isBinds  = isBinds ? true : luck.IsBinds;
                        AddItem += "|" + luck.ItemID + ":" + luck.Template.Name + "|" + stone.ItemID + ":" + stone.Template.Name;
                        str.Append(luck.ItemID + ":" + luck.TemplateID + ",");
                        probability += probability * luck.Template.Property2 / 100;
                    }
                }
                else
                {
                    probability += probability * 1 / 100;
                }
                if (godPlace != -1)
                {
                    god = client.Player.PropBag.GetItemAt(godPlace);
                    if (god != null && god.Template.CategoryID == 11 && god.Template.Property1 == 7)
                    {
                        isBinds = isBinds ? true : god.IsBinds;
                        //isGod = true;
                        str.Append(god.ItemID + ":" + god.TemplateID + ",");
                        AddItem += "," + god.ItemID + ":" + god.Template.Name;
                    }
                    else
                    {
                        god = null;
                    }
                }
                //判断是公会铁匠铺还是铁匠铺
                if (consortia)
                {
                    ConsortiaInfo info = ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);
                    //这里添加公会权限限制的判断
                    ConsortiaBussiness        csbs    = new ConsortiaBussiness();
                    ConsortiaEquipControlInfo cecInfo = csbs.GetConsortiaEuqipRiches(client.Player.PlayerCharacter.ConsortiaID, 0, 2);

                    if (info == null)
                    {
                        client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemStrengthenHandler.Fail"));
                    }
                    else
                    {
                        if (client.Player.PlayerCharacter.Riches < cecInfo.Riches)
                        {
                            client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("ItemStrengthenHandler.FailbyPermission"));
                            return(1);
                        }
                        else
                        {
                            probability *= (1 + 0.1 * info.SmithLevel);
                        }
                    }
                }
                probability = Math.Floor(probability * 10) / 10;
                //client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Probability: " + probability.ToString()));
                int rand = random.Next(100);
                switch (stone.Template.Property3)
                {
                case 1:
                    if (stone.Template.Property4 > item.AttackCompose)
                    {
                        result = true;
                        if (probability > rand)
                        {
                            isSuccess          = 0;
                            item.AttackCompose = stone.Template.Property4;
                        }
                    }
                    break;

                case 2:
                    if (stone.Template.Property4 > item.DefendCompose)
                    {
                        result = true;
                        if (probability > rand)
                        {
                            isSuccess          = 0;
                            item.DefendCompose = stone.Template.Property4;
                        }
                    }
                    break;

                case 3:
                    if (stone.Template.Property4 > item.AgilityCompose)
                    {
                        result = true;
                        if (probability > rand)
                        {
                            isSuccess           = 0;
                            item.AgilityCompose = stone.Template.Property4;
                        }
                    }
                    break;

                case 4:
                    if (stone.Template.Property4 > item.LuckCompose)
                    {
                        result = true;
                        if (probability > rand)
                        {
                            isSuccess        = 0;
                            item.LuckCompose = stone.Template.Property4;
                        }
                    }
                    break;
                }

                if (result)
                {
                    item.IsBinds = isBinds;
                    if (isSuccess != 0)
                    {
                        str.Append("false!");
                        result = false;
                    }
                    else
                    {
                        str.Append("true!");
                        result = true;
                        client.Player.OnItemCompose(stone.TemplateID);
                    }
                    LogMgr.LogItemAdd(client.Player.PlayerCharacter.ID, LogItemType.Compose, BeginProperty, item, AddItem, Convert.ToInt32(result));
                    client.Player.RemoveItem(stone);
                    client.Player.SaveIntoDatabase();//保存到数据库
                    if (luck != null)
                    {
                        client.Player.RemoveItem(luck);
                    }
                    if (god != null)
                    {
                        client.Player.RemoveItem(god);
                    }
                    client.Player.RemoveGold(mustGold);
                    client.Player.StoreBag2.ClearBag();
                    client.Player.StoreBag2.AddItemTo(item, 1);
                    //client.Player.StoreBag2.UpdateItem(item);
                    pkg.WriteByte(isSuccess);
                    client.Out.SendTCP(pkg);
                    if (itemPlace < 31)
                    {
                        client.Player.MainBag.UpdatePlayerProperties();
                    }
                }
                else
                {
                    client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemComposeHandler.NoLevel"));
                }
            }
            else
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemComposeHandler.Fail"));
            }

            return(0);
        }
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int  pRICE_STRENGHTN_GOLD = AppConfig.AppSettings["StrengthenGold"].ConvertToInt(1000);
            bool flag = player.PlayerCharacter.Gold < pRICE_STRENGHTN_GOLD;
            int  num;
            int  result;

            if (flag)
            {
                player.Out.SendMessage(0, LanguageMgr.GetTranslation("ItemStrengthenHandler.NoMoney", new object[0]));
                num = 0;
            }
            else
            {
                GSPacketIn gSPacketIn = packet.Clone();
                gSPacketIn.ClearContext();
                ItemInfo itemInfo = player.HideBag.GetItemAt(5);
                bool     flag2    = itemInfo != null && itemInfo.Template.CanStrengthen && itemInfo.Count == 1;
                if (flag2)
                {
                    StrengthenInfo strengthenInfo = StrengthenMgr.FindStrengthenInfo(itemInfo.StrengthenLevel + 1);
                    bool           flag3          = strengthenInfo == null;
                    if (flag3)
                    {
                        bool flag4 = itemInfo.StrengthenLevel == 9 || itemInfo.StrengthenLevel == 15;
                        if (flag4)
                        {
                            player.Out.SendMessage(0, LanguageMgr.GetTranslation("ItemStrengthenHandler.FullStrengthLevel", new object[0]));
                        }
                        else
                        {
                            player.Out.SendMessage(0, LanguageMgr.GetTranslation("ItemStrengthenHandler.NoStrength", new object[0]));
                        }
                        num    = 0;
                        result = num;
                        return(result);
                    }
                    bool          flag5          = itemInfo.IsBinds;
                    bool          flag6          = packet.ReadBoolean();
                    StringBuilder stringBuilder  = new StringBuilder();
                    string        propertyString = itemInfo.GetPropertyString();
                    double        num2           = 0.0;
                    bool          flag7          = false;
                    ItemInfo      itemInfo2      = player.HideBag.GetItemAt(3);
                    bool          flag8          = itemInfo2 != null && itemInfo2.Template.CategoryID == 11 && itemInfo2.Template.Property1 == 7;
                    if (flag8)
                    {
                        flag5 |= itemInfo2.IsBinds;
                        stringBuilder.Append(itemInfo2.ToShortString());
                        flag7 = true;
                    }
                    else
                    {
                        itemInfo2 = null;
                    }
                    bool            flag9  = false;
                    List <ItemInfo> list   = new List <ItemInfo>();
                    ItemInfo        itemAt = player.HideBag.GetItemAt(0);
                    bool            flag10 = itemAt != null && itemAt.Template.CategoryID == 11 && (itemAt.Template.Property1 == 2 || itemAt.Template.Property1 == 35) && !list.Contains(itemAt);
                    if (flag10)
                    {
                        bool flag11 = itemInfo.StrengthenLevel >= 15 && itemAt.Template.Property8 == 2;
                        if (flag11)
                        {
                            player.Out.SendMessage(0, "不能使用[" + itemAt.Template.Name + "]来强化此装备.");
                            num    = 1;
                            result = num;
                            return(result);
                        }
                        flag5 |= itemAt.IsBinds;
                        flag9 |= (itemAt.Template.Property1 == 35 && itemAt.Template.CategoryID == 11);
                        num2  += (double)itemAt.Template.Property2;
                        stringBuilder.Append(itemAt.ToShortString());
                        list.Add(itemAt);
                    }
                    ItemInfo itemAt2 = player.HideBag.GetItemAt(1);
                    bool     flag12  = itemAt2 != null && itemAt2.Template.CategoryID == 11 && (itemAt2.Template.Property1 == 2 || itemAt2.Template.Property1 == 35) && !list.Contains(itemAt2);
                    if (flag12)
                    {
                        bool flag13 = itemInfo.StrengthenLevel >= 15 && itemAt2.Template.Property8 == 2;
                        if (flag13)
                        {
                            player.Out.SendMessage(0, "不能使用[" + itemAt2.Template.Name + "]来强化此装备.");
                            num    = 1;
                            result = num;
                            return(result);
                        }
                        flag5 |= itemAt2.IsBinds;
                        flag9 |= (itemAt2.Template.Property1 == 35 && itemAt2.Template.CategoryID == 11);
                        num2  += (double)itemAt2.Template.Property2;
                        stringBuilder.Append(itemAt2.ToShortString());
                        list.Add(itemAt2);
                    }
                    ItemInfo itemAt3 = player.HideBag.GetItemAt(2);
                    bool     flag14  = itemAt3 != null && itemAt3.Template.CategoryID == 11 && (itemAt3.Template.Property1 == 2 || itemAt3.Template.Property1 == 35) && !list.Contains(itemAt3);
                    if (flag14)
                    {
                        bool flag15 = itemInfo.StrengthenLevel >= 15 && itemAt3.Template.Property8 == 2;
                        if (flag15)
                        {
                            player.Out.SendMessage(0, "不能使用[" + itemAt3.Template.Name + "]来强化此装备.");
                            num    = 1;
                            result = num;
                            return(result);
                        }
                        flag5 |= itemAt3.IsBinds;
                        flag9 |= (itemAt3.Template.Property1 == 35 && itemAt3.Template.CategoryID == 11);
                        num2  += (double)itemAt3.Template.Property2;
                        stringBuilder.Append(itemAt3.ToShortString());
                        list.Add(itemAt3);
                    }
                    ItemInfo itemInfo3 = player.HideBag.GetItemAt(4);
                    bool     flag16    = itemInfo3 != null && itemInfo3.Template.CategoryID == 11 && itemInfo3.Template.Property1 == 3;
                    if (flag16)
                    {
                        flag5 |= itemInfo3.IsBinds;
                        num2  *= (double)(itemInfo3.Template.Property2 + 100);
                        stringBuilder.Append(itemInfo3.ToShortString());
                    }
                    else
                    {
                        num2     *= 100.0;
                        itemInfo3 = null;
                    }
                    bool          flag17        = false;
                    ConsortiaInfo consortiaInfo = null;
                    bool          flag18        = flag6;
                    if (flag18)
                    {
                        consortiaInfo = ConsortiaMgr.FindConsortiaInfo(player.PlayerCharacter.ConsortiaID);
                        bool flag19 = consortiaInfo == null;
                        if (flag19)
                        {
                            player.Out.SendMessage(0, LanguageMgr.GetTranslation("ItemStrengthenHandler.Fail", new object[0]));
                        }
                        else
                        {
                            using (ConsortiaBussiness consortiaBussiness = new ConsortiaBussiness())
                            {
                                ConsortiaEquipControlInfo consortiaEuqipRiches = consortiaBussiness.GetConsortiaEuqipRiches(player.PlayerCharacter.ConsortiaID, 0, 2);
                                bool flag20 = player.PlayerCharacter.Riches < consortiaEuqipRiches.Riches;
                                if (flag20)
                                {
                                    player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("ItemStrengthenHandler.FailbyPermission", new object[0]));
                                    num    = 1;
                                    result = num;
                                    return(result);
                                }
                                flag17 = true;
                            }
                        }
                    }
                    bool flag21 = list.Count >= 1;
                    if (flag21)
                    {
                        StrengthenGoodsInfo strengthenGoodsInfo = StrengthenMgr.FindStrengthenGoodsInfo(itemInfo.StrengthenLevel + 1, itemInfo.TemplateID);
                        ItemInfo            itemInfo4           = null;
                        bool flag22 = strengthenGoodsInfo != null;
                        if (flag22)
                        {
                            itemInfo4 = ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(strengthenGoodsInfo.GainEquip), 1, 116);
                            bool flag23 = itemInfo4 == null;
                            if (flag23)
                            {
                                num    = 0;
                                result = num;
                                return(result);
                            }
                        }
                        string text = null;
                        player.HideBag.BeginChanges();
                        try
                        {
                            num2 /= (double)strengthenInfo.Rock;
                            int num3;
                            for (int i = 0; i < list.Count; i = num3 + 1)
                            {
                                player.HideBag.RemoveCountFromStack(list[i], 1, (eItemRemoveType)5);
                                num3 = i;
                            }
                            bool flag24 = itemInfo3 != null;
                            if (flag24)
                            {
                                player.HideBag.RemoveCountFromStack(itemInfo3, 1, (eItemRemoveType)5);
                            }
                            bool flag25 = itemInfo2 != null;
                            if (flag25)
                            {
                                player.HideBag.RemoveCountFromStack(itemInfo2, 1, (eItemRemoveType)5);
                            }
                            bool flag26 = flag17;
                            if (flag26)
                            {
                                num2 *= 1.0 + 0.1 * (double)consortiaInfo.SmithLevel;
                            }
                            itemInfo.IsBinds = flag5;
                            int  num4   = 1;
                            bool flag27 = num2 > (double)ItemStrengthenHandler.random.Next(10000);
                            if (flag27)
                            {
                                num4 = 0;
                                bool flag28 = strengthenGoodsInfo != null && itemInfo4 != null;
                                if (flag28)
                                {
                                    StrengthenMgr.InheritProperty(itemInfo, itemInfo4);
                                    itemInfo4.StrengthenLevel = (itemInfo.StrengthenLevel + 1);
                                    player.HideBag.RemoveItem(itemInfo, (eItemRemoveType)5);
                                    player.HideBag.AddItemTo(itemInfo4, 5);
                                    text     = string.Format("temp_place_{0}", itemInfo.ItemID);
                                    itemInfo = itemInfo4;
                                    bool flag29 = itemInfo.ItemID == 0;
                                    if (flag29)
                                    {
                                        using (PlayerBussiness playerBussiness = new PlayerBussiness())
                                        {
                                            playerBussiness.AddGoods(itemInfo);
                                        }
                                    }
                                }
                                else
                                {
                                    ItemInfo itemInfo5 = itemInfo;
                                    num3 = itemInfo5.StrengthenLevel;
                                    itemInfo5.StrengthenLevel = (num3 + 1);
                                }
                                player.OnItemStrengthen(itemInfo.Template.CategoryID, itemInfo.StrengthenLevel);
                                bool flag30 = itemInfo.StrengthenLevel >= 7;
                                if (flag30)
                                {
                                    string translation = LanguageMgr.GetTranslation("ItemStrengthenHandler.congratulation", new object[]
                                    {
                                        player.PlayerCharacter.NickName,
                                        itemInfo.StrengthenLevel
                                    });
                                    GSPacketIn packet2 = WorldMgr.SendSysNotice(translation, itemInfo, player);
                                    GameServer.Instance.LoginServer.SendPacket(packet2);
                                }
                            }
                            else
                            {
                                num4 = 1;
                                bool flag31 = !flag7;
                                if (flag31)
                                {
                                    StrengthenGoodsInfo strengthenGoodsInfo2 = StrengthenMgr.FindStrengthenFailGoodsInfo(itemInfo.StrengthenLevel, itemInfo.TemplateID);
                                    itemInfo.StrengthenLevel = ((itemInfo.StrengthenLevel == 0) ? 0 : (itemInfo.StrengthenLevel - 1));
                                    bool flag32 = strengthenGoodsInfo2 != null;
                                    if (flag32)
                                    {
                                        ItemInfo itemInfo6 = ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(strengthenGoodsInfo2.CurrentEquip), 1, 116);
                                        bool     flag33    = itemInfo6 == null;
                                        if (flag33)
                                        {
                                            num    = 0;
                                            result = num;
                                            return(result);
                                        }
                                        StrengthenMgr.InheritProperty(itemInfo, itemInfo6);
                                        itemInfo6.StrengthenLevel = (itemInfo.StrengthenLevel);
                                        player.HideBag.RemoveItem(itemInfo, (eItemRemoveType)5);
                                        player.HideBag.AddItemTo(itemInfo6, 5);
                                    }
                                }
                            }
                            player.HideBag.UpdateItem(itemInfo);
                            gSPacketIn.WriteByte((byte)num4);
                            gSPacketIn.WriteBoolean(itemInfo.IsOpenHole);
                            player.RemoveGold(pRICE_STRENGHTN_GOLD);
                            //LogMgr.LogItemAdd(player.PlayerCharacter.ID, 1, propertyString, itemInfo, stringBuilder.ToString(), (num4 == 1) ? 0 : 1);
                        }
                        finally
                        {
                            player.HideBag.CommitChanges();
                            player.Out.SendTCP(gSPacketIn);
                        }
                        player.SaveIntoDatabase();
                        bool flag34 = text != null && player.TempProperties.ContainsKey(text);
                        if (flag34)
                        {
                            int num5 = (int)player.TempProperties[text];
                            player.TempProperties.Remove(text);
                            text = string.Format("temp_place_{0}", itemInfo.ItemID);
                            player.TempProperties.Add(text, num5);
                        }
                    }
                    else
                    {
                        player.Out.SendMessage(0, LanguageMgr.GetTranslation("ItemStrengthenHandler.Content1", new object[0]) + 1 + LanguageMgr.GetTranslation("ItemStrengthenHandler.Content2", new object[0]));
                    }
                }
                else
                {
                    player.Out.SendMessage(0, LanguageMgr.GetTranslation("ItemStrengthenHandler.Success", new object[0]));
                }
                num = 0;
            }
            result = num;
            return(result);
        }
Esempio n. 11
0
        //private static readonly double[] rateItems = new double[] { 0.75, 3, 12, 48, 240, 768 };
        //public static int countConnect = 0;
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            //if (countConnect >= 3000)
            //{
            //    client.Disconnect();
            //    return 0;
            //}
            StringBuilder str           = new StringBuilder();
            bool          isBinds       = false;
            bool          consortia     = packet.ReadBoolean();
            bool          MultiSelected = packet.ReadBoolean();

            GSPacketIn pkg = packet.Clone();

            pkg.ClearContext();

            List <ItemInfo> stones = new List <ItemInfo>();
            ItemInfo        stone  = client.Player.StoreBag2.GetItemAt(0);
            ItemInfo        item   = client.Player.StoreBag2.GetItemAt(1);

            //ItemInfo luck = null;
            //ItemInfo god = null;
            string BeginProperty = null;
            string AddItem       = "";

            using (ItemRecordBussiness db = new ItemRecordBussiness())
            {
                db.PropertyString(item, ref BeginProperty);
            }

            if (item != null && item.Template.CanStrengthen && item.Template.CategoryID < 18 && item.Count == 1)
            {
                isBinds = isBinds ? true : item.IsBinds;
                str.Append(item.ItemID + ":" + item.TemplateID + ",");
                double exp1     = 0;
                double exp2     = 0;
                double exp3     = 0;
                double totalExp = 0;

                if (stone != null && stone.Template.CategoryID == 11 && (stone.Template.Property1 == 2 || stone.Template.Property1 == 35))
                {
                    isBinds  = isBinds ? true : stone.IsBinds;
                    AddItem += "," + stone.ItemID.ToString() + ":" + stone.Template.Name;
                    stones.Add(stone);
                    exp1 += stone.Template.Property2;
                }

                bool          ConsortiaRate = false;
                ConsortiaInfo info          = ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);
                //判断是公会铁匠铺还是铁匠铺??
                if (consortia)
                {
                    ConsortiaBussiness        csbs    = new ConsortiaBussiness();
                    ConsortiaEquipControlInfo cecInfo = csbs.GetConsortiaEuqipRiches(client.Player.PlayerCharacter.ConsortiaID, 0, 2);

                    if (info == null)
                    {
                        client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemStrengthenHandler.Fail"));
                    }
                    else
                    {
                        if (client.Player.PlayerCharacter.Riches < cecInfo.Riches)
                        {
                            client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("ItemStrengthenHandler.FailbyPermission"));
                            return(1);
                        }
                        ConsortiaRate = true;
                    }
                }
                if (ConsortiaRate)
                {
                    //ConsortiaRateManager.instance.getConsortiaStrengthenEx(PlayerManager.Instance.Self.consortiaInfo.SmithLevel)
                    //"ConsortiaStrengthenEx" Value="10|20|30|40|50|60|70|80|90|100"
                    List <double> ConsortiaStrengthenEx = new List <double> {
                        10, 20, 30, 40, 50, 60, 70, 80, 90, 100
                    };
                    exp2 = ConsortiaStrengthenEx[info.SmithLevel - 1] / 100 * exp1;
                }
                if (client.Player.PlayerCharacter.VIPExpireDay >= DateTime.Now)
                {
                    //_loc_4 = VipController.instance.getVIPStrengthenEx(PlayerManager.Instance.Self.VIPLevel)
                    //"VIPStrengthenEx" Value="25|25|25|35|35|50|50|50|50|50|50|50"
                    List <double> VIPStrengthenEx = new List <double> {
                        25, 25, 25, 35, 35, 50, 50, 50, 50, 50, 50, 50
                    };
                    exp3 = VIPStrengthenEx[client.Player.PlayerCharacter.VIPLevel - 1] / 100 * exp1;
                }
                totalExp += Math.Floor(exp1 + exp2 + exp3);
                str.Append("true");
                List <int> StrengThenExp = new List <int> {
                    0, 10, 50, 150, 350, 700, 1500, 2300, 3300, 4500, 6000, 7500, 9000
                };

                //Console.WriteLine("-------Total: " + stone.Count.ToString() + "| Inject: " + MultiSelected);
                if (MultiSelected)// && stone.Count > 1)
                {
                    //for (int i = 0; i < stone.Count; i++)
                    //{
                    item.StrengthenExp += (int)totalExp * stone.Count;
                    client.Player.StoreBag2.RemoveTemplate(stone.TemplateID, stone.Count);
                    //}
                }
                else
                {
                    item.StrengthenExp += (int)totalExp;
                    client.Player.StoreBag2.RemoveTemplate(stone.TemplateID, 1);
                }

                if (item.StrengthenExp >= StrengThenExp[item.StrengthenLevel + 1])
                {
                    //for (int a = StrengThenExp[item.StrengthenLevel]; a < item.StrengthenExp; a++)
                    int a = StrengThenExp[item.StrengthenLevel];
                    do
                    {
                        if (item.StrengthenLevel < 13)
                        {
                            if (item.StrengthenExp >= StrengThenExp[item.StrengthenLevel + 1])
                            {
                                item.StrengthenLevel++;
                                item.StrengthenExp -= StrengThenExp[item.StrengthenLevel];
                                a = StrengThenExp[item.StrengthenLevel];
                            }
                            else
                            {
                                break;
                            }
                        }
                    }while (item.StrengthenExp > a);
                    if (item.StrengthenLevel == 12 && (item.StrengthenExp / totalExp) > 0)
                    {
                        stone.Count = (int)Math.Floor(item.StrengthenExp / totalExp);
                        client.Player.StoreBag2.AddItemTo(stone, 0);
                        client.Player.StoreBag2.UpdateItem(stone);
                        //if (item.StrengthenLevel == 12)
                        item.StrengthenExp = 0;
                    }
                    pkg.WriteByte(1);

                    StrengthenGoodsInfo strengthenGoodsInfo = StrengthenMgr.FindStrengthenGoodsInfo(item.StrengthenLevel, item.TemplateID);
                    if (strengthenGoodsInfo != null && item.Template.CategoryID == 7)
                    {
                        ItemTemplateInfo Temp = Bussiness.Managers.ItemMgr.FindItemTemplate(strengthenGoodsInfo.GainEquip);
                        if (Temp != null)
                        {
                            ItemInfo newItem = ItemInfo.CreateFromTemplate(Temp, 1, (int)ItemAddType.Strengthen);
                            newItem.StrengthenLevel = item.StrengthenLevel;
                            newItem.StrengthenExp   = item.StrengthenExp;
                            ItemInfo.OpenHole(ref newItem);
                            StrengthenMgr.InheritProperty(item, ref newItem);
                            client.Player.StoreBag2.RemoveItemAt(1);
                            client.Player.StoreBag2.AddItemTo(newItem, 1);
                            //client.Player.StoreBag2.UpdateItem(newItem);
                            item = newItem;
                            if ((item.StrengthenLevel == 3 || item.StrengthenLevel == 6 || item.StrengthenLevel == 9 || item.StrengthenLevel == 12) && item.Template.CategoryID != 17)
                            {
                                pkg.WriteBoolean(true);
                            }
                            else
                            {
                                pkg.WriteBoolean(false);
                            }
                        }
                    }
                    else
                    {
                        ItemInfo.OpenHole(ref item);
                        //client.Player.StoreBag2.AddItemTo(item, 1);
                        if ((item.StrengthenLevel == 3 || item.StrengthenLevel == 6 || item.StrengthenLevel == 9 || item.StrengthenLevel == 12) && item.Template.CategoryID != 17)
                        {
                            pkg.WriteBoolean(true);
                        }
                        else
                        {
                            pkg.WriteBoolean(false);
                        }
                    }

                    //系统广播
                    if (item.StrengthenLevel >= 7)
                    {
                        string     msg        = LanguageMgr.GetTranslation("ItemStrengthenHandler.congratulation", client.Player.PlayerCharacter.NickName, item.Template.Name, item.StrengthenLevel);
                        GSPacketIn sys_notice = WorldMgr.SendSysNotice(msg);
                        GameServer.Instance.LoginServer.SendPacket(sys_notice);
                    }
                }
                else
                {
                    pkg.WriteByte(1);
                    pkg.WriteBoolean(false);
                }

                client.Player.StoreBag2.UpdateItem(item);
                client.Player.OnItemStrengthen(item.Template.CategoryID, item.StrengthenLevel);                               //任务<强化>
                LogMgr.LogItemAdd(client.Player.PlayerCharacter.ID, LogItemType.Strengthen, BeginProperty, item, AddItem, 1); //强化日志

                //client.Player.SaveIntoDatabase();//保存到数据库
                client.Out.SendTCP(pkg);
                str.Append(item.StrengthenLevel);
                //client.Player.BeginChanges();
                //client.Player.CommitChanges();
            }
            else
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemStrengthenHandler.Content1") + stone.Template.Name + LanguageMgr.GetTranslation("ItemStrengthenHandler.Content2"));
            }
            if (item.Place < 31)
            {
                client.Player.MainBag.UpdatePlayerProperties();
            }

            return(0);
        }
Esempio n. 12
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            StringBuilder stringBuilder = new StringBuilder();
            bool          flag          = false;
            bool          flag2         = packet.ReadBoolean();
            bool          flag3         = packet.ReadBoolean();
            GSPacketIn    gSPacketIn    = new GSPacketIn(59, client.Player.PlayerCharacter.ID);
            ItemInfo      itemAt        = client.Player.StoreBag.GetItemAt(0);
            ItemInfo      itemInfo      = client.Player.StoreBag.GetItemAt(1);
            int           num           = 1;
            string        beginProperty = null;
            string        text          = "";

            using (ItemRecordBussiness itemRecordBussiness = new ItemRecordBussiness())
            {
                itemRecordBussiness.PropertyString(itemInfo, ref beginProperty);
            }
            if (itemInfo != null && itemInfo.Template.CanStrengthen && itemInfo.Template.CategoryID < 18 && itemInfo.Count == 1)
            {
                flag = (flag || itemInfo.IsBinds);
                stringBuilder.Append(string.Concat(new object[]
                {
                    itemInfo.ItemID,
                    ":",
                    itemInfo.TemplateID,
                    ","
                }));
                double num2            = 0.0;
                double num3            = 0.0;
                double num4            = 0.0;
                int    strengthenExp   = itemInfo.StrengthenExp;
                int    strengthenLevel = itemInfo.StrengthenLevel;
                if (strengthenLevel >= 12)
                {
                    client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("Level đã đạt cấp độ cao nhất, không thể cường hóa!", new object[0]));
                    return(0);
                }
                bool          flag4         = false;
                ConsortiaInfo consortiaInfo = ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);
                if (flag2)
                {
                    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);
                        }
                        flag4 = true;
                    }
                }
                if (itemAt != null && itemAt.Template.CategoryID == 11 && (itemAt.Template.Property1 == 2 || itemAt.Template.Property1 == 35))
                {
                    flag = (flag || itemAt.IsBinds);
                    string text2 = text;
                    text = string.Concat(new string[]
                    {
                        text2,
                        ",",
                        itemAt.ItemID.ToString(),
                        ":",
                        itemAt.Template.Name
                    });
                    int num5 = (itemAt.Template.Property2 < 10) ? 10 : itemAt.Template.Property2;
                    if (flag4)
                    {
                        int    smithLevel = consortiaInfo.SmithLevel;
                        double num6       = (double)GameProperties.ConsortiaStrengExp(smithLevel - 1);
                        num3 = num6 * (double)num5 / 100.0;
                    }
                    if (client.Player.PlayerCharacter.VIPExpireDay.Date >= DateTime.Now.Date)
                    {
                        int    vIPLevel = client.Player.PlayerCharacter.VIPLevel;
                        double num7     = (double)GameProperties.VIPStrengthenExp(vIPLevel - 1);
                        num4 = num7 * (double)num5 / 100.0;
                    }
                    num5 += (int)num3 + (int)num4;
                    if (flag3)
                    {
                        int needExp = StrengthenMgr.getNeedExp(strengthenExp, strengthenLevel);
                        num = this.CalculatorCount(needExp, num5);
                        if (num > itemAt.Count)
                        {
                            num = itemAt.Count;
                        }
                        num2 += (double)(num5 * num);
                    }
                    else
                    {
                        num2 += (double)num5;
                    }
                }
                stringBuilder.Append("true");
                int num8 = (int)num2 + strengthenExp;
                if (StrengthenMgr.canUpLv(num8, strengthenLevel))
                {
                    itemInfo.StrengthenLevel++;
                    itemInfo.StrengthenExp = num8 - StrengthenMgr.FindStrengthenExpInfo(strengthenLevel + 1).Exp;
                    gSPacketIn.WriteByte(1);
                    StrengthenGoodsInfo strengthenGoodsInfo = StrengthenMgr.FindStrengthenGoodsInfo(itemInfo.StrengthenLevel, itemInfo.TemplateID);
                    if (strengthenGoodsInfo != null && itemInfo.Template.CategoryID == 7 && strengthenGoodsInfo.GainEquip > itemInfo.TemplateID)
                    {
                        ItemTemplateInfo itemTemplateInfo = ItemMgr.FindItemTemplate(strengthenGoodsInfo.GainEquip);
                        if (itemTemplateInfo != null)
                        {
                            ItemInfo itemInfo2 = ItemInfo.CreateFromTemplate(itemTemplateInfo, 1, 116);
                            itemInfo2.StrengthenLevel = itemInfo.StrengthenLevel;
                            itemInfo2.StrengthenExp   = itemInfo.StrengthenExp;
                            StrengthenMgr.InheritProperty(itemInfo, ref itemInfo2);
                            client.Player.StoreBag.RemoveItemAt(1);
                            client.Player.StoreBag.AddItemTo(itemInfo2, 1);
                            itemInfo = itemInfo2;
                        }
                    }
                    if (itemInfo.StrengthenLevel == 10 || itemInfo.StrengthenLevel == 12)
                    {
                        string translation = LanguageMgr.GetTranslation("ItemStrengthenHandler.congratulation", new object[]
                        {
                            client.Player.PlayerCharacter.NickName,
                            itemInfo.Template.Name,
                            itemInfo.StrengthenLevel
                        });
                        client.Player.SendAllMessage(translation);
                    }
                }
                else
                {
                    itemInfo.StrengthenExp = num8;
                }
                client.Player.StoreBag.RemoveTemplate(itemAt.TemplateID, num);
                client.Player.StoreBag.UpdateItem(itemInfo);
                client.Player.OnItemStrengthen(itemInfo.Template.CategoryID, itemInfo.StrengthenLevel);
                LogMgr.LogItemAdd(client.Player.PlayerCharacter.ID, LogItemType.Strengthen, beginProperty, itemInfo, text, 1);
                gSPacketIn.WriteBoolean(false);
                client.Out.SendTCP(gSPacketIn);
                stringBuilder.Append(itemInfo.StrengthenLevel);
            }
            else
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemStrengthenHandler.Content1", new object[0]) + itemAt.Template.Name + LanguageMgr.GetTranslation("ItemStrengthenHandler.Content2", new object[0]));
            }
            if (itemInfo.Place < 31)
            {
                client.Player.MainBag.UpdatePlayerProperties();
            }
            return(0);
        }
Esempio n. 13
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (countConnect >= 3000)
            {
                client.Disconnect();
                return(0);
            }

            GSPacketIn pkg = packet.Clone();

            pkg.ClearContext();

            StringBuilder str      = new StringBuilder();
            bool          isBinds  = false;
            int           mustGold = GameProperties.PRICE_STRENGHTN_GOLD;

            if (client.Player.PlayerCharacter.Gold < mustGold)
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemStrengthenHandler.NoMoney"));
                return(0);
            }

            int luckPlace = 0;
            int godPlace  = 0;

            //int itemPlace = client.Player.TempBag.GetItemAt(0).ItemID ;
            //int luckPlace = packet.ReadInt();
            //int godPlace = packet.ReadInt();
            //int stone1Place = packet.ReadInt();
            //int stone2Place = packet.ReadInt();
            //int stone3Place = packet.ReadInt();
            bool consortia = packet.ReadBoolean();

            List <ItemInfo> stones        = new List <ItemInfo>();
            ItemInfo        item          = client.Player.StoreBag2.GetItemAt(5);
            ItemInfo        luck          = null;
            ItemInfo        god           = null;
            string          BeginProperty = null;
            string          AddItem       = "";

            using (ItemRecordBussiness db = new ItemRecordBussiness())
            {
                db.PropertyString(item, ref BeginProperty);
            }

            if (item != null && item.Template.CanStrengthen && item.Template.CategoryID < 18 && item.Count == 1)
            {
                isBinds = isBinds ? true : item.IsBinds;
                str.Append(item.ItemID + ":" + item.TemplateID + ",");
                ThreadSafeRandom random = new ThreadSafeRandom();
                int    result           = 1;
                double probability      = 0;
                bool   isGod            = false;

                StrengthenInfo      strengthenInfo;
                StrengthenGoodsInfo strengthenGoodsInfo = null;
                if (item.Template.RefineryLevel > 0)
                {
                    strengthenInfo = StrengthenMgr.FindRefineryStrengthenInfo(item.StrengthenLevel + 1);
                }
                else
                {
                    strengthenGoodsInfo = StrengthenMgr.FindStrengthenGoodsInfo(item.StrengthenLevel, item.TemplateID);
                    strengthenInfo      = StrengthenMgr.FindStrengthenInfo(item.StrengthenLevel + 1);
                }
                if (strengthenInfo == null)
                {
                    client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemStrengthenHandler.NoStrength"));
                    return(0);
                }

                if (client.Player.StoreBag2.GetItemAt(3) != null)
                {
                    god      = client.Player.StoreBag2.GetItemAt(3);
                    AddItem += "," + god.ItemID.ToString() + ":" + god.Template.Name;
                    if (god != null && god.Template.CategoryID == 11 && god.Template.Property1 == 7)
                    {
                        isBinds = isBinds ? true : god.IsBinds;
                        str.Append(god.ItemID + ":" + god.TemplateID + ",");
                        isGod = true;
                    }
                    else
                    {
                        god = null;
                    }
                }

                ItemInfo stone1 = client.Player.StoreBag2.GetItemAt(0);
                if (stone1 != null && stone1.Template.CategoryID == 11 && (stone1.Template.Property1 == 2 || stone1.Template.Property1 == 35) && !stones.Contains(stone1))
                {
                    isBinds  = isBinds ? true : stone1.IsBinds;
                    AddItem += "," + stone1.ItemID.ToString() + ":" + stone1.Template.Name;
                    stones.Add(stone1);
                    probability += stone1.Template.Property2;
                }

                ItemInfo stone2 = client.Player.StoreBag2.GetItemAt(1);
                if (stone2 != null && stone2.Template.CategoryID == 11 && (stone2.Template.Property1 == 2 || stone2.Template.Property1 == 35) && !stones.Contains(stone2))
                {
                    isBinds  = isBinds ? true : stone2.IsBinds;
                    AddItem += "," + stone2.ItemID.ToString() + ":" + stone2.Template.Name;
                    stones.Add(stone2);
                    probability += stone2.Template.Property2;
                }

                ItemInfo stone3 = client.Player.StoreBag2.GetItemAt(2);
                if (stone3 != null && stone3.Template.CategoryID == 11 && (stone3.Template.Property1 == 2 || stone3.Template.Property1 == 35) && !stones.Contains(stone3))
                {
                    isBinds  = isBinds ? true : stone3.IsBinds;
                    AddItem += "," + stone3.ItemID + ":" + stone3.Template.Name;
                    stones.Add(stone3);
                    probability += stone3.Template.Property2;
                }
                bool RefineryStrengthen = false;

                foreach (ItemInfo stoneinfo in stones)
                {
                    if (stoneinfo.Template.Property1 == 35 && stoneinfo.Template.CategoryID == 11)
                    {
                        RefineryStrengthen = true;
                    }
                    else
                    {
                        RefineryStrengthen = false;
                    }
                }

                //if (!RefineryStrengthen && item.Template.RefineryLevel > 0)
                //{
                //    client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemStrengthenHandler.StoneMatch"));
                //    return 1;
                //}
                if (client.Player.StoreBag2.GetItemAt(4) != null)
                {
                    luck     = client.Player.StoreBag2.GetItemAt(4);
                    AddItem += "," + luck.ItemID.ToString() + ":" + luck.Template.Name;
                    if (luck != null && luck.Template.CategoryID == 11 && luck.Template.Property1 == 3)
                    {
                        isBinds = isBinds ? true : luck.IsBinds;
                        str.Append(luck.ItemID + ":" + luck.TemplateID + ",");
                        probability = probability * (luck.Template.Property2 + 100);
                    }
                    else
                    {
                        probability *= 100;
                        luck         = null;
                    }
                }
                else
                {
                    probability *= 100;
                }
                bool          CanUpdate = false;
                ConsortiaInfo info      = ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);
                //判断是公会铁匠铺还是铁匠铺??
                if (consortia)
                {
                    ConsortiaBussiness        csbs    = new ConsortiaBussiness();
                    ConsortiaEquipControlInfo cecInfo = csbs.GetConsortiaEuqipRiches(client.Player.PlayerCharacter.ConsortiaID, 0, 2);

                    if (info == null)
                    {
                        client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemStrengthenHandler.Fail"));
                    }
                    else
                    {
                        if (client.Player.PlayerCharacter.Riches < cecInfo.Riches)
                        {
                            client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("ItemStrengthenHandler.FailbyPermission"));
                            return(1);
                        }
                        CanUpdate = true;
                    }
                }

                if (stones.Count >= 1)
                {
                    probability = probability / strengthenInfo.Rock;
                    for (int i = 0; i < stones.Count; i++)
                    {
                        str.Append(stones[i].ItemID + ":" + stones[i].TemplateID + ",");

                        AbstractInventory bg = client.Player.GetItemInventory(stones[i].Template);
                        stones[i].Count--;
                        bg.UpdateItem(stones[i]);
                    }

                    if (luck != null)
                    {
                        AbstractInventory bg = client.Player.GetItemInventory(luck.Template);
                        bg.RemoveItem(luck);
                    }

                    if (god != null)
                    {
                        AbstractInventory bg = client.Player.GetItemInventory(god.Template);
                        bg.RemoveItem(god);
                    }
                    if (CanUpdate)
                    {
                        probability *= (1 + 0.1 * info.SmithLevel);
                    }
                    item.IsBinds = isBinds;

                    client.Player.StoreBag2.ClearBag();
                    if (probability > random.Next(10000))
                    {
                        str.Append("true");
                        pkg.WriteByte(0);
                        if (strengthenGoodsInfo != null)
                        {
                            ItemTemplateInfo Temp = Bussiness.Managers.ItemMgr.FindItemTemplate(strengthenGoodsInfo.GainEquip);
                            if (Temp != null)
                            {
                                ItemInfo Item = ItemInfo.CreateFromTemplate(Temp, 1, (int)ItemAddType.Strengthen);
                                Item.StrengthenLevel = item.StrengthenLevel + 1;


                                ItemInfo.OpenHole(ref Item);
                                StrengthenMgr.InheritProperty(item, ref Item);

                                client.Player.RemoveItem(item);
                                client.Player.AddTemplate(Item, Item.Template.BagType, Item.Count);
                                item = Item;
                                pkg.WriteBoolean(false);
                            }
                        }
                        else
                        {
                            pkg.WriteBoolean(true);
                            item.StrengthenLevel++;
                            ItemInfo.OpenHole(ref item);
                            //client.Player.MainBag.AddItem(item);
                            client.Player.StoreBag2.AddItemTo(item, 5);
                        }



                        client.Player.OnItemStrengthen(item.Template.CategoryID, item.StrengthenLevel);                               //任务<强化>
                        LogMgr.LogItemAdd(client.Player.PlayerCharacter.ID, LogItemType.Strengthen, BeginProperty, item, AddItem, 1); //强化日志
                        client.Player.SaveIntoDatabase();                                                                             //保存到数据库
                        //系统广播
                        if (item.StrengthenLevel >= 7)
                        {
                            string msg = LanguageMgr.GetTranslation("ItemStrengthenHandler.congratulation", client.Player.PlayerCharacter.NickName, item.Template.Name, item.StrengthenLevel);

                            GSPacketIn pkg1 = new GSPacketIn((byte)ePackageType.SYS_NOTICE);
                            pkg1.WriteInt(1);
                            pkg1.WriteString(msg);

                            GameServer.Instance.LoginServer.SendPacket(pkg1);

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

                            foreach (GamePlayer p in players)
                            {
                                p.Out.SendTCP(pkg1);
                            }
                        }
                    }
                    else
                    {
                        str.Append("false");
                        pkg.WriteByte(1);
                        pkg.WriteBoolean(false);
                        if (isGod == false)
                        {
                            if (item.Template.Level == 3)
                            {
                                item.StrengthenLevel = item.StrengthenLevel == 0 ? 0 : item.StrengthenLevel - 1;
                                // client.Player.MainBag.AddItem(item);
                                client.Player.StoreBag2.AddItemTo(item, 5);
                            }
                            else
                            {
                                item.Count--;
                                // client.Player.MainBag.AddItem(item);
                                client.Player.StoreBag2.AddItemTo(item, 5);
                            }
                        }
                        else
                        {
                            //client.Player.MainBag.AddItem(item);
                            client.Player.StoreBag2.AddItemTo(item, 5);
                        }
                        LogMgr.LogItemAdd(client.Player.PlayerCharacter.ID, LogItemType.Strengthen, BeginProperty, item, AddItem, 0);

                        client.Player.SaveIntoDatabase();//保存到数据库
                    }

                    client.Out.SendTCP(pkg);
                    str.Append(item.StrengthenLevel);
                    client.Player.BeginChanges();
                    client.Player.RemoveGold(mustGold);
                    client.Player.CommitChanges();
                }
                else
                {
                    client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemStrengthenHandler.Content1") + result + LanguageMgr.GetTranslation("ItemStrengthenHandler.Content2"));
                }
                if (item.Place < 31)
                {
                    client.Player.MainBag.UpdatePlayerProperties();
                }
            }
            else
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemStrengthenHandler.Success"));
            }

            return(0);
        }
Esempio n. 14
0
        ///// <summary>
        /////查找商品
        ///// </summary>
        ///// <param name="shopID"></param>
        ///// <param name="itemID"></param>
        ///// <returns></returns>
        //public static bool FindShop(int GoodsID)
        //{
        //    if (m_shop.ContainsKey(GoodsID))
        //    {
        //        return true;
        //    }
        //    return false;
        //}
        /// <summary>
        /// 判断玩家是否可以购买此商品
        /// </summary>
        /// <param name="shopID"></param>
        /// <param name="ItemID"></param>
        /// <param name="isBinds"></param>
        /// <param name="player"></param>
        /// <returns></returns>
        public static bool CanBuy(int shopID, int consortiaShopLevel, ref bool isBinds, int cousortiaID, int playerRiches)
        {
            bool result = false;
            ConsortiaEquipControlInfo cecInfo = null;

            using (ConsortiaBussiness csbs = new ConsortiaBussiness())
            {
                switch (shopID)
                {
                case 1:                                //普通
                    result  = true;
                    isBinds = false;
                    break;

                case 2:                                //战斗商城
                    result  = true;
                    isBinds = false;
                    break;

                case 3:                                //礼券
                    result  = true;
                    isBinds = false;
                    break;

                case 4:                                //牌子
                    result  = true;
                    isBinds = false;
                    break;

                case 11:
                    cecInfo = csbs.GetConsortiaEuqipRiches(cousortiaID, 1, 1);
                    if (consortiaShopLevel >= cecInfo.Level && playerRiches >= cecInfo.Riches)
                    {
                        result  = true;
                        isBinds = true;
                    }
                    break;

                case 12:
                    cecInfo = csbs.GetConsortiaEuqipRiches(cousortiaID, 2, 1);
                    if (consortiaShopLevel >= cecInfo.Level && playerRiches >= cecInfo.Riches)
                    {
                        result  = true;
                        isBinds = true;
                    }
                    break;

                case 13:
                    cecInfo = csbs.GetConsortiaEuqipRiches(cousortiaID, 3, 1);
                    if (consortiaShopLevel >= cecInfo.Level && playerRiches >= cecInfo.Riches)
                    {
                        result  = true;
                        isBinds = true;
                    }
                    break;

                case 14:
                    cecInfo = csbs.GetConsortiaEuqipRiches(cousortiaID, 4, 1);
                    if (consortiaShopLevel >= cecInfo.Level && playerRiches >= cecInfo.Riches)
                    {
                        result  = true;
                        isBinds = true;
                    }
                    break;

                case 15:
                    cecInfo = csbs.GetConsortiaEuqipRiches(cousortiaID, 5, 1);
                    if (consortiaShopLevel >= cecInfo.Level && playerRiches >= cecInfo.Riches)
                    {
                        result  = true;
                        isBinds = true;
                    }
                    break;
                }
            }
            return(result);
        }
Esempio n. 15
0
        public static bool CanBuy(int shopID, int consortiaShopLevel, ref bool isBinds, int cousortiaID, int playerRiches)
        {
            bool flag = false;

            using (ConsortiaBussiness consortiaBussiness = new ConsortiaBussiness())
            {
                switch (shopID)
                {
                case 1:
                    flag    = true;
                    isBinds = false;
                    break;

                case 2:
                    flag    = true;
                    isBinds = false;
                    break;

                case 3:
                    flag    = true;
                    isBinds = false;
                    break;

                case 4:
                    flag    = true;
                    isBinds = false;
                    break;

                case 11:
                    ConsortiaEquipControlInfo consortiaEuqipRiches1 = consortiaBussiness.GetConsortiaEuqipRiches(cousortiaID, 1, 1);
                    if (consortiaShopLevel >= consortiaEuqipRiches1.Level && playerRiches >= consortiaEuqipRiches1.Riches)
                    {
                        flag    = true;
                        isBinds = true;
                        break;
                    }
                    else
                    {
                        break;
                    }

                case 12:
                    ConsortiaEquipControlInfo consortiaEuqipRiches2 = consortiaBussiness.GetConsortiaEuqipRiches(cousortiaID, 2, 1);
                    if (consortiaShopLevel >= consortiaEuqipRiches2.Level && playerRiches >= consortiaEuqipRiches2.Riches)
                    {
                        flag    = true;
                        isBinds = true;
                        break;
                    }
                    else
                    {
                        break;
                    }

                case 13:
                    ConsortiaEquipControlInfo consortiaEuqipRiches3 = consortiaBussiness.GetConsortiaEuqipRiches(cousortiaID, 3, 1);
                    if (consortiaShopLevel >= consortiaEuqipRiches3.Level && playerRiches >= consortiaEuqipRiches3.Riches)
                    {
                        flag    = true;
                        isBinds = true;
                        break;
                    }
                    else
                    {
                        break;
                    }

                case 14:
                    ConsortiaEquipControlInfo consortiaEuqipRiches4 = consortiaBussiness.GetConsortiaEuqipRiches(cousortiaID, 4, 1);
                    if (consortiaShopLevel >= consortiaEuqipRiches4.Level && playerRiches >= consortiaEuqipRiches4.Riches)
                    {
                        flag    = true;
                        isBinds = true;
                        break;
                    }
                    else
                    {
                        break;
                    }

                case 15:
                    ConsortiaEquipControlInfo consortiaEuqipRiches5 = consortiaBussiness.GetConsortiaEuqipRiches(cousortiaID, 5, 1);
                    if (consortiaShopLevel >= consortiaEuqipRiches5.Level && playerRiches >= consortiaEuqipRiches5.Riches)
                    {
                        flag    = true;
                        isBinds = true;
                        break;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            return(flag);
        }