Ejemplo n.º 1
0
        public void ModifyTabInfo(Character chr, GameObject bank, byte tabId, string newName, string newIcon)
        {
            if (!GuildBank.CheckBankObj(chr, bank))
            {
                return;
            }
            GuildMember guildMember = chr.GuildMember;

            if (guildMember == null || !guildMember.IsLeader ||
                (tabId < (byte)0 || (int)tabId > this.Guild.PurchasedBankTabCount))
            {
                return;
            }
            GuildBankTab record = this[(int)tabId];

            if (record == null)
            {
                return;
            }
            record.Name = newName;
            record.Icon = newIcon;
            record.UpdateLater();
            GuildHandler.SendGuildBankTabNames(chr, bank);
            GuildHandler.SendGuildBankTabContents(chr, bank, tabId);
        }
Ejemplo n.º 2
0
        private bool AddNewBankTab(int tabId)
        {
            if (tabId < 0 || tabId >= GuildMgr.MAX_BANK_TABS)
            {
                return(false);
            }

            var bankTab = this[tabId];

            if (bankTab != null)
            {
                return(false);
            }

            Guild.PurchasedBankTabCount++;
            var tab = new GuildBankTab
            {
                Bank     = this,
                BankSlot = tabId,
                Icon     = "",
                Name     = "Slot " + (tabId + 1),
                Text     = ""
            };

            ArrayUtil.AddOnlyOne(ref bankTabs, tab);

            tab.CreateLater();

            return(true);
        }
Ejemplo n.º 3
0
        public void SetBankTabText(Character chr, byte tabId, string newText)
        {
            GuildMember guildMember = chr.GuildMember;

            if (guildMember == null)
            {
                return;
            }
            GuildRank rank = guildMember.Rank;

            if (rank == null || tabId < (byte)0 ||
                (tabId >= (byte)6 || (int)tabId > this.Guild.PurchasedBankTabCount))
            {
                return;
            }
            GuildBankTab record = this[(int)tabId];

            if (record == null || !rank.BankTabRights[(int)tabId].Privileges
                .HasFlag((Enum)GuildBankTabPrivileges.UpdateText))
            {
                return;
            }
            record.Text = newText.Length < 501 ? newText : newText.Substring(0, 500);
            record.UpdateLater();
            this.Guild.Broadcast(GuildHandler.CreateBankTabTextPacket(tabId, newText));
        }
Ejemplo n.º 4
0
        public void LogEvent(GuildBankLogEntryType type, Character member, uint money, ItemRecord item, int amount,
                             GuildBankTab intoTab)
        {
            switch (type)
            {
            case GuildBankLogEntryType.DepositItem:
                LogItemEvent(type, member, item, amount, intoTab);
                break;

            case GuildBankLogEntryType.WithdrawItem:
                LogItemEvent(type, member, item, amount, intoTab);
                break;

            case GuildBankLogEntryType.MoveItem:
                LogItemEvent(type, member, item, amount, intoTab);
                break;

            case GuildBankLogEntryType.DepositMoney:
                LogMoneyEvent(type, member, money);
                break;

            case GuildBankLogEntryType.WithdrawMoney:
                LogMoneyEvent(type, member, money);
                break;

            case GuildBankLogEntryType.MoneyUsedForRepairs:
                LogMoneyEvent(type, member, money);
                break;

            case GuildBankLogEntryType.MoveItem_2:
                LogItemEvent(type, member, item, amount, intoTab);
                break;
            }
        }
Ejemplo n.º 5
0
        public void GetBankTabText(Character chr, byte tabId)
        {
            if (tabId < (byte)0 || tabId >= (byte)6 || (int)tabId > this.Guild.PurchasedBankTabCount)
            {
                return;
            }
            GuildBankTab guildBankTab = this[(int)tabId];

            if (guildBankTab == null)
            {
                return;
            }
            GuildHandler.SendGuildBankTabText(chr, tabId, guildBankTab.Text);
        }
Ejemplo n.º 6
0
        private void LogItemEvent(GuildBankLogEntryType type, Character actor, ItemRecord record, int amount,
                                  GuildBankTab intoTab)
        {
            GuildBankLogEntry guildBankLogEntry = new GuildBankLogEntry(Bank.Guild.Id)
            {
                Type           = type,
                Actor          = actor,
                BankLog        = this,
                DestinationTab = intoTab,
                ItemEntryId    = (int)record.EntryId,
                ItemStackCount = amount,
                Created        = DateTime.Now
            };

            lock (moneyLogEntries)
                moneyLogEntries.Insert(guildBankLogEntry);
        }
Ejemplo n.º 7
0
 /// <summary>
 ///
 /// </summary>
 internal GuildBank(Guild guild, bool isNew)
 {
     Guild   = guild;
     BankLog = new GuildBankLog(this);
     if (isNew)
     {
         bankTabs = new [] {
             new GuildBankTab(this)
             {
                 BankSlot = 0,
                 Icon     = "",
                 Name     = "Slot 0",
                 Text     = ""
             }
         };
     }
     else
     {
         // load an existing guild bank
         bankTabs = GuildBankTab.FindAllByProperty("_guildId", (int)guild.Id);
         BankLog.LoadLogs();
     }
 }
Ejemplo n.º 8
0
        private bool AddNewBankTab(int tabId)
        {
            if (tabId < 0 || tabId >= 6 || this[tabId] != null)
            {
                return(false);
            }
            ++this.Guild.PurchasedBankTabCount;
            ServerApp <WCell.RealmServer.RealmServer> .IOQueue.AddMessage((Action)(() =>
            {
                GuildBankTab guildBankTab = new GuildBankTab()
                {
                    Bank = this,
                    BankSlot = tabId,
                    Icon = "",
                    Name = "Slot " + (object)(tabId + 1),
                    Text = ""
                };
                int num = (int)ArrayUtil.AddOnlyOne <GuildBankTab>(ref this.bankTabs, guildBankTab);
                guildBankTab.CreateLater();
            }));

            return(true);
        }
Ejemplo n.º 9
0
		private void LogItemEvent(GuildBankLogEntryType type, Character actor, ItemRecord record, int amount, GuildBankTab intoTab)
		{
			var entry = new GuildBankLogEntry(Bank.Guild.Id)
			{
				Type = type,
				Actor = actor,
				BankLog = this,
				DestinationTab = intoTab,
				ItemEntryId = (int)record.EntryId,
				ItemStackCount = (int)amount,
				Created = DateTime.Now
			};

			lock (moneyLogEntries)
			{
				moneyLogEntries.Insert(entry);
			}
		}
Ejemplo n.º 10
0
 public void LogEvent(GuildBankLogEntryType type, Character chr, ItemRecord item, GuildBankTab intoTab)
 {
     this.LogEvent(type, chr, item, item.Amount, intoTab);
 }
Ejemplo n.º 11
0
		public GuildBank(Guild guild, bool isNew)
		{
			Guild = guild;
			BankTabs = new ImmutableList<GuildBankTab>(5);
			if (isNew)
			{
				var tab = new GuildBankTab(this)
				          	{
				          		BankSlot = 0,
				          		Icon = "",
				          		Name = "Slot 0",
				          		Text = ""
				          	};
				BankTabs.Add(tab);
			}
			else
			{
				var tabs = GuildBankTab.FindAllByProperty("_guildId", (int) guild.Id);
				foreach (var tab in tabs)
				{
					BankTabs.Add(tab);
				}
			}
		}
Ejemplo n.º 12
0
		private bool AddNewBankTab(int tabId)
		{
			if (tabId < 0 || tabId >= GuildMgr.MAX_BANK_TABS) return false;
			if (BankTabs[tabId] != null) return false;

			Guild.PurchasedBankTabCount++;
			var tab = new GuildBankTab
			{
				Bank = this,
				BankSlot = tabId
			};
			BankTabs[tabId] = tab;

			tab.CreateLater();

			return true;
		}
Ejemplo n.º 13
0
        private void LogItemEvent(GuildBankLogEntryType type, Character actor, ItemRecord record, int amount, GuildBankTab intoTab)
        {
            var entry = new GuildBankLogEntry {
                Type = type,
                Actor = actor,
                BankLog = this,
                DestinationTab = intoTab,
                ItemEntryId = (int)record.EntryId,
                ItemStackCount = (int)amount,
                TimeStamp = DateTime.Now
            };

            MoneyLogEntries.Push(entry);
            MoneyLogEntries = EnsureStackSize(MoneyLogEntries);
        }
Ejemplo n.º 14
0
        public void SwapItemsManualBankToBank(Character chr, GameObject bankObj, byte fromBankTabId, byte fromTabSlot,
                                              byte toBankTabId, byte toTabSlot, uint itemEntryId, byte amount)
        {
            if (!GuildBank.CheckBankObj(chr, bankObj))
            {
                return;
            }
            GuildMember guildMember = chr.GuildMember;

            if (guildMember == null)
            {
                return;
            }
            GuildRank rank = guildMember.Rank;

            if (rank == null)
            {
                return;
            }
            GuildBankTab intoTab1 = this[(int)fromBankTabId];

            if (intoTab1 == null)
            {
                return;
            }
            GuildBankTab intoTab2 = this[(int)toBankTabId];

            if (intoTab2 == null || fromTabSlot >= (byte)98 || toTabSlot >= (byte)98)
            {
                return;
            }
            GuildBankTabRights[] bankTabRights = rank.BankTabRights;
            if (!bankTabRights[(int)fromBankTabId].Privileges.HasFlag((Enum)GuildBankTabPrivileges.ViewTab) ||
                bankTabRights[(int)fromBankTabId].WithdrawlAllowance <= 0U || !bankTabRights[(int)toBankTabId]
                .Privileges.HasFlag((Enum)GuildBankTabPrivileges.DepositItem))
            {
                return;
            }
            ItemRecord itemRecord1 = intoTab1[(int)fromTabSlot];

            if (itemRecord1 == null || (int)itemRecord1.EntryId != (int)itemEntryId ||
                itemRecord1.Amount < (int)amount)
            {
                return;
            }
            if (amount == (byte)0)
            {
                amount = (byte)itemRecord1.Amount;
            }
            bool flag = (int)fromBankTabId == (int)toBankTabId;

            if (flag)
            {
                if ((int)fromTabSlot == (int)toTabSlot)
                {
                    return;
                }
                ItemRecord itemRecord2 = intoTab2.StoreItemInSlot(itemRecord1, (int)amount, (int)toTabSlot, true);
                intoTab1[(int)fromTabSlot] = itemRecord2;
            }
            else
            {
                if (intoTab2.CheckStoreItemInSlot(itemRecord1, (int)amount, (int)toTabSlot, true))
                {
                    ItemRecord itemRecord2 = intoTab2.StoreItemInSlot(itemRecord1, (int)amount, (int)toTabSlot, true);
                    intoTab1[(int)fromTabSlot] = itemRecord2;
                }
                else
                {
                    if (!bankTabRights[(int)fromBankTabId].Privileges
                        .HasFlag((Enum)GuildBankTabPrivileges.DepositItem) ||
                        bankTabRights[(int)toBankTabId].WithdrawlAllowance <= 0U)
                    {
                        return;
                    }
                    ItemRecord itemRecord2 = intoTab2.StoreItemInSlot(itemRecord1, (int)amount, (int)toTabSlot, true);
                    intoTab1[(int)fromTabSlot] = itemRecord2;
                    if (itemRecord2 != itemRecord1)
                    {
                        --bankTabRights[(int)toTabSlot].WithdrawlAllowance;
                        --bankTabRights[(int)fromBankTabId].WithdrawlAllowance;
                        this.BankLog.LogEvent(GuildBankLogEntryType.MoveItem, chr, itemRecord1, (int)amount, intoTab2);
                        this.BankLog.LogEvent(GuildBankLogEntryType.MoveItem, chr, itemRecord2, intoTab1);
                        this.Guild.SendGuildBankTabContentUpdateToAll(fromBankTabId, (int)fromTabSlot);
                        this.Guild.SendGuildBankTabContentUpdateToAll(toBankTabId, (int)toTabSlot);
                        return;
                    }
                }

                --bankTabRights[(int)fromBankTabId].WithdrawlAllowance;
            }

            this.BankLog.LogEvent(GuildBankLogEntryType.MoveItem, chr, itemRecord1, (int)amount, intoTab2);
            this.Guild.SendGuildBankTabContentUpdateToAll(fromBankTabId, (int)fromTabSlot,
                                                          flag ? (int)toTabSlot : -1);
        }
Ejemplo n.º 15
0
 public void LogEvent(GuildBankLogEntryType type, Character member, uint money, ItemRecord item, int amount, GuildBankTab intoTab)
 {
     switch (type)
     {
         case GuildBankLogEntryType.None:
             {
                 break;
             }
         case GuildBankLogEntryType.DepositItem:
             {
                 LogItemEvent(type, member, item, amount, intoTab);
                 break;
             }
         case GuildBankLogEntryType.WithdrawItem:
             {
                 LogItemEvent(type, member, item, amount, intoTab);
                 break;
             }
         case GuildBankLogEntryType.MoveItem:
             {
                 LogItemEvent(type, member, item, amount, intoTab);
                 break;
             }
         case GuildBankLogEntryType.DepositMoney:
             {
                 LogMoneyEvent(type, member, money);
                 break;
             }
         case GuildBankLogEntryType.WithdrawMoney:
             {
                 LogMoneyEvent(type, member, money);
                 break;
             }
         case GuildBankLogEntryType.MoneyUsedForRepairs:
             {
                 LogMoneyEvent(type, member, money);
                 break;
             }
         case GuildBankLogEntryType.MoveItem_2:
             {
                 LogItemEvent(type, member, item, amount, intoTab);
                 break;
             }
         case GuildBankLogEntryType.Unknown1:
             {
                 break;
             }
         case GuildBankLogEntryType.Unknown2:
             {
                 break;
             }
         default:
             {
                 break;
             }
     } // end switch
 } // end method
Ejemplo n.º 16
0
 public void LogEvent(GuildBankLogEntryType type, Character chr, ItemRecord item, int amount, GuildBankTab intoTab)
 {
     LogEvent(type, chr, 0, item, amount, intoTab);
 }
Ejemplo n.º 17
0
 public void LogEvent(GuildBankLogEntryType type, Character chr, ItemRecord item, int amount,
                      GuildBankTab intoTab)
 {
     LogEvent(type, chr, 0U, item, amount, intoTab);
 }
Ejemplo n.º 18
0
        public void LogEvent(GuildBankLogEntryType type, Character member, uint money, ItemRecord item, int amount, GuildBankTab intoTab)
        {
            switch (type)
            {
            case GuildBankLogEntryType.None:
            {
                break;
            }

            case GuildBankLogEntryType.DepositItem:
            {
                LogItemEvent(type, member, item, amount, intoTab);
                break;
            }

            case GuildBankLogEntryType.WithdrawItem:
            {
                LogItemEvent(type, member, item, amount, intoTab);
                break;
            }

            case GuildBankLogEntryType.MoveItem:
            {
                LogItemEvent(type, member, item, amount, intoTab);
                break;
            }

            case GuildBankLogEntryType.DepositMoney:
            {
                LogMoneyEvent(type, member, money);
                break;
            }

            case GuildBankLogEntryType.WithdrawMoney:
            {
                LogMoneyEvent(type, member, money);
                break;
            }

            case GuildBankLogEntryType.MoneyUsedForRepairs:
            {
                LogMoneyEvent(type, member, money);
                break;
            }

            case GuildBankLogEntryType.MoveItem_2:
            {
                LogItemEvent(type, member, item, amount, intoTab);
                break;
            }

            case GuildBankLogEntryType.Unknown1:
            {
                break;
            }

            case GuildBankLogEntryType.Unknown2:
            {
                break;
            }

            default:
            {
                break;
            }
            }     // end switch
        }         // end method
Ejemplo n.º 19
0
		private bool AddNewBankTab(int tabId)
		{
			if (tabId < 0 || tabId >= GuildMgr.MAX_BANK_TABS) return false;

			var bankTab = this[tabId];
			if (bankTab != null) return false;

			Guild.PurchasedBankTabCount++;
			var tab = new GuildBankTab
			{
				Bank = this,
				BankSlot = tabId,
                Icon = "",
                Name = "Slot " + (tabId + 1),
                Text = ""
			};
			ArrayUtil.AddOnlyOne(ref bankTabs, tab);

			tab.CreateLater();

			return true;
		}