public void SetResult(GS_ENHANCEITEM_ACK ACK)
    {
        ITEM itemFromItemID = NkUserInventory.GetInstance().GetItemFromItemID(ACK.i64ItemID);

        if (itemFromItemID == null)
        {
            NrCharUser nrCharUser = NrTSingleton <NkCharManager> .Instance.GetChar(1) as NrCharUser;

            if (nrCharUser == null)
            {
                return;
            }
            NkSoldierInfo soldierInfoFromSolID = nrCharUser.GetPersonInfo().GetSoldierInfoFromSolID(ACK.i64SolID);
            if (soldierInfoFromSolID != null)
            {
                itemFromItemID = soldierInfoFromSolID.GetEquipItemInfo().GetItemFromItemID(ACK.i64ItemID);
            }
        }
        if (itemFromItemID != null)
        {
            this.m_Item = itemFromItemID;
            this.m_itItem.SetItemTexture(this.m_Item);
            string name = NrTSingleton <ItemManager> .Instance.GetName(this.m_Item);

            this.m_lbItem.Text = ItemManager.RankTextColor(ACK.nCurRank) + name;
            this.m_dtItemBG.SetTexture("Win_I_Frame" + ItemManager.ChangeRankToString(ACK.nCurRank));
        }
        byte i8ReduceSuccess = ACK.i8ReduceSuccess;

        if (i8ReduceSuccess != 1 && i8ReduceSuccess != 2)
        {
            this.m_bSuccess = false;
            this.m_lbInfo.Hide(true);
        }
        else
        {
            if (ACK.nItemType != 10)
            {
                ReduceMainDlg reduceMainDlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.REDUCEMAIN_DLG) as ReduceMainDlg;

                if (reduceMainDlg != null)
                {
                    reduceMainDlg.UpdateData(ACK.nItemPos, ACK.nItemType, ACK.i64ItemID);
                }
            }
            int num = ACK.i32ITEMUPGRADE[8] - ACK.i32ITEMOPTION[8];
            if (0 > num)
            {
                num = 0;
            }
            NrTSingleton <CTextParser> .Instance.ReplaceParam(ref this.m_strMessage, new object[]
            {
                NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("982"),
                "Count",
                num
            });

            this.m_lbInfo.SetText(this.m_strMessage);
            this.m_bSuccess = true;
        }
        this.LoadSolComposeSuccessBundle();
    }
    public void SetData(GS_ENHANCEITEM_ACK pPacket)
    {
        NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.m_Money = pPacket.LeftMoney;
        ReforgeMainDlg reforgeMainDlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.REFORGEMAIN_DLG) as ReforgeMainDlg;

        ITEM item = NkUserInventory.GetInstance().GetItem(pPacket.nItemType, pPacket.nItemPos);

        if (item == null)
        {
            if (reforgeMainDlg == null)
            {
                return;
            }
            NrCharUser nrCharUser = NrTSingleton <NkCharManager> .Instance.GetChar(1) as NrCharUser;

            if (nrCharUser == null)
            {
                return;
            }
            NkSoldierInfo soldierInfoFromSolID = nrCharUser.GetPersonInfo().GetSoldierInfoFromSolID(reforgeMainDlg.GetSolID());
            if (soldierInfoFromSolID != null)
            {
                item = soldierInfoFromSolID.GetEquipItemInfo().GetItem(pPacket.nItemPos);
            }
        }
        this.m_Item = item;
        this.m_txItemAfter.SetItemTexture(item);
        string name = NrTSingleton <ItemManager> .Instance.GetName(item);

        this.m_lbItemAfterName.Text = ItemManager.RankTextColor(pPacket.nCurRank) + name;
        this.m_lbItemGrade.Text     = ItemManager.RankTextColor(pPacket.nCurRank) + ItemManager.RankText(pPacket.nCurRank);
        this.m_txItemBG.SetTexture("Win_I_Frame" + ItemManager.ChangeRankToString(pPacket.nCurRank));
        this.GetStatString(item.m_nItemUnique, pPacket);
        this.LoadSolComposeSuccessBundle();
        if (pPacket.i8ItemEnchantSuccess == 1 && pPacket.nLastRank < pPacket.nCurRank)
        {
            TsAudioManager.Container.RequestAudioClip("UI_SFX", "EQUIPMENT-UP", "SUCCESS", new PostProcPerItem(NrAudioClipDownloaded.OnEventAudioClipDownloadedImmedatePlay));
            this.m_bItemUpgradeSuccess = true;
            this.FacebookButtonSet(false);
            if (pPacket.nItemType != 10)
            {
                ReforgeSelectDlg reforgeSelectDlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.REFORGESELECT_DLG) as ReforgeSelectDlg;

                if (reforgeSelectDlg != null)
                {
                    reforgeSelectDlg.UpdateData(pPacket.nItemPos, pPacket.nItemType, pPacket.i64ItemID);
                }
            }
        }
        else
        {
            TsAudioManager.Container.RequestAudioClip("UI_SFX", "EQUIPMENT-UP", "FAIL", new PostProcPerItem(NrAudioClipDownloaded.OnEventAudioClipDownloadedImmedatePlay));
            this.m_bItemUpgradeSuccess = false;
            this.FacebookButtonSet(false);
        }
        TsLog.Log("Packet SolID ={0}", new object[]
        {
            pPacket.i64SolID
        });
        if (reforgeMainDlg != null)
        {
            reforgeMainDlg.bSendRequest = false;
        }
    }
Exemple #3
0
    public void SetData(GS_ENHANCEITEM_ACK pPacket)
    {
        base.SetShowLayer(2, false);
        int skillUnique  = pPacket.i32ITEMUPGRADE[4];
        int num          = pPacket.i32ITEMUPGRADE[5];
        int num2         = pPacket.i32ITEMUPGRADE[2];
        int num3         = pPacket.i32ITEMUPGRADE[2];
        int skillUnique2 = pPacket.i32ITEMOPTION[4];
        int num4         = pPacket.i32ITEMOPTION[5];

        this.m_SelectItem = NkUserInventory.GetInstance().GetItem(pPacket.nItemType, pPacket.nItemPos);
        if (this.m_SelectItem == null)
        {
            ItemSkill_Dlg itemSkill_Dlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.ITEMSKILL_DLG) as ItemSkill_Dlg;

            if (itemSkill_Dlg == null)
            {
                this.CloseForm(null);
                return;
            }
            NrCharUser nrCharUser = NrTSingleton <NkCharManager> .Instance.GetChar(1) as NrCharUser;

            if (nrCharUser == null)
            {
                return;
            }
            NkSoldierInfo soldierInfoFromSolID = nrCharUser.GetPersonInfo().GetSoldierInfoFromSolID(itemSkill_Dlg.GetItemSelectSolID());
            if (soldierInfoFromSolID != null)
            {
                this.m_SelectItemSolID = itemSkill_Dlg.GetItemSelectSolID();
                this.m_SelectItem      = soldierInfoFromSolID.GetEquipItemInfo().GetItem(pPacket.nItemPos);
            }
        }
        this.m_txItemSlotBG.SetTexture("Win_I_Frame" + ItemManager.ChangeRankToString((int)this.m_SelectItem.GetRank()));
        string name = NrTSingleton <ItemManager> .Instance.GetName(this.m_SelectItem);

        this.m_itxItem.SetItemTexture(this.m_SelectItem);
        this.m_lbItemName.SetText(name);
        this.m_lbItemStat.SetText(string.Empty);
        this.m_lbItemStat_before.SetText(string.Empty);
        this.m_bItemSkillSuccess = (pPacket.nAddSkillSuccess == 1);
        string           empty           = string.Empty;
        BATTLESKILL_BASE battleSkillBase = NrTSingleton <BattleSkill_Manager> .Instance.GetBattleSkillBase(skillUnique);

        BATTLESKILL_BASE battleSkillBase2 = NrTSingleton <BattleSkill_Manager> .Instance.GetBattleSkillBase(skillUnique2);

        if (battleSkillBase != null && this.m_bItemSkillSuccess)
        {
            NrTSingleton <CTextParser> .Instance.ReplaceParam(ref empty, new object[]
            {
                NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("1218"),
                "targetname",
                NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface(battleSkillBase.m_strTextKey),
                "skilllevel",
                num
            });

            this.m_lbItemStat.SetText(empty);
            if (pPacket.nItemType != 10)
            {
                ItemSkill_Dlg itemSkill_Dlg2 = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.ITEMSKILL_DLG) as ItemSkill_Dlg;

                if (itemSkill_Dlg2 != null)
                {
                    itemSkill_Dlg2.UpdateData(pPacket.nItemPos, pPacket.nItemType, pPacket.i64ItemID);
                }
            }
            if (COMMON_CONSTANT_Manager.GetInstance().GetValue(eCOMMON_CONSTANT.eCOMMON_CONSTANT_TRADECOUNT_USE) == 1)
            {
                NrTSingleton <CTextParser> .Instance.ReplaceParam(ref empty, new object[]
                {
                    NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2127"),
                    "count",
                    pPacket.i32ITEMUPGRADE[7]
                });

                this.m_lbTradeCount.SetText(empty);
            }
            else
            {
                this.m_lbTradeCount.SetText(string.Empty);
            }
            if (battleSkillBase2 != null)
            {
                this.m_btnUndo.Visible = true;
                NrTSingleton <CTextParser> .Instance.ReplaceParam(ref empty, new object[]
                {
                    NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("1218"),
                    "targetname",
                    NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface(battleSkillBase2.m_strTextKey),
                    "skilllevel",
                    num4
                });

                this.m_lbItemStat_before.SetText(empty);
                if (COMMON_CONSTANT_Manager.GetInstance().GetValue(eCOMMON_CONSTANT.eCOMMON_CONSTANT_TRADECOUNT_USE) == 1)
                {
                    NrTSingleton <CTextParser> .Instance.ReplaceParam(ref empty, new object[]
                    {
                        NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("2127"),
                        "count",
                        pPacket.i32ITEMOPTION[7]
                    });

                    this.m_lbTradeCount_before.SetText(empty);
                }
                else
                {
                    this.m_lbTradeCount_before.SetText(string.Empty);
                }
            }
            else
            {
                this.m_lbTradeCount_before.SetText(string.Empty);
                this.m_lbItemStat_before.SetText(string.Empty);
                this.m_btnUndo.Visible = false;
            }
        }
        else
        {
            this.m_lbTradeCount.SetText(string.Empty);
            this.m_btnUndo.Visible = false;
        }
        if (num2 != num3)
        {
            this.m_lbItemStat.SetText(NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("1219"));
            Main_UI_SystemMessage.ADDMessage(NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("269"));
        }
        this.LoadSolComposeSuccessBundle();
    }
    private void GetStatString(int ItemUnique, GS_ENHANCEITEM_ACK pPacket)
    {
        StringBuilder stringBuilder  = new StringBuilder();
        StringBuilder stringBuilder2 = new StringBuilder();
        string        text           = string.Empty;
        string        textColor      = NrTSingleton <CTextParser> .Instance.GetTextColor("1011");

        string textColor2 = NrTSingleton <CTextParser> .Instance.GetTextColor("1401");

        string textColor3 = NrTSingleton <CTextParser> .Instance.GetTextColor("1304");

        if (NrTSingleton <ItemManager> .Instance.GetItemPartByItemUnique(ItemUnique) == eITEM_PART.ITEMPART_WEAPON)
        {
            int num          = Protocol_Item.Get_Min_Damage(ItemUnique, 0);
            int optionValue  = Tooltip_Dlg.GetOptionValue(ItemUnique, pPacket.i32ITEMOPTION[0], num, 1);
            int nValue       = Protocol_Item.Get_Max_Damage(ItemUnique, 0);
            int optionValue2 = Tooltip_Dlg.GetOptionValue(ItemUnique, pPacket.i32ITEMOPTION[0], nValue, 1);
            stringBuilder.AppendLine(textColor + NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("242") + NrTSingleton <UIDataManager> .Instance.GetString(" ", optionValue.ToString(), " ~ ", optionValue2.ToString()));
            int num2         = Protocol_Item.Get_Min_Damage(ItemUnique, 0);
            int optionValue3 = Tooltip_Dlg.GetOptionValue(ItemUnique, pPacket.i32ITEMUPGRADE[0], num2, 1);
            int nValue2      = Protocol_Item.Get_Max_Damage(ItemUnique, 0);
            int optionValue4 = Tooltip_Dlg.GetOptionValue(ItemUnique, pPacket.i32ITEMUPGRADE[0], nValue2, 1);
            int num3         = optionValue3 - optionValue;
            int num4         = optionValue4 - optionValue2;
            if (num4 != 0)
            {
                text = ((num4 <= 0) ? textColor2 : textColor3) + NrTSingleton <UIDataManager> .Instance.GetString("(", ((num3 <= 0) ? string.Empty : "+") + num3.ToString(), " ~ ", ((num4 <= 0) ? string.Empty : "+") + num4.ToString(), ")");
            }
            stringBuilder2.AppendLine(string.Concat(new string[]
            {
                textColor,
                NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("242"),
                NrTSingleton <UIDataManager> .Instance.GetString(" ", optionValue3.ToString(), " ~ ", optionValue4.ToString()),
                " ",
                text
            }));
            text        = string.Empty;
            num         = Protocol_Item.Get_Critical_Plus(ItemUnique, 0);
            optionValue = Tooltip_Dlg.GetOptionValue(ItemUnique, pPacket.i32ITEMOPTION[1], num, 3);
            stringBuilder.AppendLine(textColor + NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("256") + " " + optionValue.ToString());
            num2         = Protocol_Item.Get_Critical_Plus(ItemUnique, 0);
            optionValue3 = Tooltip_Dlg.GetOptionValue(ItemUnique, pPacket.i32ITEMUPGRADE[1], num2, 3);
            num3         = optionValue3 - optionValue;
            if (num3 != 0)
            {
                text = ((num3 <= 0) ? textColor2 : textColor3) + NrTSingleton <UIDataManager> .Instance.GetString("(", (num3 <= 0)?string.Empty : "+", num3.ToString(), ")");
            }
            stringBuilder2.AppendLine(string.Concat(new string[]
            {
                textColor,
                NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("256"),
                " ",
                optionValue3.ToString(),
                " ",
                text
            }));
        }
        else if (NrTSingleton <ItemManager> .Instance.GetItemPartByItemUnique(ItemUnique) == eITEM_PART.ITEMPART_ARMOR)
        {
            int num         = Protocol_Item.Get_Defense(ItemUnique, 0);
            int optionValue = Tooltip_Dlg.GetOptionValue(ItemUnique, pPacket.i32ITEMOPTION[0], num, 2);
            stringBuilder.AppendLine(textColor + NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("243") + NrTSingleton <UIDataManager> .Instance.GetString(" ", optionValue.ToString()));
            int num2         = Protocol_Item.Get_Defense(ItemUnique, 0);
            int optionValue3 = Tooltip_Dlg.GetOptionValue(ItemUnique, pPacket.i32ITEMUPGRADE[0], num2, 2);
            int num3         = optionValue3 - optionValue;
            if (num3 != 0)
            {
                text = ((num3 <= 0) ? textColor2 : textColor3) + NrTSingleton <UIDataManager> .Instance.GetString("(", (num3 <= 0)?string.Empty : "+", num3.ToString(), ")");
            }
            stringBuilder2.AppendLine(string.Concat(new string[]
            {
                textColor,
                NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("243"),
                " ",
                optionValue3.ToString(),
                " ",
                text
            }));
            text = string.Empty;
            num  = Protocol_Item.Get_ADDHP(ItemUnique, 0);
            if (num != 0)
            {
                optionValue = Tooltip_Dlg.GetOptionValue(ItemUnique, pPacket.i32ITEMOPTION[1], num, 4);
                stringBuilder.AppendLine(textColor + NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("1216") + " " + optionValue.ToString());
                num2         = Protocol_Item.Get_ADDHP(ItemUnique, 0);
                optionValue3 = Tooltip_Dlg.GetOptionValue(ItemUnique, pPacket.i32ITEMUPGRADE[1], num2, 4);
                num3         = optionValue3 - optionValue;
                if (num3 != 0)
                {
                    text = ((num3 <= 0) ? textColor2 : textColor3) + NrTSingleton <UIDataManager> .Instance.GetString("(", (num3 <= 0)?string.Empty : "+", num3.ToString(), ")");
                }
                if (num2 != 0)
                {
                    stringBuilder2.AppendLine(string.Concat(new string[]
                    {
                        textColor,
                        NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("1216"),
                        " ",
                        optionValue3.ToString(),
                        " ",
                        text
                    }));
                }
            }
            num = Protocol_Item.Get_Critical_Plus(ItemUnique, 0);
            if (num != 0)
            {
                optionValue = Tooltip_Dlg.GetOptionValue(ItemUnique, pPacket.i32ITEMOPTION[1], num, 3);
                stringBuilder.AppendLine(textColor + NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("256") + " " + optionValue.ToString());
                num2         = Protocol_Item.Get_Critical_Plus(ItemUnique, 0);
                optionValue3 = Tooltip_Dlg.GetOptionValue(ItemUnique, pPacket.i32ITEMUPGRADE[1], num2, 3);
                num3         = optionValue3 - optionValue;
                if (num3 != 0)
                {
                    text = ((num3 <= 0) ? textColor2 : textColor3) + NrTSingleton <UIDataManager> .Instance.GetString("(", (num3 <= 0)?string.Empty : "+", num3.ToString(), ")");
                }
                if (num2 != 0)
                {
                    stringBuilder2.AppendLine(string.Concat(new string[]
                    {
                        textColor,
                        NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("256"),
                        " ",
                        optionValue3.ToString(),
                        " ",
                        text
                    }));
                }
            }
        }
        this.m_lbItemAfterStat.Text = stringBuilder2.ToString();
    }