public override IEnumerable <object> Run() { GuildStorageManager storage = base.Entity.Storage; OnlineGuildMember member = base.Entity.GetOnlineMember(base.Operation.RequestingCID); if (!base.Entity.Storage.Valid || !FeatureMatrix.IsEnable("GuildStorage")) { member.SendOperationFailedDialog("GuildStorageFail_Processing"); storage.AddGuildStorageLedger(base.Operation.RequestingCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_Invalid); base.Finished = true; yield return(new FailMessage("[UpdateGuildStorageSettingsProcessor] GuildStorage") { Reason = FailMessage.ReasonCode.LogicalFail }); } else if (base.Entity.Storage.Processing) { member.SendOperationFailedDialog("GuildStorageFail_Processing"); storage.AddGuildStorageLedger(base.Operation.RequestingCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_Processing); base.Finished = true; yield return(new FailMessage("[UpdateGuildStorageSettingsProcessor] Entity.Storage.Processing") { Reason = FailMessage.ReasonCode.LogicalFail }); } else if (!base.Entity.Storage.IsEnabled) { member.SendOperationFailedDialog("GuildStorageFail_Stopped"); storage.AddGuildStorageLedger(base.Operation.RequestingCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_Invalid); base.Finished = true; yield return(new FailMessage("[UpdateGuildStorageSettingsProcessor] Entity.Storage.IsEnabled") { Reason = FailMessage.ReasonCode.LogicalFail }); } else { if (member != null) { if (member.GuildMember.Rank == GuildMemberRank.Master) { storage.AddGuildStorageLedger(base.Operation.RequestingCID, GuildStorageOperationCode.UpdateSetting, GuildStorageEventCode.ChangeSetting, base.Operation.AccessLimtiTag.ToString(), base.Operation.GoldLimit); base.Entity.Storage.UpdateSetting(base.Operation.GoldLimit, base.Operation.AccessLimtiTag); base.Entity.Storage.BroadCastInventoryInfo(); } else { member.SendOperationFailedDialog("GuildStorageFail_RankLimited"); } } storage.AddGuildStorageLedger(base.Operation.RequestingCID, GuildStorageOperationCode.UpdateSetting, GuildStorageEventCode.Done); base.Finished = true; yield return(new OkMessage()); } yield break; }
public override IEnumerable <object> Run() { GuildStorageManager storage = this.Entity.Storage; OnlineGuildMember member = this.Entity.GetOnlineMember(this.Operation.PuchasedCID); if (!this.Entity.Storage.Valid || !FeatureMatrix.IsEnable("GuildStorage")) { member.SendOperationFailedDialog("GuildStorageFail_Processing"); storage.AddGuildStorageLedger(this.Operation.PuchasedCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_Invalid); this.Finished = true; yield return((object)new FailMessage("[PurchaseGuildStorageProcessor] GuildStorage") { Reason = FailMessage.ReasonCode.LogicalFail }); } else if (this.Entity.Storage.Processing) { member.SendOperationFailedDialog("GuildStorageFail_Processing"); storage.AddGuildStorageLedger(this.Operation.PuchasedCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_Processing); this.Finished = true; yield return((object)new FailMessage("[PurchaseGuildStorageProcessor] Entity.Storage.Processing") { Reason = FailMessage.ReasonCode.LogicalFail }); } else if (!this.Entity.Storage.IsEnabled) { member.SendOperationFailedDialog("GuildStorageFail_Stopped"); storage.AddGuildStorageLedger(this.Operation.PuchasedCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_Invalid); this.Finished = true; yield return((object)new FailMessage("[PurchaseGuildStorageProcessor] Entity.Storage.IsEnabled") { Reason = FailMessage.ReasonCode.LogicalFail }); } else if (storage.StorageCount >= storage.GuildStorageSlotsMax) { member.SendOperationFailedDialog("GuildStorageFail_Full"); storage.AddGuildStorageLedger(this.Operation.PuchasedCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_Invalid); this.Finished = true; yield return((object)new FailMessage("[PurchaseGuildStorageProcessor] storage.StorageCount") { Reason = FailMessage.ReasonCode.LogicalFail }); } else { this.Entity.Storage.Processing = true; int targetSlotCount = 0; if (this.Entity.Storage.StorageCount == 0 && !FeatureMatrix.IsEnable("GuildStoargeSlotAllCash")) { storage.AddGuildStorageLedger(this.Operation.PuchasedCID, GuildStorageOperationCode.PurchaseGuildStorage, GuildStorageEventCode.PurchaseSlotByGold); if (FeatureMatrix.GetInteger("GuildStorageSlotGoldPrice") > 0) { DestroyItem op = new DestroyItem("gold", FeatureMatrix.GetInteger("GuildStorageSlotGoldPrice"), GiveItem.SourceEnum.Unknown); OperationSync sync = new OperationSync() { Connection = member.PlayerConn, Operation = (Operation)op }; yield return((object)sync); if (!sync.Result || !op.Result) { this.Entity.Storage.Processing = false; storage.AddGuildStorageLedger(this.Operation.PuchasedCID, GuildStorageOperationCode.PurchaseGuildStorage, GuildStorageEventCode.Error_PurchaseSlotByGold); member.SendOperationFailedDialog("GuildStorageFail_PurchaseFailed"); this.Finished = true; yield return((object)new FailMessage("[PurchaseGuildStorageProcessor] op.Result") { Reason = FailMessage.ReasonCode.LogicalFail }); yield break; } } targetSlotCount = this.Entity.Storage.GuildStorageSlotsFirstPurchase; } else { storage.AddGuildStorageLedger(this.Operation.PuchasedCID, GuildStorageOperationCode.PurchaseGuildStorage, GuildStorageEventCode.PurchaseSlotByCash); if (!FeatureMatrix.IsEnable("GuildStoargeSlotFree")) { if (this.Operation.ProductNo == -1) { member.SendOperationFailedDialog("GuildStorageFail_PurchaseFailed"); storage.AddGuildStorageLedger(this.Operation.PuchasedCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_Invalid); this.Entity.Storage.Processing = false; this.Finished = true; yield return((object)new FailMessage("[PurchaseGuildStorageProcessor] Operation.ProductNo") { Reason = FailMessage.ReasonCode.LogicalFail }); yield break; } else { DirectPickUpByProductNo op = new DirectPickUpByProductNo() { ProductNoList = new List <int>() { this.Operation.ProductNo }, IsCredit = this.Operation.IsCredit }; OperationSync sync = new OperationSync() { Connection = member.CashShopConn, Operation = (Operation)op }; yield return((object)sync); if (!sync.Result || !op.Result || !op.ResultingItems.ContainsKey("guildstorage_ticket")) { storage.AddGuildStorageLedger(this.Operation.PuchasedCID, GuildStorageOperationCode.PurchaseGuildStorage, GuildStorageEventCode.Error_PurchaseSlotByCash); member.SendOperationFailedDialog("GuildStorageFail_PurchaseFailed"); this.Entity.Storage.Processing = false; this.Finished = true; yield return((object)new FailMessage("[PurchaseGuildStorageProcessor] guildstorage_ticket") { Reason = FailMessage.ReasonCode.LogicalFail }); yield break; } } } targetSlotCount = this.Entity.Storage.GuildStorageSlotsPerPurchase; } storage.AddGuildStorageLedger(this.Operation.PuchasedCID, GuildStorageOperationCode.PurchaseGuildStorage, GuildStorageEventCode.Process); AddGuildStorageSlots requestOp = new AddGuildStorageSlots() { SlotCount = targetSlotCount }; requestOp.OnComplete += (Action <Operation>)(___ => this.Entity.Storage.StorageCount = requestOp.ResultSlotCount); OperationSync sync2 = new OperationSync() { Connection = this.Entity.Storage.ItemConn, Operation = (Operation)requestOp }; yield return((object)sync2); if (requestOp.Result) { storage.AddGuildStorageLedger(this.Operation.PuchasedCID, GuildStorageOperationCode.PurchaseGuildStorage, GuildStorageEventCode.Done); } else { storage.AddGuildStorageLedger(this.Operation.PuchasedCID, GuildStorageOperationCode.PurchaseGuildStorage, GuildStorageEventCode.Error_ProcessFail); } this.Entity.Storage.Processing = false; this.Entity.Storage.ReportExtendSlot(member.CharacterName, this.Entity.Storage.GuildStorageSlotsPerPurchase); this.Finished = true; yield return((object)new OkMessage()); } }
public override IEnumerable <object> Run() { GuildStorageManager storage = base.Entity.Storage; OnlineGuildMember member = base.Entity.GetOnlineMember(base.Operation.RequestingCID); if (!base.Entity.Storage.Valid || !FeatureMatrix.IsEnable("GuildStorage")) { member.SendOperationFailedDialog("GuildStorageFail_Processing"); storage.AddGuildStorageLedger(base.Operation.RequestingCID, GuildStorageOperationCode.ArrangeGuildItem, GuildStorageEventCode.Error_Invalid); base.Finished = true; yield return(new FailMessage("[ArrangeGuildStorageItemProcessor] GuildStorage") { Reason = FailMessage.ReasonCode.LogicalFail }); } else if (base.Entity.Storage.Processing) { member.SendOperationFailedDialog("GuildStorageFail_Processing"); storage.AddGuildStorageLedger(base.Operation.RequestingCID, GuildStorageOperationCode.ArrangeGuildItem, GuildStorageEventCode.Error_Processing); base.Finished = true; yield return(new FailMessage("[ArrangeGuildStorageItemProcessor] Entity.Storage.Processing") { Reason = FailMessage.ReasonCode.LogicalFail }); } else if (!base.Entity.Storage.IsEnabled) { member.SendOperationFailedDialog("GuildStorageFail_Stopped"); storage.AddGuildStorageLedger(base.Operation.RequestingCID, GuildStorageOperationCode.ArrangeGuildItem, GuildStorageEventCode.Error_Invalid); base.Finished = true; yield return(new FailMessage("[ArrangeGuildStorageItemProcessor] Entity.Storage.IsEnabled") { Reason = FailMessage.ReasonCode.LogicalFail }); } else { base.Entity.Storage.Processing = true; QueryItemInfoByItemID op0 = new QueryItemInfoByItemID { ItemID = base.Operation.ItemID }; OperationSync sync0 = new OperationSync { Connection = base.Entity.Storage.ItemConn, Operation = op0 }; yield return(sync0); if (op0.Result) { if (op0.SlotInfo.ItemClass == "gold") { member.SendOperationFailedDialog("GuildStorageFail_InvalidItem"); base.Entity.Storage.Processing = false; base.Finished = true; yield return(new FailMessage("[ArrangeGuildStorageItemProcessor] op0.SlotInfo.ItemClass") { Reason = FailMessage.ReasonCode.LogicalFail }); } else if (base.Entity.Storage.IsPickLimited(member, op0.SlotInfo.ItemClass, op0.SlotInfo.Slot, 1) || base.Entity.Storage.IsPickLimited(member, "", base.Operation.Slot, 1)) { base.Entity.Storage.Processing = false; base.Finished = true; yield return(new FailMessage("[ArrangeGuildStorageItemProcessor] Entity.Storage.IsPickLimited") { Reason = FailMessage.ReasonCode.LogicalFail }); } else { storage.AddGuildStorageLedger(base.Operation.RequestingCID, GuildStorageOperationCode.ArrangeGuildItem, GuildStorageEventCode.Process, base.Operation.ItemID.ToString(), base.Operation.Slot); MoveInventoryItem op = new MoveInventoryItem(base.Operation.ItemID, 0, base.Operation.Slot); OperationSync sync = new OperationSync { Connection = base.Entity.Storage.ItemConn, Operation = op }; yield return(sync); if (sync.Result && op.Result) { storage.AddGuildStorageLedger(base.Operation.RequestingCID, GuildStorageOperationCode.ArrangeGuildItem, GuildStorageEventCode.Done, base.Operation.ItemID.ToString(), base.Operation.Slot); } else { storage.AddGuildStorageLedger(base.Operation.RequestingCID, GuildStorageOperationCode.ArrangeGuildItem, GuildStorageEventCode.Error_TransferFail, base.Operation.ItemID.ToString(), base.Operation.Slot); member.SendOperationFailedDialog("GuildStorageFail_TransferFailed"); } base.Entity.Storage.Processing = false; base.Finished = true; yield return(new OkMessage()); } } else { member.SendOperationFailedDialog("GuildStorageFail_InternalError"); base.Entity.Storage.Processing = false; base.Finished = true; yield return(new FailMessage("[ArrangeGuildStorageItemProcessor] op0.Result") { Reason = FailMessage.ReasonCode.LogicalFail }); } } yield break; }
public override IEnumerable <object> Run() { GuildStorageManager storage = this.Entity.Storage; OnlineGuildMember member = this.Entity.GetOnlineMember(this.Operation.OwnerCID); if (!this.Entity.Storage.Valid || !FeatureMatrix.IsEnable("GuildStorage")) { member.SendOperationFailedDialog("GuildStorageFail_Processing"); storage.AddGuildStorageLedger(this.Operation.OwnerCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_Invalid); this.Finished = true; yield return((object)new FailMessage("[PickGuildStorageItemProcessor] GuildStorage") { Reason = FailMessage.ReasonCode.LogicalFail }); } else if (this.Entity.Storage.Processing) { member.SendOperationFailedDialog("GuildStorageFail_Processing"); storage.AddGuildStorageLedger(this.Operation.OwnerCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_Processing); this.Finished = true; yield return((object)new FailMessage("[PickGuildStorageItemProcessor] Entity.Storage.Processing") { Reason = FailMessage.ReasonCode.LogicalFail }); } else if (this.Entity.Storage.StorageCount == 0) { member.SendOperationFailedDialog("GuildStorageFail_NoSlot"); storage.AddGuildStorageLedger(this.Operation.OwnerCID, GuildStorageOperationCode.AddGuildItem, GuildStorageEventCode.Error_Invalid); this.Finished = true; yield return((object)new FailMessage("[PickGuildStorageItemProcessor] Entity.Storage.StorageCount") { Reason = FailMessage.ReasonCode.LogicalFail }); } else { this.Entity.Storage.Processing = true; int color1 = -1; int color2 = -1; int color3 = -1; int reduceDurability = -1; int maxDurabilityBonus = -1; byte tab = byte.MaxValue; int slot = -2; string loggingItemClass = this.Operation.ItemClass; if (this.Operation.ItemID != 0L) { QueryItemInfoByItemID op0 = new QueryItemInfoByItemID() { ItemID = this.Operation.ItemID }; OperationSync sync0 = new OperationSync() { Connection = this.Entity.Storage.ItemConn, Operation = (Operation)op0 }; yield return((object)sync0); if (op0.Result) { if (this.Entity.Storage.IsPickLimited(member, this.Operation.ItemClass, op0.SlotInfo.Slot, this.Operation.Amount)) { storage.AddGuildStorageLedger(this.Operation.OwnerCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_Limited, this.Operation.ItemClass, this.Operation.Amount); this.Entity.Storage.Processing = false; this.Finished = true; yield return((object)new FailMessage("[PickGuildStorageItemProcessor] Entity.Storage.IsPickLimited") { Reason = FailMessage.ReasonCode.LogicalFail }); yield break; } else { color1 = op0.SlotInfo.Color1; color2 = op0.SlotInfo.Color2; color3 = op0.SlotInfo.Color3; reduceDurability = op0.SlotInfo.MaxDurability - op0.SlotInfo.Durability; maxDurabilityBonus = op0.SlotInfo.MaxDurabilityBonus; tab = (byte)op0.SlotInfo.Tab; slot = op0.SlotInfo.Slot; loggingItemClass = op0.ItemClassEX; } } else { storage.AddGuildStorageLedger(this.Operation.OwnerCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_Invalid, this.Operation.ItemClass, this.Operation.Amount); member.SendOperationFailedDialog("GuildStorageFail_InternalError"); this.Entity.Storage.Processing = false; this.Finished = true; yield return((object)new FailMessage("[PickGuildStorageItemProcessor] op0.Result") { Reason = FailMessage.ReasonCode.LogicalFail }); yield break; } } else if (this.Entity.Storage.IsPickLimited(member, this.Operation.ItemClass, 0, this.Operation.Amount)) { storage.AddGuildStorageLedger(this.Operation.OwnerCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_Invalid, this.Operation.ItemClass, this.Operation.Amount); this.Entity.Storage.Processing = false; this.Finished = true; yield return((object)new FailMessage("[PickGuildStorageItemProcessor] Entity.Storage.IsPickLimited") { Reason = FailMessage.ReasonCode.LogicalFail }); yield break; } storage.AddGuildStorageLedger(this.Operation.OwnerCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.TransferFrom, this.Operation.ItemClass, this.Operation.Amount, color1, color2, color3, reduceDurability, maxDurabilityBonus); TransferToSystem op1 = new TransferToSystem((ICollection <TransferItemInfo>) new List <TransferItemInfo>() { new TransferItemInfo(this.Operation.ItemID, this.Operation.ItemClass, this.Operation.Amount) }, TransferToSystem.SourceEnum.GuildStorage); OperationSync sync = new OperationSync() { Connection = this.Entity.Storage.ItemConn, Operation = (Operation)op1 }; yield return((object)sync); if (!op1.Result) { storage.AddGuildStorageLedger(this.Operation.OwnerCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_TransferFail, this.Operation.ItemClass, this.Operation.Amount, color1, color2, color3, reduceDurability, maxDurabilityBonus); member.SendOperationFailedDialog("GuildStorageFail_TransferFailed"); this.Entity.Storage.Processing = false; this.Finished = true; yield return((object)new FailMessage("[PickGuildStorageItemProcessor] op1.Result") { Reason = FailMessage.ReasonCode.LogicalFail }); } else { storage.AddGuildStorageLedger(this.Operation.OwnerCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.TransferTo, this.Operation.ItemClass, this.Operation.Amount, color1, color2, color3, reduceDurability, maxDurabilityBonus); List <long> itemList = new List <long>(); foreach (TransferredItemInfo transferredItem in (IEnumerable <TransferredItemInfo>)op1.TransferredItemList) { itemList.Add(transferredItem.ItemID); } TransferFromSystem op2 = (int)this.Operation.TargetTab != (int)byte.MaxValue ? (this.Operation.TargetSlot != -1 ? new TransferFromSystem((ICollection <long>)itemList, true, this.Operation.TargetTab, this.Operation.TargetSlot, this.Operation.TargetSlot + 1, TransferFromSystem.SourceEnum.GuildStorage) : new TransferFromSystem((ICollection <long>)itemList, true, this.Operation.TargetTab, 0, 48, TransferFromSystem.SourceEnum.GuildStorage)) : new TransferFromSystem((ICollection <long>)itemList, true, byte.MaxValue, 0, 0, TransferFromSystem.SourceEnum.GuildStorage); OperationSync sync2 = new OperationSync() { Connection = member.PlayerConn, Operation = (Operation)op2 }; yield return((object)sync2); if (!op2.Result) { storage.AddGuildStorageLedger(this.Operation.OwnerCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_TransferFail, this.Operation.ItemClass, this.Operation.Amount, color1, color2, color3, reduceDurability, maxDurabilityBonus); if (op2.FailReason == TransferFromSystem.FailReasonEnum.NoEmptySlot) { member.SendOperationFailedDialog("GuildStorageFail_NoEmptySlot"); } else { member.SendOperationFailedDialog("GuildStorageFail_TransferFailed"); } TransferFromSystem op3 = new TransferFromSystem((ICollection <long>)itemList, false, tab, slot, slot + 1, TransferFromSystem.SourceEnum.GuildStorage); OperationSync sync3 = new OperationSync() { Connection = this.Entity.Storage.ItemConn, Operation = (Operation)op3 }; yield return((object)sync3); if (op3.Result) { storage.AddGuildStorageLedger(this.Operation.OwnerCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_TransferFail_Recovered, this.Operation.ItemClass, this.Operation.Amount, color1, color2, color3, reduceDurability, maxDurabilityBonus); } else { storage.AddGuildStorageLedger(this.Operation.OwnerCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Error_TransferFail_RecoverFail, this.Operation.ItemClass, this.Operation.Amount, color1, color2, color3, reduceDurability, maxDurabilityBonus); } this.Entity.Storage.Processing = false; this.Finished = true; yield return((object)new FailMessage("[PickGuildStorageItemProcessor] op2.Result") { Reason = FailMessage.ReasonCode.LogicalFail }); } else { storage.AddGuildStorageLedger(this.Operation.OwnerCID, GuildStorageOperationCode.PickGuildItem, GuildStorageEventCode.Done, this.Operation.ItemClass, this.Operation.Amount, color1, color2, color3, reduceDurability, maxDurabilityBonus); this.Entity.Storage.ReportPickItem(member.CharacterName, loggingItemClass, this.Operation.Amount, color1, color2, color3); this.Entity.Storage.Processing = false; this.Finished = true; yield return((object)new OkMessage()); } } } }