From 141ca7330955968ea8fdc74d7a235e91c2506212 Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Sun, 17 Sep 2023 18:21:34 -0400 Subject: [PATCH 01/20] Create InventoryAdjuster.py Script for Adding Special Items to a user. --- InventoryAdjuster.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 InventoryAdjuster.py diff --git a/InventoryAdjuster.py b/InventoryAdjuster.py new file mode 100644 index 0000000..b766f45 --- /dev/null +++ b/InventoryAdjuster.py @@ -0,0 +1,36 @@ +from pymongo import MongoClient + +client = MongoClient("mongodb://uber:admin@localhost:27017/?authMechanism=SCRAM-SHA-1&authSource=admin") +db = client.admin +collection = db["Test"] + +result = db.Test.find() +total_accounts=len(list(result)) + +AdminShirt = 1037 +BetaHeroShirt = 1038 +GlobalModShirt = 1040 +ModShirt = 1041 +QAShirt = 1042 + +Cmids = [1] +ItemstoAdd = [AdminShirt, QAShirt, BetaHeroShirt] + +CmidRange = len(list(Cmids)) + +for i in Cmids: + print("Cmid:",i) + for Item in ItemstoAdd: + ItemId = Item + print("Item:",ItemId) + db.Test.update_one( + {"UserId": i}, + { "$addToSet": { "Inventory" : + { + "AmountRemaining": -1, + "Cmid": i, + "ExpirationDate": None, + "ItemId": Item + } + }} + ) \ No newline at end of file From e2b9eb074c91efea91178062f0efd2984151bf04 Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Tue, 19 Sep 2023 20:22:08 -0400 Subject: [PATCH 02/20] Update PointsUpdater.py --- PointsUpdater.py | 94 ++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 56 deletions(-) diff --git a/PointsUpdater.py b/PointsUpdater.py index 82f1e0b..5910124 100644 --- a/PointsUpdater.py +++ b/PointsUpdater.py @@ -1,68 +1,50 @@ from pymongo import MongoClient -import json -client = MongoClient("mongodb://uber:admin@localhost:27017/?authMechanism=SCRAM-SHA-1&authSource=admin") +client = MongoClient("mongodb://uber:admin@localhost:27017/?authMechanism=SCRAM-SHA-1&authSource=admin") db = client.admin collection = db["FixedUsers"] collection2 = db["BrokenUsers"] collection3 = db["Users"] -result = db.Users.find() +result = db.Users.find() total_accounts=len(list(result)) -print("Total accounts Database", total_accounts) - -for i in range(506,total_accounts+1): #Only 864 Accounts in Old Database - if i >= 1 and i <= 843: - CurrentUser = collection.find_one({"UserId": i}) - CurrentUser2 = collection2.find_one({"UserId": i}) - CurrentUser3 = collection3.find_one({"UserId": i}) - CurrentUserName = CurrentUser["Profile"]["Name"] - CurrentUserKillsCount = CurrentUser["Kills"] - CurrentUserKillsCount2 =CurrentUser2["Kills"] - points_balance_current = CurrentUser3["Wallet"]["Points"] - - print("{", i,"}", "Name: ", CurrentUserName) - # if CurrentUser and "Wallet" in CurrentUser: - # points_balance = CurrentUser["Wallet"]["Points"] - # print("Fixed Database Points: ", points_balance) - - # if CurrentUser2 and "Wallet" in CurrentUser2: - # points_balance_old = CurrentUser2["Wallet"]["Points"] - # print("Broken Database Points: ", points_balance_old) - - CurrentUserKillsDifference = CurrentUserKillsCount - CurrentUserKillsCount2 - - # print("There is ", CurrentUserKillsDifference, "More kills in the New Database") +AwardWinners = [2, 5, 13, 69, 71, 114, 118, 140, 224, 491, 555, 670, 815] + +for i in AwardWinners: + print("Cmid:",i) + BrokenDB = collection2.find_one({"UserId": i,}) + FixedDB = collection.find_one({"UserId": i}) + FixedPointsCount = FixedDB["Wallet"]["Points"] + BrokenPointsCount = BrokenDB["Wallet"]["Points"] - PointBalanceMultiplier = CurrentUserKillsDifference * 10 - - print("User",CurrentUserName, "will receive",PointBalanceMultiplier,"extra points added to their balance.") - - #if points_balance_old >= points_balance: - - # NewPointsBalance = points_balance_old + PointBalanceMultiplier - - # print("Point Balance: ", NewPointsBalance) - - #else: - - # NewPointsBalance = points_balance + PointBalanceMultiplier - NewPointsBalance = points_balance_current + PointBalanceMultiplier - print("Point Balance: ", NewPointsBalance) + AwardPoints = BrokenPointsCount + 50000 - elif i >= 864: - CurrentUser = collection3.find_one({"UserId": i}) - CurrentUserName = CurrentUser["Profile"]["Name"] - CurrentUserKillsCount = CurrentUser["Kills"] - if CurrentUser and "Wallet" in CurrentUser: - points_balance = CurrentUser["Wallet"]["Points"] + db.BrokenUsers.update_one( + {"UserId": i}, + { "$set": {"Wallet.Points": AwardPoints}} + ) + +for j in range(1,total_accounts+1): + print("Cmid:",j) + if j >= 1 and j <= 312 or j >= 314 and j <= 504 or j >= 506 and j <= 862: + BrokenDB = collection2.find_one({"UserId": j,}) + FixedDB = collection.find_one({"UserId": j}) + CurrentDB = collection3.find_one({"UserId": j}) + FixedPointsCount = FixedDB["Wallet"]["Points"] + BrokenPointsCount = BrokenDB["Wallet"]["Points"] + CurrentPointsCount = CurrentDB["Wallet"]["Points"] + FixedKillsCount = FixedDB["Kills"] + BrokenKillsCount = BrokenDB["Kills"] + CurrentKillsCount = CurrentDB["Kills"] + + NewPointsCount = BrokenPointsCount - FixedPointsCount + Kills = FixedKillsCount - BrokenKillsCount + NewBalance = Kills * 10 + NewBalance = NewBalance + CurrentPointsCount - NewPointsBalance = points_balance + CurrentUserKillsCount * 10 - - print("User",CurrentUserName, "Points Balance will be set to",NewPointsBalance) + db.TestUser.update_one( + { "UserId": j}, + { "$set": {"Wallet.Points": NewBalance}} + ) - db.Users.update_one( - - {"UserId": i}, - { "$set": { "Wallet.Points": NewPointsBalance}} - ) \ No newline at end of file + \ No newline at end of file From 0239194283d9dd50cd5711a105508ceb74dce268 Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Tue, 19 Sep 2023 20:27:56 -0400 Subject: [PATCH 03/20] Update InventoryAdjuster.py --- InventoryAdjuster.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/InventoryAdjuster.py b/InventoryAdjuster.py index b766f45..11af58e 100644 --- a/InventoryAdjuster.py +++ b/InventoryAdjuster.py @@ -12,9 +12,13 @@ GlobalModShirt = 1040 ModShirt = 1041 QAShirt = 1042 - +SLDShirt = 1044 +DEDShirt = 1045 +C4CShirt = 1046 +ST6IXShirt = 1047 +#Admins [1, 530], SeniorModerator [3, 38], SeniorQA [39], Moderator [2, 4], QA [5, 6, 7, 9, 30, 105] Cmids = [1] -ItemstoAdd = [AdminShirt, QAShirt, BetaHeroShirt] +ItemstoAdd = [AdminShirt] CmidRange = len(list(Cmids)) @@ -23,14 +27,14 @@ for Item in ItemstoAdd: ItemId = Item print("Item:",ItemId) - db.Test.update_one( + db.TestUser.update_one( {"UserId": i}, { "$addToSet": { "Inventory" : { "AmountRemaining": -1, "Cmid": i, "ExpirationDate": None, - "ItemId": Item + "ItemId": ItemId } }} ) \ No newline at end of file From 15c6efc5e73e3ec76a64cd12b7d62aebcff2af0f Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Fri, 22 Sep 2023 02:02:02 -0400 Subject: [PATCH 04/20] Updated the Scripts Updated Access Level Updater for doing Multiple Accounts at once. Uploading Modified Points Restore to New DB Script. --- AccessLevelUpdater.py | 68 ++++++++++++++++++---------------------- ModifiedPointsUpdater.py | 50 +++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 37 deletions(-) create mode 100644 ModifiedPointsUpdater.py diff --git a/AccessLevelUpdater.py b/AccessLevelUpdater.py index 4d07c50..bd58547 100644 --- a/AccessLevelUpdater.py +++ b/AccessLevelUpdater.py @@ -1,16 +1,4 @@ from pymongo import MongoClient -# pprint library is used to make the output look more pretty -from pprint import pprint -# connect to MongoDB, change the << MONGODB URL >> to reflect your own connection string - -Default = 0 -QA = 3 -Moderator = 4 -ModeratorHidden = 5 -SeniorQA = 6 -SeniorModerator = 7 -SeniorModeratorHidden = 9 -Admin = 10 client = MongoClient("mongodb://uber:admin@localhost:27017/?authMechanism=SCRAM-SHA-1&authSource=admin") db = client.admin @@ -19,29 +7,35 @@ total_accounts = len(list(result)) -cmid = 2 #Enter Cmid for User - -cmidAccess = Moderator #Enter Access Level from Enum Above - -db.Users.update_one( - {"UserId": cmid}, { "$set": { "Profile.AccessLevel": cmidAccess}} -) - -if cmidAccess == 10: - Role = "Admin" -elif cmidAccess == 9: - Role = "Senior Moderator Hidden" -elif cmidAccess == 7: - Role = "Senior Moderator" -elif cmidAccess == 6: - Role = "Senior QA" -elif cmidAccess == 5: - Role = "Moderator Hidden" -elif cmidAccess == 4: - Role = "Moderator" -elif cmidAccess == 3: - Role = "QA" -else: - Role = "Default" +Default = 0 +QA = 3 +Moderator = 4 +SeniorQA = 6 +SeniorModerator = 7 +Admin = 10 -print("Cmid:",cmid,"has been given",Role,"Access!") +Cmids = [1] #Enter Cmids for Users to Update [1, 2, 13] + +CmidsAccessLevels = Admin #Enter Access Level list above. +for Cmid in Cmids: + db.Users.update_one( + {"UserId": Cmid}, + { "$set": { + "Profile.AccessLevel": CmidsAccessLevels}} + + ) + GetUser = db.Users.find_one({"UserId": Cmid}) + Name = GetUser["Profile"]["Name"] + if CmidsAccessLevels == 10: + UserRole = "Admin" + elif CmidsAccessLevels == 7: + UserRole = "Senior Moderator" + elif CmidsAccessLevels == 6: + UserRole = "Senior QA" + elif CmidsAccessLevels == 4: + UserRole = "Moderator" + elif CmidsAccessLevels == 3: + UserRole = "QA" + else: + UserRole = "Default" + print({Cmid},Name,"has been given",UserRole,"Access!") diff --git a/ModifiedPointsUpdater.py b/ModifiedPointsUpdater.py new file mode 100644 index 0000000..84d4af5 --- /dev/null +++ b/ModifiedPointsUpdater.py @@ -0,0 +1,50 @@ +from pymongo import MongoClient + +client = MongoClient("mongodb://uber:admin@localhost:27017/?authMechanism=SCRAM-SHA-1&authSource=admin") +db = client.admin +collection = db["FixedUsers"] +collection2 = db["BrokenUsers"] +collection3 = db["Users"] + +result = db.Users.find() +total_accounts=len(list(result)) +AwardWinners = [2, 5, 13, 69, 71, 114, 118, 140, 224, 491, 555, 670, 815] + +for i in AwardWinners: + print("Cmid:",i) + BrokenDB = collection2.find_one({"UserId": i,}) + FixedDB = collection.find_one({"UserId": i}) + FixedPointsCount = FixedDB["Wallet"]["Points"] + BrokenPointsCount = BrokenDB["Wallet"]["Points"] + + AwardPoints = BrokenPointsCount + 50000 + + db.BrokenUsers.update_one( + {"UserId": i}, + { "$set": {"Wallet.Points": AwardPoints}} + ) + +for j in range(1,total_accounts+1): + print("Cmid:",j) + if j >= 1 and j <= 312 or j >= 314 and j <= 504 or j >= 506 and j <= 862: + BrokenDB = collection2.find_one({"UserId": j,}) + FixedDB = collection.find_one({"UserId": j}) + CurrentDB = collection3.find_one({"UserId": j}) + FixedPointsCount = FixedDB["Wallet"]["Points"] + BrokenPointsCount = BrokenDB["Wallet"]["Points"] + CurrentPointsCount = CurrentDB["Wallet"]["Points"] + FixedKillsCount = FixedDB["Kills"] + BrokenKillsCount = BrokenDB["Kills"] + CurrentKillsCount = CurrentDB["Kills"] + + NewPointsCount = BrokenPointsCount - FixedPointsCount + Kills = FixedKillsCount - BrokenKillsCount + NewBalance = Kills * 10 + NewBalance = NewBalance + CurrentPointsCount + + db.TestUser.update_one( + { "UserId": j}, + { "$set": {"Wallet.Points": NewBalance}} + ) + + \ No newline at end of file From 5a196627f2dadabd2b7caa5b6bdbf203fc1b8347 Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Fri, 22 Sep 2023 03:16:41 -0400 Subject: [PATCH 05/20] v2.0 --- InventoryAdjuster.py => AddSpecialShirts.py | 30 ++++++++++++++++----- NameChanger.py | 27 +++++++++++++++++++ 2 files changed, 51 insertions(+), 6 deletions(-) rename InventoryAdjuster.py => AddSpecialShirts.py (52%) create mode 100644 NameChanger.py diff --git a/InventoryAdjuster.py b/AddSpecialShirts.py similarity index 52% rename from InventoryAdjuster.py rename to AddSpecialShirts.py index 11af58e..81b90f1 100644 --- a/InventoryAdjuster.py +++ b/AddSpecialShirts.py @@ -1,9 +1,8 @@ from pymongo import MongoClient client = MongoClient("mongodb://uber:admin@localhost:27017/?authMechanism=SCRAM-SHA-1&authSource=admin") -db = client.admin -collection = db["Test"] +db = client.admin result = db.Test.find() total_accounts=len(list(result)) @@ -26,15 +25,34 @@ print("Cmid:",i) for Item in ItemstoAdd: ItemId = Item - print("Item:",ItemId) - db.TestUser.update_one( + + db.Users.update_one( {"UserId": i}, { "$addToSet": { "Inventory" : { "AmountRemaining": -1, "Cmid": i, "ExpirationDate": None, - "ItemId": ItemId + "ItemId": Item } }} - ) \ No newline at end of file + ) + if Item == AdminShirt: + ItemName = "Admin Shirt" + elif Item == BetaHeroShirt: + ItemName = "Beta Hero Shirt" + elif Item == GlobalModShirt: + ItemName = "Global Moderator Shirt" + elif Item == ModShirt: + ItemName = "Moderator Shirt" + elif Item == QAShirt: + ItemName = "QA Shirt" + elif Item == SLDShirt: + ItemName = "SLD Clan Shirt" + elif Item == C4CShirt: + ItemName = "C4C Clan Shirt" + elif Item == DEDShirt: + ItemName = "DED Clan Shirt" + elif Item == ST6IXShirt: + ItemName = "ST6IX Clan Shirt" + print("Item:",ItemName,"was added!") \ No newline at end of file diff --git a/NameChanger.py b/NameChanger.py new file mode 100644 index 0000000..edaa8e2 --- /dev/null +++ b/NameChanger.py @@ -0,0 +1,27 @@ +from profile import Profile +from pymongo import MongoClient + +client = MongoClient("mongodb://uber:admin@localhost:27017/?authMechanism=SCRAM-SHA-1&authSource=admin") +db = client.admin + +Cmid = 525 + +NameChange = "I am Cheater" + +CurrentUser = db.Users.find_one({"UserId": Cmid}) +CurrentName = CurrentUser["Profile"]["Name"] +db.Users.update_one( + {"UserId": Cmid}, + { "$set": + { "Profile.Name": NameChange } + } +) +db.Users.update_one( + {"UserId": Cmid}, + { "$addToSet" : + { "Names": CurrentName } + }, + upsert=True +) + +print("User", {Cmid}, "successfully changed their name from", [CurrentName], "to", [NameChange]) \ No newline at end of file From 8b60f4925fe3eb00ec89ea7fe6a417f645adf4c8 Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Fri, 22 Sep 2023 10:41:56 -0400 Subject: [PATCH 06/20] v3.0 Updated --- ModifiedPointsUpdater.py | 50 ---------------------------------------- PointsUpdater.py | 4 +--- 2 files changed, 1 insertion(+), 53 deletions(-) delete mode 100644 ModifiedPointsUpdater.py diff --git a/ModifiedPointsUpdater.py b/ModifiedPointsUpdater.py deleted file mode 100644 index 84d4af5..0000000 --- a/ModifiedPointsUpdater.py +++ /dev/null @@ -1,50 +0,0 @@ -from pymongo import MongoClient - -client = MongoClient("mongodb://uber:admin@localhost:27017/?authMechanism=SCRAM-SHA-1&authSource=admin") -db = client.admin -collection = db["FixedUsers"] -collection2 = db["BrokenUsers"] -collection3 = db["Users"] - -result = db.Users.find() -total_accounts=len(list(result)) -AwardWinners = [2, 5, 13, 69, 71, 114, 118, 140, 224, 491, 555, 670, 815] - -for i in AwardWinners: - print("Cmid:",i) - BrokenDB = collection2.find_one({"UserId": i,}) - FixedDB = collection.find_one({"UserId": i}) - FixedPointsCount = FixedDB["Wallet"]["Points"] - BrokenPointsCount = BrokenDB["Wallet"]["Points"] - - AwardPoints = BrokenPointsCount + 50000 - - db.BrokenUsers.update_one( - {"UserId": i}, - { "$set": {"Wallet.Points": AwardPoints}} - ) - -for j in range(1,total_accounts+1): - print("Cmid:",j) - if j >= 1 and j <= 312 or j >= 314 and j <= 504 or j >= 506 and j <= 862: - BrokenDB = collection2.find_one({"UserId": j,}) - FixedDB = collection.find_one({"UserId": j}) - CurrentDB = collection3.find_one({"UserId": j}) - FixedPointsCount = FixedDB["Wallet"]["Points"] - BrokenPointsCount = BrokenDB["Wallet"]["Points"] - CurrentPointsCount = CurrentDB["Wallet"]["Points"] - FixedKillsCount = FixedDB["Kills"] - BrokenKillsCount = BrokenDB["Kills"] - CurrentKillsCount = CurrentDB["Kills"] - - NewPointsCount = BrokenPointsCount - FixedPointsCount - Kills = FixedKillsCount - BrokenKillsCount - NewBalance = Kills * 10 - NewBalance = NewBalance + CurrentPointsCount - - db.TestUser.update_one( - { "UserId": j}, - { "$set": {"Wallet.Points": NewBalance}} - ) - - \ No newline at end of file diff --git a/PointsUpdater.py b/PointsUpdater.py index 5910124..8313deb 100644 --- a/PointsUpdater.py +++ b/PointsUpdater.py @@ -35,9 +35,7 @@ CurrentPointsCount = CurrentDB["Wallet"]["Points"] FixedKillsCount = FixedDB["Kills"] BrokenKillsCount = BrokenDB["Kills"] - CurrentKillsCount = CurrentDB["Kills"] - - NewPointsCount = BrokenPointsCount - FixedPointsCount + Kills = FixedKillsCount - BrokenKillsCount NewBalance = Kills * 10 NewBalance = NewBalance + CurrentPointsCount From b6a1178cf93c06c5e482ee30486d0cc685c32bb7 Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Fri, 22 Sep 2023 10:47:23 -0400 Subject: [PATCH 07/20] Adding missing line --- PointsUpdater.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PointsUpdater.py b/PointsUpdater.py index 8313deb..5910124 100644 --- a/PointsUpdater.py +++ b/PointsUpdater.py @@ -35,7 +35,9 @@ CurrentPointsCount = CurrentDB["Wallet"]["Points"] FixedKillsCount = FixedDB["Kills"] BrokenKillsCount = BrokenDB["Kills"] - + CurrentKillsCount = CurrentDB["Kills"] + + NewPointsCount = BrokenPointsCount - FixedPointsCount Kills = FixedKillsCount - BrokenKillsCount NewBalance = Kills * 10 NewBalance = NewBalance + CurrentPointsCount From eb5fca6c7f2022d28cfaad1ffcc33f6d77accef5 Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Fri, 22 Sep 2023 11:07:30 -0400 Subject: [PATCH 08/20] updating scripts --- PointsUpdater.py | 52 +++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/PointsUpdater.py b/PointsUpdater.py index 5910124..add5d80 100644 --- a/PointsUpdater.py +++ b/PointsUpdater.py @@ -2,49 +2,51 @@ client = MongoClient("mongodb://uber:admin@localhost:27017/?authMechanism=SCRAM-SHA-1&authSource=admin") db = client.admin -collection = db["FixedUsers"] -collection2 = db["BrokenUsers"] -collection3 = db["Users"] +CollectionFixedUsers = db["FixedUsers"] +CollectionBrokenUsers = db["BrokenUsers"] +CollectionCurrentUsers = db["Users"] result = db.Users.find() total_accounts=len(list(result)) -AwardWinners = [2, 5, 13, 69, 71, 114, 118, 140, 224, 491, 555, 670, 815] - -for i in AwardWinners: - print("Cmid:",i) - BrokenDB = collection2.find_one({"UserId": i,}) - FixedDB = collection.find_one({"UserId": i}) - FixedPointsCount = FixedDB["Wallet"]["Points"] - BrokenPointsCount = BrokenDB["Wallet"]["Points"] - - AwardPoints = BrokenPointsCount + 50000 - - db.BrokenUsers.update_one( - {"UserId": i}, - { "$set": {"Wallet.Points": AwardPoints}} - ) +AwardWinners = [2, 5, 13, 69, 71, 114, 118, 140, 224, 491, 555, 670, 815, 883] for j in range(1,total_accounts+1): print("Cmid:",j) if j >= 1 and j <= 312 or j >= 314 and j <= 504 or j >= 506 and j <= 862: - BrokenDB = collection2.find_one({"UserId": j,}) - FixedDB = collection.find_one({"UserId": j}) - CurrentDB = collection3.find_one({"UserId": j}) + BrokenDB = CollectionBrokenUsers.find_one({"UserId": j,}) + FixedDB = CollectionFixedUsers.find_one({"UserId": j}) + CurrentDB = CollectionCurrentUsers.find_one({"UserId": j}) FixedPointsCount = FixedDB["Wallet"]["Points"] BrokenPointsCount = BrokenDB["Wallet"]["Points"] CurrentPointsCount = CurrentDB["Wallet"]["Points"] FixedKillsCount = FixedDB["Kills"] BrokenKillsCount = BrokenDB["Kills"] CurrentKillsCount = CurrentDB["Kills"] - + NewPointsCount = BrokenPointsCount - FixedPointsCount Kills = FixedKillsCount - BrokenKillsCount NewBalance = Kills * 10 NewBalance = NewBalance + CurrentPointsCount - - db.TestUser.update_one( + for i in AwardWinners: + NewBalance = NewBalance + 50000 + + db.Users.update_one( { "UserId": j}, { "$set": {"Wallet.Points": NewBalance}} ) - + if j >= 863: + FixedDB = CollectionFixedUsers.find_one({"UserId": j}) + CurrentDB = CollectionCurrentUsers.find_one({"UserId": j}) + CurrentPointsCount = CurrentDB["Wallet"]["Points"] + CurrentKillsCount = CurrentDB["Kills"] + NewBalance = Kills * 10 + NewBalance = NewBalance + CurrentPointsCount + db.Users.update_one( + { "UserId": j}, + { "$set": {"Wallet.Points": NewBalance}} + ) + + + + \ No newline at end of file From 7e7d16b64df50c5e5c06115bad459e25d7abaf16 Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Fri, 22 Sep 2023 11:12:44 -0400 Subject: [PATCH 09/20] updates --- PointsUpdater.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PointsUpdater.py b/PointsUpdater.py index add5d80..5e8151b 100644 --- a/PointsUpdater.py +++ b/PointsUpdater.py @@ -22,8 +22,7 @@ FixedKillsCount = FixedDB["Kills"] BrokenKillsCount = BrokenDB["Kills"] CurrentKillsCount = CurrentDB["Kills"] - - NewPointsCount = BrokenPointsCount - FixedPointsCount + Kills = FixedKillsCount - BrokenKillsCount NewBalance = Kills * 10 NewBalance = NewBalance + CurrentPointsCount @@ -41,11 +40,13 @@ CurrentKillsCount = CurrentDB["Kills"] NewBalance = Kills * 10 NewBalance = NewBalance + CurrentPointsCount + if j == 883: + NewBalance = NewBalance + 50000 db.Users.update_one( { "UserId": j}, { "$set": {"Wallet.Points": NewBalance}} ) - +#print("User:",j,"Points:",NewBalance) From a0f28ed84fb559be86fbd1fa02a6f21acd900871 Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Fri, 22 Sep 2023 11:27:45 -0400 Subject: [PATCH 10/20] updating --- PointsUpdater.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/PointsUpdater.py b/PointsUpdater.py index 5e8151b..9a70663 100644 --- a/PointsUpdater.py +++ b/PointsUpdater.py @@ -8,10 +8,21 @@ result = db.Users.find() total_accounts=len(list(result)) -AwardWinners = [2, 5, 13, 69, 71, 114, 118, 140, 224, 491, 555, 670, 815, 883] + +def addPointsToAwardWinners() + AwardWinners = [2, 5, 13, 69, 71, 114, 118, 140, 224, 491, 555, 670, 815, 883] + for i in AwardWinners: + AwardBalance = NewBalance + 50000 + + db.Users.update_one( + { "UserId": j}, + { "$set": {"Wallet.Points": AwardBalance}} + ) + +addPointsToAwardWinners() + for j in range(1,total_accounts+1): - print("Cmid:",j) if j >= 1 and j <= 312 or j >= 314 and j <= 504 or j >= 506 and j <= 862: BrokenDB = CollectionBrokenUsers.find_one({"UserId": j,}) FixedDB = CollectionFixedUsers.find_one({"UserId": j}) @@ -23,11 +34,10 @@ BrokenKillsCount = BrokenDB["Kills"] CurrentKillsCount = CurrentDB["Kills"] - Kills = FixedKillsCount - BrokenKillsCount - NewBalance = Kills * 10 + AddPointsforKills = FixedKillsCount - BrokenKillsCount + NewBalance = AddPointsforKills * 10 NewBalance = NewBalance + CurrentPointsCount - for i in AwardWinners: - NewBalance = NewBalance + 50000 + db.Users.update_one( { "UserId": j}, @@ -38,10 +48,9 @@ CurrentDB = CollectionCurrentUsers.find_one({"UserId": j}) CurrentPointsCount = CurrentDB["Wallet"]["Points"] CurrentKillsCount = CurrentDB["Kills"] - NewBalance = Kills * 10 + NewBalance = CurrentKillsCount * 10 NewBalance = NewBalance + CurrentPointsCount - if j == 883: - NewBalance = NewBalance + 50000 + db.Users.update_one( { "UserId": j}, { "$set": {"Wallet.Points": NewBalance}} From 6b83411366cee479b62c99c0499a7c8d5e7c73fe Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Fri, 22 Sep 2023 11:31:45 -0400 Subject: [PATCH 11/20] updating --- PointsUpdater.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PointsUpdater.py b/PointsUpdater.py index 9a70663..dcb150d 100644 --- a/PointsUpdater.py +++ b/PointsUpdater.py @@ -11,8 +11,10 @@ def addPointsToAwardWinners() AwardWinners = [2, 5, 13, 69, 71, 114, 118, 140, 224, 491, 555, 670, 815, 883] - for i in AwardWinners: - AwardBalance = NewBalance + 50000 + for h in AwardWinners: + CurrentDB = CollectionCurrentUsers.find_one({"UserId": h}) + CurrentPointsCount = CurrentDB["Wallet"]["Points"] + AwardBalance = CurrentPointsCount + 50000 db.Users.update_one( { "UserId": j}, From fe82124e5cedd15851bd4c38a81e47ac03afdc6e Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Fri, 22 Sep 2023 11:33:18 -0400 Subject: [PATCH 12/20] Updating --- PointsUpdater.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PointsUpdater.py b/PointsUpdater.py index dcb150d..9c90050 100644 --- a/PointsUpdater.py +++ b/PointsUpdater.py @@ -38,12 +38,12 @@ def addPointsToAwardWinners() AddPointsforKills = FixedKillsCount - BrokenKillsCount NewBalance = AddPointsforKills * 10 - NewBalance = NewBalance + CurrentPointsCount + LiveBalance = NewBalance + CurrentPointsCount db.Users.update_one( { "UserId": j}, - { "$set": {"Wallet.Points": NewBalance}} + { "$set": {"Wallet.Points": LiveBalance}} ) if j >= 863: FixedDB = CollectionFixedUsers.find_one({"UserId": j}) @@ -51,11 +51,11 @@ def addPointsToAwardWinners() CurrentPointsCount = CurrentDB["Wallet"]["Points"] CurrentKillsCount = CurrentDB["Kills"] NewBalance = CurrentKillsCount * 10 - NewBalance = NewBalance + CurrentPointsCount + LiveBalance = NewBalance + CurrentPointsCount db.Users.update_one( { "UserId": j}, - { "$set": {"Wallet.Points": NewBalance}} + { "$set": {"Wallet.Points": LiveBalance}} ) #print("User:",j,"Points:",NewBalance) From d52e9dc4d06871970e5986e16217be5f9e5ab03c Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Fri, 22 Sep 2023 11:34:33 -0400 Subject: [PATCH 13/20] Update --- PointsUpdater.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PointsUpdater.py b/PointsUpdater.py index 9c90050..16a42a8 100644 --- a/PointsUpdater.py +++ b/PointsUpdater.py @@ -17,7 +17,7 @@ def addPointsToAwardWinners() AwardBalance = CurrentPointsCount + 50000 db.Users.update_one( - { "UserId": j}, + { "UserId": h}, { "$set": {"Wallet.Points": AwardBalance}} ) From 1b361352c83355c49e3dbe7535b456546a4c959a Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Sat, 23 Sep 2023 07:33:58 -0400 Subject: [PATCH 14/20] Updating Points Script --- PointsUpdater.py | 69 ++++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/PointsUpdater.py b/PointsUpdater.py index 16a42a8..e885ee0 100644 --- a/PointsUpdater.py +++ b/PointsUpdater.py @@ -8,24 +8,29 @@ result = db.Users.find() total_accounts=len(list(result)) +AwardWinners = [2, 5, 13, 69, 71, 114, 118, 140, 224, 491, 555, 670, 815, 883] -def addPointsToAwardWinners() - AwardWinners = [2, 5, 13, 69, 71, 114, 118, 140, 224, 491, 555, 670, 815, 883] - for h in AwardWinners: - CurrentDB = CollectionCurrentUsers.find_one({"UserId": h}) - CurrentPointsCount = CurrentDB["Wallet"]["Points"] - AwardBalance = CurrentPointsCount + 50000 +#for i in range(1,total_accounts+1): +for i in AwardWinners: + print("Cmid:",i) + BrokenDB = CollectionBrokenUsers.find_one({"UserId": i,}) + FixedDB = CollectionFixedUsers.find_one({"UserId": i}) + FixedPointsCount = FixedDB["Wallet"]["Points"] + BrokenPointsCount = BrokenDB["Wallet"]["Points"] - db.Users.update_one( - { "UserId": h}, - { "$set": {"Wallet.Points": AwardBalance}} - ) + AwardPoints = BrokenPointsCount + 50000 -addPointsToAwardWinners() + # AwardBalanceUsed = AwardPoints - FixedPointsCount + # print("Cmid:",{i},"Used",AwardBalanceUsed,"Points.") + db.BrokenUsers.update_one( + {"UserId": i}, + { "$set": {"Wallet.Points": AwardPoints}} + ) for j in range(1,total_accounts+1): - if j >= 1 and j <= 312 or j >= 314 and j <= 504 or j >= 506 and j <= 862: + print("Cmid:",j) + if j >= 1 and j <= 312 or j >= 314 and j <= 504 or j >= 506 and j <= 894: BrokenDB = CollectionBrokenUsers.find_one({"UserId": j,}) FixedDB = CollectionFixedUsers.find_one({"UserId": j}) CurrentDB = CollectionCurrentUsers.find_one({"UserId": j}) @@ -35,30 +40,30 @@ def addPointsToAwardWinners() FixedKillsCount = FixedDB["Kills"] BrokenKillsCount = BrokenDB["Kills"] CurrentKillsCount = CurrentDB["Kills"] - - AddPointsforKills = FixedKillsCount - BrokenKillsCount - NewBalance = AddPointsforKills * 10 - LiveBalance = NewBalance + CurrentPointsCount - - db.Users.update_one( - { "UserId": j}, - { "$set": {"Wallet.Points": LiveBalance}} - ) - if j >= 863: + AccountBalanceUsed = BrokenPointsCount - FixedPointsCount + print("Balance Used w/o Adding New Kills.",AccountBalanceUsed) + KillsforPointsAdded = FixedKillsCount - BrokenKillsCount + KillsAddedBalance = KillsforPointsAdded * 10 + BalancebeforeLive = KillsAddedBalance + CurrentPointsCount + print("Balance w/ New Kills",BalancebeforeLive) + LiveBalance = BalancebeforeLive + AccountBalanceUsed + print("Live Balance",LiveBalance) + # db.TestUser.update_one( + # { "UserId": j}, + # { "$set": {"Wallet.Points": LiveBalance}} + # ) + if j >= 894: FixedDB = CollectionFixedUsers.find_one({"UserId": j}) CurrentDB = CollectionCurrentUsers.find_one({"UserId": j}) CurrentPointsCount = CurrentDB["Wallet"]["Points"] CurrentKillsCount = CurrentDB["Kills"] - NewBalance = CurrentKillsCount * 10 - LiveBalance = NewBalance + CurrentPointsCount + KillsAddedBalance = CurrentKillsCount * 10 + LiveBalance = KillsAddedBalance + CurrentPointsCount - db.Users.update_one( - { "UserId": j}, - { "$set": {"Wallet.Points": LiveBalance}} - ) -#print("User:",j,"Points:",NewBalance) - - - + # db.Users.update_one( + # { "UserId": j}, + # { "$set": {"Wallet.Points": LiveBalance}} + # ) + print("User:",j,"Live Balance:",LiveBalance) \ No newline at end of file From a430ea72b5eeebea88ea87af8b8a398fb4c61acc Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Sat, 23 Sep 2023 08:12:09 -0400 Subject: [PATCH 15/20] Updating --- PointsUpdater.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PointsUpdater.py b/PointsUpdater.py index e885ee0..6acd440 100644 --- a/PointsUpdater.py +++ b/PointsUpdater.py @@ -53,14 +53,17 @@ # { "UserId": j}, # { "$set": {"Wallet.Points": LiveBalance}} # ) - if j >= 894: + if j >= 894 and j <=1915: FixedDB = CollectionFixedUsers.find_one({"UserId": j}) CurrentDB = CollectionCurrentUsers.find_one({"UserId": j}) CurrentPointsCount = CurrentDB["Wallet"]["Points"] + FixedPointsCount = FixedDB["Wallet"]["Points"] CurrentKillsCount = CurrentDB["Kills"] KillsAddedBalance = CurrentKillsCount * 10 - LiveBalance = KillsAddedBalance + CurrentPointsCount + AccountBalanceUsed = CurrentPointsCount - FixedPointsCount + print("Balance Used:",AccountBalanceUsed) + LiveBalance = AccountBalanceUsed + CurrentPointsCount # db.Users.update_one( # { "UserId": j}, # { "$set": {"Wallet.Points": LiveBalance}} From 97d66092c6c6d3e3c22d15d76329807d1b118a82 Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Sat, 23 Sep 2023 08:20:38 -0400 Subject: [PATCH 16/20] Update --- PointsUpdater.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PointsUpdater.py b/PointsUpdater.py index 6acd440..5904587 100644 --- a/PointsUpdater.py +++ b/PointsUpdater.py @@ -61,7 +61,7 @@ CurrentKillsCount = CurrentDB["Kills"] KillsAddedBalance = CurrentKillsCount * 10 - AccountBalanceUsed = CurrentPointsCount - FixedPointsCount + AccountBalanceUsed = 10000 - FixedPointsCount print("Balance Used:",AccountBalanceUsed) LiveBalance = AccountBalanceUsed + CurrentPointsCount # db.Users.update_one( From 9d301b81cadbfe76284a972551c5a7765fda647b Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Sat, 23 Sep 2023 08:24:24 -0400 Subject: [PATCH 17/20] Updates --- PointsUpdater.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PointsUpdater.py b/PointsUpdater.py index 5904587..d0cd2fa 100644 --- a/PointsUpdater.py +++ b/PointsUpdater.py @@ -63,7 +63,7 @@ AccountBalanceUsed = 10000 - FixedPointsCount print("Balance Used:",AccountBalanceUsed) - LiveBalance = AccountBalanceUsed + CurrentPointsCount + LiveBalance = AccountBalanceUsed + CurrentPointsCount + KillsAddedBalance # db.Users.update_one( # { "UserId": j}, # { "$set": {"Wallet.Points": LiveBalance}} From ae8f325a2e38669c8f1c165abc6fc8221cfd2439 Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Sat, 23 Sep 2023 08:39:05 -0400 Subject: [PATCH 18/20] 20 points --- PointsUpdater.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PointsUpdater.py b/PointsUpdater.py index d0cd2fa..38a32ab 100644 --- a/PointsUpdater.py +++ b/PointsUpdater.py @@ -44,7 +44,7 @@ AccountBalanceUsed = BrokenPointsCount - FixedPointsCount print("Balance Used w/o Adding New Kills.",AccountBalanceUsed) KillsforPointsAdded = FixedKillsCount - BrokenKillsCount - KillsAddedBalance = KillsforPointsAdded * 10 + KillsAddedBalance = KillsforPointsAdded * 20 BalancebeforeLive = KillsAddedBalance + CurrentPointsCount print("Balance w/ New Kills",BalancebeforeLive) LiveBalance = BalancebeforeLive + AccountBalanceUsed @@ -59,7 +59,7 @@ CurrentPointsCount = CurrentDB["Wallet"]["Points"] FixedPointsCount = FixedDB["Wallet"]["Points"] CurrentKillsCount = CurrentDB["Kills"] - KillsAddedBalance = CurrentKillsCount * 10 + KillsAddedBalance = CurrentKillsCount * 20 AccountBalanceUsed = 10000 - FixedPointsCount print("Balance Used:",AccountBalanceUsed) From 115e711ad5168ef309c003d20e2df69443cd1577 Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Sat, 23 Sep 2023 08:46:36 -0400 Subject: [PATCH 19/20] Changing Directory --- PointsUpdater.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/PointsUpdater.py b/PointsUpdater.py index 38a32ab..3e6cdc5 100644 --- a/PointsUpdater.py +++ b/PointsUpdater.py @@ -49,10 +49,10 @@ print("Balance w/ New Kills",BalancebeforeLive) LiveBalance = BalancebeforeLive + AccountBalanceUsed print("Live Balance",LiveBalance) - # db.TestUser.update_one( - # { "UserId": j}, - # { "$set": {"Wallet.Points": LiveBalance}} - # ) + db.Users.update_one( + { "UserId": j}, + { "$set": {"Wallet.Points": LiveBalance}} + ) if j >= 894 and j <=1915: FixedDB = CollectionFixedUsers.find_one({"UserId": j}) CurrentDB = CollectionCurrentUsers.find_one({"UserId": j}) @@ -64,9 +64,9 @@ AccountBalanceUsed = 10000 - FixedPointsCount print("Balance Used:",AccountBalanceUsed) LiveBalance = AccountBalanceUsed + CurrentPointsCount + KillsAddedBalance - # db.Users.update_one( - # { "UserId": j}, - # { "$set": {"Wallet.Points": LiveBalance}} - # ) + db.Users.update_one( + { "UserId": j}, + { "$set": {"Wallet.Points": LiveBalance}} + ) print("User:",j,"Live Balance:",LiveBalance) \ No newline at end of file From 48e2245a7d923184dfc3ab6c2010410ed267e4b5 Mon Sep 17 00:00:00 2001 From: xVizier <143770098+xVizier@users.noreply.github.com> Date: Sat, 30 Sep 2023 09:38:41 -0400 Subject: [PATCH 20/20] Updated Access Level and Created Database Backup Script --- AccessLevelUpdater.py | 84 ++++++++++++++++++++++++++++++++++--------- DatabaseBackup.py | 22 ++++++++++++ 2 files changed, 89 insertions(+), 17 deletions(-) create mode 100644 DatabaseBackup.py diff --git a/AccessLevelUpdater.py b/AccessLevelUpdater.py index bd58547..a791055 100644 --- a/AccessLevelUpdater.py +++ b/AccessLevelUpdater.py @@ -6,36 +6,86 @@ result = db.users.find() total_accounts = len(list(result)) - +#Roles Default = 0 QA = 3 Moderator = 4 SeniorQA = 6 +Developer = 6 SeniorModerator = 7 Admin = 10 -Cmids = [1] #Enter Cmids for Users to Update [1, 2, 13] +#Shirts +AdminShirt = 1037 +BetaHeroShirt = 1038 +GlobalModShirt = 1040 +ModShirt = 1041 +QAShirt = 1042 + +Cmids = [39] #Enter Cmids for Users to Update [1, 2, 13] -CmidsAccessLevels = Admin #Enter Access Level list above. +CmidsAccessLevels = SeniorQA #Enter Access Level list above. for Cmid in Cmids: db.Users.update_one( {"UserId": Cmid}, { "$set": { - "Profile.AccessLevel": CmidsAccessLevels}} - + "Profile.AccessLevel": CmidsAccessLevels}} ) + AddShirts = True GetUser = db.Users.find_one({"UserId": Cmid}) Name = GetUser["Profile"]["Name"] - if CmidsAccessLevels == 10: - UserRole = "Admin" - elif CmidsAccessLevels == 7: - UserRole = "Senior Moderator" - elif CmidsAccessLevels == 6: - UserRole = "Senior QA" - elif CmidsAccessLevels == 4: - UserRole = "Moderator" - elif CmidsAccessLevels == 3: - UserRole = "QA" + match CmidsAccessLevels: + case 10: + UserRole = "Admin" + ShirtstoAdd = [AdminShirt] + case 7: + UserRole = "Senior Moderator" + ShirtstoAdd = [GlobalModShirt, ModShirt] + case 6: + UserRole = "Senior QA" + ShirtstoAdd = [QAShirt] + case 4: + UserRole = "Moderator" + ShirtstoAdd = [ModShirt] + case 3: + UserRole = "QA" + ShirtstoAdd = [QAShirt] + case _: + UserRole = "Default" + AddShirts = False + + + + if AddShirts == True: + print(f"User: {Cmid} with Name: {Name} has been given {UserRole} Access and will receive the following shirts!") + for ItemId in ShirtstoAdd: + db.Users.update_one( + {"UserId": Cmid}, + { "$addToSet": { "Inventory" : + { + "AmountRemaining": -1, + "Cmid": Cmid, + "ExpirationDate": None, + "ItemId": ItemId + } + }} + ) + match ItemId: + case 1037: + Shirt = "Admin Shirt" + case 1038: + Shirt = "Beta Hero Shirt" + case 1040: + Shirt = "Global Moderator Shirt" + case 1041: + Shirt = "Moderator Shirt" + case 1042: + Shirt = "QA Shirt" + print(Shirt) else: - UserRole = "Default" - print({Cmid},Name,"has been given",UserRole,"Access!") + print(f"User: {Cmid} with Name: {Name} has been given {UserRole} Access!") + + + + + diff --git a/DatabaseBackup.py b/DatabaseBackup.py new file mode 100644 index 0000000..7bcd276 --- /dev/null +++ b/DatabaseBackup.py @@ -0,0 +1,22 @@ +import os +from datetime import date +# Date is used for the Folder Name +GetDate = date.today() +Today=str(GetDate) +# Converted to String. +FormattedDate = Today.replace('-', '') +# Removes the '-' from the date. + +FolderName = "Backup_"+FormattedDate +# Assigns the Folder Name to be created +CurrentDirectory = os.getcwd() +# Retrieves the Current Directory from System +os.makedirs(FolderName) +# Creates the Backup Folder with date as unique identifier +os.chdir(FolderName) +# Changes the Directory to the current folder. +try: + os.system('cmd /k "mongodump --host localhost:27017 --username uber --password admin --authenticationDatabase admin"') +except: + print('Could not execute command') +# Opens CMD and Runs the MongoDump Command. \ No newline at end of file