private void OnItem1Clicked(GameObject go) { Globals.Instance.EffectSoundMgr.Play("ui/ui_001"); ItemInfo itemInfo = GUIShortcutBuyItem.ItemInfos[2]; LocalPlayer player = Globals.Instance.Player; ItemDataEx itemByInfoID = player.ItemSystem.GetItemByInfoID(itemInfo.ID); if (itemByInfoID == null) { GUIShortcutBuyItem.Show(GUIShortcutBuyItem.BuyType.WarFree1); } else { MC2S_UseItem mC2S_UseItem = new MC2S_UseItem(); mC2S_UseItem.ItemID = itemByInfoID.Data.ID; Globals.Instance.CliSession.Send(516, mC2S_UseItem); } }
private void OnUseClick(GameObject go) { Globals.Instance.EffectSoundMgr.Play("ui/ui_001"); if (this.currentType == GUIShortcutBuyItem.BuyType.MAX || GUIShortcutBuyItem.ItemInfos[(int)this.currentType] == null) { return; } LocalPlayer player = Globals.Instance.Player; ItemDataEx itemByInfoID = player.ItemSystem.GetItemByInfoID(GUIShortcutBuyItem.ItemInfos[(int)this.currentType].ID); if (itemByInfoID == null) { return; } if ((this.currentType == GUIShortcutBuyItem.BuyType.WarFree1 || this.currentType == GUIShortcutBuyItem.BuyType.WarFree8) && Globals.Instance.Player.Data.WarFreeTime > 0) { int num = Globals.Instance.Player.Data.WarFreeTime - Globals.Instance.Player.GetTimeStamp(); if (num > 0) { GameMessageBox gameMessageBox = GameMessageBox.ShowMessageBox(Singleton<StringManager>.Instance.GetString("Pillage19"), MessageBox.Type.OKCancel, itemByInfoID.Data.ID); if (gameMessageBox != null) { GameMessageBox expr_F3 = gameMessageBox; expr_F3.OkClick = (MessageBox.MessageDelegate)Delegate.Combine(expr_F3.OkClick, new MessageBox.MessageDelegate(delegate(object obj) { MC2S_UseItem mC2S_UseItem2 = new MC2S_UseItem(); mC2S_UseItem2.ItemID = (ulong)obj; Globals.Instance.CliSession.Send(516, mC2S_UseItem2); })); } return; } } MC2S_UseItem mC2S_UseItem = new MC2S_UseItem(); mC2S_UseItem.ItemID = itemByInfoID.Data.ID; Globals.Instance.CliSession.Send(516, mC2S_UseItem); }
public void UseItem(ItemDataEx data, int count) { this.mCurData = data; this.mCurCount = count; switch (data.Info.Type) { case 2: switch (data.Info.SubType) { case 0: case 1: case 3: case 4: case 5: case 6: case 9: { MC2S_UseItem mC2S_UseItem = new MC2S_UseItem(); mC2S_UseItem.ItemID = data.GetID(); mC2S_UseItem.Count = count; Globals.Instance.CliSession.Send(516, mC2S_UseItem); break; } case 2: { MC2S_OpenItem mC2S_OpenItem = new MC2S_OpenItem(); mC2S_OpenItem.ItemID = data.GetID(); mC2S_OpenItem.Count = count; Globals.Instance.CliSession.Send(508, mC2S_OpenItem); break; } case 7: { MC2S_OpenSelectBox mC2S_OpenSelectBox = new MC2S_OpenSelectBox(); mC2S_OpenSelectBox.ItemID = data.GetID(); mC2S_OpenSelectBox.Index = count; Globals.Instance.CliSession.Send(540, mC2S_OpenSelectBox); break; } case 8: { MC2S_OpenRewardBox mC2S_OpenRewardBox = new MC2S_OpenRewardBox(); mC2S_OpenRewardBox.ItemID = data.GetID(); mC2S_OpenRewardBox.Count = count; Globals.Instance.CliSession.Send(544, mC2S_OpenRewardBox); break; } } break; case 5: { MC2S_AwakeItemBreakUp mC2S_AwakeItemBreakUp = new MC2S_AwakeItemBreakUp(); mC2S_AwakeItemBreakUp.ID = data.GetID(); mC2S_AwakeItemBreakUp.Count = count; Globals.Instance.CliSession.Send(538, mC2S_AwakeItemBreakUp); break; } } }