lol changes

This commit is contained in:
Jackzie 2021-10-03 15:23:51 -05:00
parent f756ec3100
commit 440808c0c5
No known key found for this signature in database
GPG key ID: 1E834FE36520537A
21 changed files with 868 additions and 301 deletions

View file

@ -12,7 +12,7 @@ public int Insta_PlayerHandler(Menu menu, MenuAction action, int client, int par
Menu spMenu = new Menu(Insta_SpecialHandler);
spMenu.SetTitle("Choose a Insta-Special™");
for(int i = 1; i <= 6; i++) {
for(int i = 1; i <= 8; i++) {
Format(info, sizeof(info), "%d|%d|%d", userid, instaMode, i);
spMenu.AddItem(info, SPECIAL_NAMES[i-1]);
}
@ -33,11 +33,19 @@ public int Insta_SpecialHandler(Menu menu, MenuAction action, int client, int pa
bool inFace = StrEqual(str[1], "1");
int special = StringToInt(str[2]);
if(inFace) {
SpawnSpecialInFace(target, special);
ShowActivity(client, "spawned Insta-%s™ near %N", SPECIAL_NAMES[special-1], target);
if(SpawnSpecialInFace(target, special)) {
LogAction(client, target, "\"%L\" spawned Insta-%s™ on \"%L\"", client, SPECIAL_NAMES[special-1], target);
ShowActivityEx(client, "[FTT] ", "spawned Insta-%s™ on %N", SPECIAL_NAMES[special-1], target);
} else {
ReplyToCommand(client, "Could not spawn special.");
}
} else {
SpawnSpecialNear(target, special);
ShowActivity(client, "spawned Insta-%s™ near %N", SPECIAL_NAMES[special-1], target);
if(SpawnSpecialNear(target, special)) {
LogAction(client, target, "\"%L\" spawned Insta-%s™ near \"%L\"", client, SPECIAL_NAMES[special-1], target);
ShowActivityEx(client, "[FTT] ", "spawned Insta-%s™ near %N", SPECIAL_NAMES[special-1], target);
} else {
ReplyToCommand(client, "Could not spawn special.");
}
}
} else if (action == MenuAction_End)
delete menu;
@ -66,26 +74,32 @@ public int ChoosePlayerHandler(Menu menu, MenuAction action, int param1, int par
delete menu;
}
static int iMenuVictimID[MAXPLAYERS+1];
public int ChooseCategoryHandler(Menu menu, MenuAction action, int param1, int param2) {
if (action == MenuAction_Select) {
if (action == MenuAction_Cancel && param2 == MenuCancel_ExitBack)
ShowTrollMenu(param1);
else if (action == MenuAction_Select) {
static char info[32];
menu.GetItem(param2, info, sizeof(info));
static char str[2][8];
ExplodeString(info, "|", str, 2, 8, false);
int userid = StringToInt(str[0]);
iMenuVictimID[param1] = userid;
int category = StringToInt(str[1]);
// Reset troll:
if(category == -1) {
ApplyTroll(GetClientOfUserId(userid), "Reset User", param1, TrollMod_Instant);
return;
}
Menu trollMenu = new Menu(ChooseModeMenuHandler);
GetCategory(category, info, sizeof(info));
Format(info, sizeof(info), "Category: %s", info);
trollMenu.SetTitle(info);
//TODO: Update
static Troll troll;
// add 'return' btn
Format(info, sizeof(info), "%d|-1", userid);
trollMenu.AddItem(info, "<= Go Back");
// Add all menus that have same category
for(int i = 0; i < trollKV.Size; i++) {
GetTrollByKeyIndex(i, troll);
@ -95,30 +109,32 @@ public int ChooseCategoryHandler(Menu menu, MenuAction action, int param1, int p
}
}
trollMenu.ExitButton = true;
trollMenu.ExitBackButton = true;
trollMenu.Display(param1, 0);
} else if (action == MenuAction_End)
delete menu;
}
public int ChooseModeMenuHandler(Menu menu, MenuAction action, int param1, int param2) {
if (action == MenuAction_Select) {
static char info[16];
if (action == MenuAction_Cancel) {
if(param2 == MenuCancel_ExitBack) {
if(iMenuVictimID[param1] == 0) {
ReplyToCommand(param1, "FTT: Could not acquire player");
}
SetupCategoryMenu(param1, iMenuVictimID[param1]);
}
} else if (action == MenuAction_Select) {
static char info[32];
menu.GetItem(param2, info, sizeof(info));
static char str[2][8];
ExplodeString(info, "|", str, 2, 8, false);
int userid = StringToInt(str[0]);
int client = GetClientOfUserId(userid);
int keyIndex = StringToInt(str[1]);
if(keyIndex == -1) {
SetupCategoryMenu(param1, userid);
return;
}
static Troll troll;
static char trollID[MAX_TROLL_NAME_LENGTH];
GetTrollByKeyIndex(keyIndex, troll);
troll.GetID(trollID);
//If troll has multiple flags, prompt:
if(StrEqual(trollID, "ThrowItAll")) {
if(StrEqual(troll.name, "Throw It All")) {
// Setup menu to call itself, but with an extra data point
Menu itmMenu = new Menu(ChooseClumsySlotHandler);
itmMenu.SetTitle("Choose Item To Throw");
@ -138,10 +154,11 @@ public int ChooseModeMenuHandler(Menu menu, MenuAction action, int param1, int p
itmMenu.Display(param1, 0);
} else if(troll.HasMod(TrollMod_Instant) && troll.HasMod(TrollMod_Constant)) {
Menu modiferMenu = new Menu(ChooseTrollModiferHandler);
modiferMenu.SetTitle("Choose Troll Modifer Option");
Format(info, sizeof(info), "%s: Choose Modifier", troll.name);
modiferMenu.SetTitle(info);
Format(info, sizeof(info), "%d|%d|1", userid, keyIndex);
modiferMenu.AddItem(info, "Activate once");
modiferMenu.AddItem(info, "Activate Once");
Format(info, sizeof(info), "%d|%d|2", userid, keyIndex);
modiferMenu.AddItem(info, "Activate Periodically");
Format(info, sizeof(info), "%d|%d|3", userid, keyIndex);
@ -150,7 +167,7 @@ public int ChooseModeMenuHandler(Menu menu, MenuAction action, int param1, int p
modiferMenu.ExitButton = true;
modiferMenu.Display(param1, 0);
} else {
ApplyTroll(client, trollID, param1, troll.GetDefaultMod());
troll.Activate(client, param1);
}
} else if (action == MenuAction_End)
delete menu;
@ -164,15 +181,19 @@ public int ChooseClumsySlotHandler(Menu menu, MenuAction action, int param1, int
ExplodeString(info, "|", str, 2, 8, false);
int client = GetClientOfUserId(StringToInt(str[0]));
int slot = StringToInt(str[1]);
PrintToChatAll("%d", slot);
if(slot == -1) {
if(client == 0) {
ReplyToCommand(param1, "FTT: Could not acquire player");
return;
}else if(slot == -1) {
for(int i = 0; i <= 4; i++) {
ThrowItemToClosestPlayer(client, i);
}
} else {
ThrowItemToClosestPlayer(client, slot);
}
ShowActivity(param1, "activated troll \"Throw It All\" for %N. ", client);
LogAction(param1, client, "\"%L\" activated troll \"Throw It all\" for \"%L\"", param1, client);
ShowActivityEx(param1, "[FTT] ", "activated troll \"Throw It All\" for %N. ", client);
} else if (action == MenuAction_End)
delete menu;
}
@ -187,15 +208,18 @@ public int ChooseTrollModiferHandler(Menu menu, MenuAction action, int param1, i
int keyIndex = StringToInt(str[1]);
int flags = StringToInt(str[2]);
if(client == 0) {
ReplyToCommand(param1, "FTT: Could not acquire player");
return;
}
static Troll troll;
GetTrollByKeyIndex(keyIndex, troll);
if(flags == 1 || flags == 3)
troll.Activate(client, param1, TrollMod_Instant);
// ApplyTroll(client, trollID, param1, TrollMod_Instant);
if(flags == 2 || flags == 3)
troll.Activate(client, param1, TrollMod_Constant);
// ApplyTroll(client, trollID, param1, TrollMod_Constant);
troll.Activate(client, param1, TrollMod_Constant);
} else if (action == MenuAction_End)
delete menu;
}
@ -206,13 +230,37 @@ public void StopItemGive(int client) {
void SetupCategoryMenu(int client, int victimUserID) {
Menu categoryMenu = new Menu(ChooseCategoryHandler);
categoryMenu.SetTitle("Choose a troll category");
static char category[16], id[8];
static char category[64], id[8];
Format(category, sizeof(category), "%N: Choose troll category", GetClientOfUserId(victimUserID));
categoryMenu.SetTitle(category);
Format(id, sizeof(id), "%d|-1", victimUserID);
categoryMenu.AddItem(id, "Reset User");
for(int i = 0; i < categories.Length; i++) {
categories.GetString(i, category, sizeof(category));
Format(id, sizeof(id), "%d|%d", victimUserID, i);
categoryMenu.AddItem(id, category);
}
categoryMenu.ExitButton = true;
categoryMenu.ExitBackButton = true;
categoryMenu.Display(client, 0);
}
void ShowTrollMenu(int client) {
Menu menu = new Menu(ChoosePlayerHandler);
menu.SetTitle("Choose a player to troll");
static char userid[8], display[32];
for(int i = 1; i <= MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2) {
IntToString(GetClientUserId(i), userid, sizeof(userid));
int specClient = GetSpectatorClient(i);
if(specClient > 0)
Format(display, sizeof(display), "%N (Idle)", specClient);
else
GetClientName(i, display, sizeof(display));
menu.AddItem(userid, display);
}
}
menu.ExitButton = true;
menu.Display(client, 0);
}