예제 #1
0
 public void RemoveAllTimers()
 {
     for (int i = timers.Count - 1; i > 0; i--)
     {
         timers[timers.KeyByIndex(i)].Stop();
         timers[timers.KeyByIndex(i)].Dispose();
         timers.RemoveAt(i);
     }
 }
예제 #2
0
파일: Inventory.cs 프로젝트: pzaps/Server
 public Inventory(ListPair<int, DataManager.Characters.InventoryItem> loadedInventory)
 {
     items = new ListPair<int, InventoryItem>();
     for (int i = 0; i < loadedInventory.Count; i++) {
         items.Add(loadedInventory.KeyByIndex(i), new InventoryItem(loadedInventory.ValueByIndex(i)));
     }
 }
예제 #3
0
 public Inventory(ListPair <int, DataManager.Characters.InventoryItem> loadedInventory)
 {
     items = new ListPair <int, InventoryItem>();
     for (int i = 0; i < loadedInventory.Count; i++)
     {
         items.Add(loadedInventory.KeyByIndex(i), new InventoryItem(loadedInventory.ValueByIndex(i)));
     }
 }
예제 #4
0
        public static void GuildStepDown(Client client)
        {
            if (string.IsNullOrEmpty(client.Player.GuildName))
            {
                Messenger.PlayerMsg(client, "You are not in a guild.", Text.BrightRed);
                return;
            }
            bool stepDown = false;

            if (client.Player.GuildAccess > Enums.GuildRank.Member)
            {
                stepDown = true;
            }

            int index = -1;

            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) {
                ListPair <string, int> members = DataManager.Players.PlayerDataManager.LoadGuild(dbConnection.Database, client.Player.GuildName);

                index = members.IndexOfKey(client.Player.CharID);

                if (stepDown)
                {
                    DataManager.Players.PlayerDataManager.SetGuildAccess(dbConnection.Database, members.KeyByIndex(index), (int)client.Player.GuildAccess - 1);
                    Messenger.PlayerMsg(client, "You have stepped down from your position in the guild.", Text.Blue);
                }
                else
                {
                    DataManager.Players.PlayerDataManager.RemoveGuildMember(dbConnection.Database, client.Player.CharID);
                    Messenger.PlayerMsg(client, "You have left your guild.", Text.Blue);
                }
            }

            if (stepDown)
            {
                client.Player.GuildAccess = (Enums.GuildRank)((int)client.Player.GuildAccess - 1);
            }
            else
            {
                client.Player.GuildName   = "";
                client.Player.GuildAccess = Enums.GuildRank.None;
            }
            //send the guild access data to all
            Messenger.SendPlayerGuild(client);

            //send the update to all possible guild members
            if (index > -1)
            {
                Messenger.SendFullGuildUpdate(client.Player.GuildName);
            }
        }
예제 #5
0
 public static void SavePlayerInventoryUpdates(MySql database, string charID, ListPair<int, Characters.InventoryItem> updateList)
 {
     for (int i = 0; i < updateList.Count; i++) {
         Characters.InventoryItem invItem = updateList.ValueByIndex(i);
         database.UpdateOrInsert("inventory", new IDataColumn[] {
             database.CreateColumn(false, "CharID", charID),
             database.CreateColumn(false, "ItemSlot", updateList.KeyByIndex(i).ToString()),
             database.CreateColumn(false, "ItemNum", invItem.Num.ToString()),
             database.CreateColumn(false, "Amount", invItem.Amount.ToString()),
             database.CreateColumn(false, "Sticky", invItem.Sticky.ToIntString()),
             database.CreateColumn(false, "Tag", invItem.Tag)
         });
     }
 }
예제 #6
0
        public static void SavePlayerBankUpdates(MySql database, string charID, ListPair<int, Characters.InventoryItem> updateList)
        {
            MultiRowInsert multiRowInsert = new MultiRowInsert(database, "bank", "CharID", "ItemSlot", "ItemNum",
                "Amount", "Sticky", "Tag");

            for (int i = 0; i < updateList.Count; i++) {
                Characters.InventoryItem invItem = updateList.ValueByIndex(i);

                multiRowInsert.AddRowOpening();

                multiRowInsert.AddColumnData(charID);
                multiRowInsert.AddColumnData(updateList.KeyByIndex(i), invItem.Num, invItem.Amount);
                multiRowInsert.AddColumnData(invItem.Sticky.ToIntString(), invItem.Tag);

                multiRowInsert.AddRowClosing();
            }

            database.ExecuteNonQuery(multiRowInsert.GetSqlQuery());
        }