Exemplo n.º 1
0
        public void BuyTab(Character chr, GameObject bank, byte tabId)
        {
            if (!GuildBank.CheckBankObj(chr, bank))
            {
                return;
            }
            GuildMember guildMember = chr.GuildMember;

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

            if (rank == null || !guildMember.IsLeader || (tabId >= (byte)6 || this.Guild.PurchasedBankTabCount >= 6) ||
                (int)tabId != this.Guild.PurchasedBankTabCount)
            {
                return;
            }
            int bankTabPrice = GuildBank.BankTabPrices[(int)tabId];

            if ((long)chr.Money < (long)bankTabPrice || !this.AddNewBankTab((int)tabId))
            {
                return;
            }
            rank.BankTabRights[(int)tabId].Privileges         = GuildBankTabPrivileges.Full;
            rank.BankTabRights[(int)tabId].WithdrawlAllowance = uint.MaxValue;
            GuildHandler.SendGuildRosterToGuildMembers(this.Guild);
            GuildHandler.SendGuildBankTabNames(chr, bank);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
 public GuildBankLog(GuildBank bank)
 {
     Bank           = bank;
     itemLogEntries =
         new StaticCircularList <GuildBankLogEntry>(24,
                                                    OnEntryDeleted);
     moneyLogEntries =
         new StaticCircularList <GuildBankLogEntry>(24,
                                                    OnEntryDeleted);
 }
Exemplo n.º 4
0
 public GuildBankLog(GuildBank bank)
 {
     this.Bank           = bank;
     this.itemLogEntries =
         new StaticCircularList <GuildBankLogEntry>(24,
                                                    new Action <GuildBankLogEntry>(GuildBankLog.OnEntryDeleted));
     this.moneyLogEntries =
         new StaticCircularList <GuildBankLogEntry>(24,
                                                    new Action <GuildBankLogEntry>(GuildBankLog.OnEntryDeleted));
 }
Exemplo n.º 5
0
 public void DepositMoney(Character depositer, GameObject bankObj, uint deposit)
 {
     if (!GuildBank.CheckBankObj(depositer, bankObj) || deposit == 0U || depositer.Money < deposit)
     {
         return;
     }
     this.Guild.Money += (long)deposit;
     depositer.SubtractMoney(deposit);
     this.BankLog.LogEvent(GuildBankLogEntryType.DepositMoney, depositer, deposit, (ItemRecord)null, 0,
                           (GuildBankTab)null);
     GuildHandler.SendGuildBankTabNames(depositer, bankObj);
     GuildHandler.SendGuildBankTabContents(depositer, bankObj, (byte)0);
     GuildHandler.SendGuildBankMoneyUpdate(depositer, bankObj);
 }
Exemplo n.º 6
0
        public void WithdrawMoney(Character withdrawer, GameObject bankObj, uint withdrawl)
        {
            if (!GuildBank.CheckBankObj(withdrawer, bankObj) || withdrawl == 0U || this.Guild.Money < (long)withdrawl)
            {
                return;
            }
            GuildMember guildMember = withdrawer.GuildMember;

            if (guildMember == null)
            {
                return;
            }
            this.Guild.Money -= (long)withdrawl;
            withdrawer.AddMoney(withdrawl);
            guildMember.BankMoneyWithdrawlAllowance -= withdrawl;
            this.BankLog.LogEvent(GuildBankLogEntryType.WithdrawMoney, withdrawer, withdrawl, (ItemRecord)null, 0,
                                  (GuildBankTab)null);
            GuildHandler.SendMemberRemainingDailyWithdrawlAllowance((IPacketReceiver)withdrawer,
                                                                    guildMember.BankMoneyWithdrawlAllowance);
            GuildHandler.SendGuildBankTabNames(withdrawer, bankObj);
            GuildHandler.SendGuildBankTabContents(withdrawer, bankObj, (byte)0);
            GuildHandler.SendGuildBankMoneyUpdate(withdrawer, bankObj);
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
 public GuildBankTab(GuildBank bank)
     : this()
 {
     this.Bank = bank;
 }
Exemplo n.º 9
0
 protected Guild(bool isNew)
 {
     this.syncRoot = new SimpleLockWrapper();
     this.EventLog = new GuildEventLog(this, isNew);
     this.Bank     = new GuildBank(this, isNew);
 }
Exemplo n.º 10
0
		public GuildBankLog(GuildBank bank)
		{
			Bank = bank;
			itemLogEntries = new StaticCircularList<GuildBankLogEntry>(MAX_ENTRIES, OnEntryDeleted);
			moneyLogEntries = new StaticCircularList<GuildBankLogEntry>(MAX_ENTRIES, OnEntryDeleted);
		}
Exemplo n.º 11
0
		public GuildBankTab(GuildBank bank)
			: this()
		{
			Bank = bank;
		}