Created
July 27, 2014 19:10
-
-
Save mackal/a215c96161af4989b4c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Project: MQ2Bags | |
* Author: demonstar55 | |
* Purpose: Bring the newer clients open all bags to UF (and older I guess) | |
* | |
* Binds Shift + B to open all bags, and close them, exactly like newer clients do | |
* Adds /bags command that does the same thing | |
* | |
*/ | |
#include "../MQ2Plugin.h" | |
PreSetup("MQ2Bags"); | |
void ToggleBags(PSPAWNINFO pChar, PCHAR szLine); | |
void KeyBags(PCHAR NAME, BOOL Down); | |
bool bOpen = false; | |
PLUGIN_API VOID InitializePlugin(VOID) | |
{ | |
DebugSpewAlways("Initializing MQ2Bags"); | |
//Add commands | |
AddCommand("/bags", ToggleBags); | |
KeyCombo ToggleBags; | |
RemoveMQ2KeyBind("TOGGLE_BAGS"); | |
AddMQ2KeyBind("TOGGLE_BAGS", KeyBags); | |
ParseKeyCombo("shift+b", ToggleBags); | |
SetMQ2KeyBind("TOGGLE_BAGS", false, ToggleBags); | |
} | |
PLUGIN_API VOID ShutdownPlugin(VOID) | |
{ | |
DebugSpewAlways("Shutting down MQ2Bags"); | |
//Remove commands | |
RemoveCommand("/bags"); | |
RemoveMQ2KeyBind("TOGGLE_BAGS"); | |
} | |
void ToggleBags(PSPAWNINFO pChar, PCHAR szLine) | |
{ | |
if (bOpen) { | |
DoMappable(pChar, "CLOSE_INV_BAGS"); | |
bOpen = false; | |
} else { | |
DoMappable(pChar, "OPEN_INV_BAGS"); | |
bOpen = true; | |
} | |
return; | |
} | |
void KeyBags(PCHAR NAME, BOOL Down) | |
{ | |
if (Down) | |
ToggleBags((PSPAWNINFO)pCharSpawn, ""); | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment