I know a lot of people who were looking for an easy way to do this so i wrote up this plugin. It auto spends ability points.
You must set the autoarray with /aaspend setauto before you can use /aaspend auto.
There is a max of 10 entries in the auto array.
Also make sure you have Quotes "" around the Ability Names.
MQ2AASpend.cpp
Enjoy!!!
--Zippzipp
(like my stuff? Wanna donate? [email protected] is my paypal)
Rich (BB code):
Usage:
/aaspend help -- lists command syntaxes in game.
/aaspend status -- lists status of brute, auto, and auto array
/aaspend "AA name" -- Spends a specific AA
/aaspend brute -- Goes down the list autospending the next available AA
/aaspend auto -- Spends AA based on abilities set in setauto
/aaspend setauto "AA name" <Auto #> -- Sets the auto array.
You must set the autoarray with /aaspend setauto before you can use /aaspend auto.
There is a max of 10 entries in the auto array.
Also make sure you have Quotes "" around the Ability Names.
MQ2AASpend.cpp
Rich (BB code):
//////////////////////////////////////////////////
// MQ2AASpend.cpp by Zippzipp
// Crated On: 21 Jan 2007
//
// This plugin adds the following commands to
// the game:
//
// /aaspend help -- lists command syntaxes in
// game.
//
// /aaspend "AA name" -- Spends a specific AA
//
// /aaspend brute -- Goes down the list auto
// spending the next available
// AA
//
// /aaspend auto -- Spends AA based on setAutos
//
// /aaspend setauto "AA name" <Auto #>
// -- Sets the auto array.
//
//////////////////////////////////////////////////
#include "../MQ2Plugin.h"
PreSetup("MQ2AASpend");
#define SP_Instant_AA 0x077B // 6-13-06
// zippzipp -- 21 Jan 2007
struct _PKTAASpend {
/*0000*/ DWORD FunctionM; // 1 = SetAAexp 0%, 2 = SetAAexp 100%, 3 = SpendAA
/*0004*/ DWORD Index; // AA index
/*0008*/ CHAR unknown0x008[0x8];
} SpendPkt; // 16
void Spend(DWORD Idx);
bool autoflag = false;
bool bruteflag = false;
int bruteindex = 0;
CHAR AutoArray[10][MAX_STRING];
VOID aaSpend(PSPAWNINFO pChar, PCHAR szLine){
CHAR szArg1[MAX_STRING] = {0};
CHAR szArg2[MAX_STRING] = {0};
CHAR szArg3[MAX_STRING] = {0};
CHAR arrayprint[MAX_STRING]={0};
GetArg(szArg1, szLine, 1);
if(!strcmpi(szArg1, "")){
WriteChatColor("You must specify which /aaspend command you wish to use", CONCOLOR_YELLOW);
WriteChatColor("If you are unsure: /aaspend help will show you availiable commands", CONCOLOR_YELLOW);
return;
}
if(!strcmpi(szArg1, "help")){
WriteChatColor("--MQ2AASpend help--", CONCOLOR_YELLOW);
WriteChatColor("/aaspend help -- Lists command syntax", CONCOLOR_YELLOW);
WriteChatColor("/aaspend status -- Shows current status", CONCOLOR_YELLOW);
WriteChatColor("/aaspend \"AA Name\" -- Spends a particular AA", CONCOLOR_YELLOW);
WriteChatColor("/aaspend brute -- Goes down the list autospending the next available",CONCOLOR_YELLOW);
WriteChatColor("/aaspend auto -- Autospends AA's based on auto array",CONCOLOR_YELLOW);
WriteChatColor("/aaspend setauto -- Sets auto array",CONCOLOR_YELLOW);
return;
}
if(!strcmpi(szArg1, "status")){
WriteChatColor("--MQ2AASpend status--", CONCOLOR_YELLOW);
if(bruteflag == true)
WriteChatColor("Brute Mode: Enabled");
else
WriteChatColor("Brute Mode: Disabled");
if(autoflag == true)
WriteChatColor("Auto Mode: Enabled");
else
WriteChatColor("Auto Mode: Disabled");
WriteChatColor("Auto Array:");
for(int j = 1;j<=10;j++){
sprintf(arrayprint,"%d. %s", j, AutoArray[j-1]);
WriteChatColor(arrayprint);
}
return;
}
if(!strcmpi(szArg1, "setauto")){
GetArg(szArg2, szLine, 2);
GetArg(szArg3, szLine, 3);
if(!strcmpi(szArg2, "") || !strcmpi(szArg2, "") || !IsNumber(szArg3)){
WriteChatColor("Invalid ability name and or Auto number",CONCOLOR_YELLOW);
return;
}
if(atoi(szArg3)<1 || atoi(szArg3) > 10){
WriteChatColor("Auto number must be an integer from 1-10",CONCOLOR_YELLOW);
return;
}
strcpy(AutoArray[atoi(szArg3)-1],szArg2);
sprintf(arrayprint,"Ability %s set to prioirty %d",szArg2,atoi(szArg3));
WriteChatColor(arrayprint);
return;
}
if(!strcmpi(szArg1,"brute")){
if(bruteflag == true){
WriteChatColor("Brute Mode: Disabled");
bruteflag = false;
}else{
WriteChatColor("Brute Mode: Enabled -- Autospending AA's in order of appearence");
bruteflag = true;
}
autoflag = false;
return;
}
if(!strcmpi(szArg1,"auto")){
if(autoflag == true){
WriteChatColor("Auto Mode: Disabled");
autoflag = false;
}else{
WriteChatColor("Auto Mode: Enabled -- Autospending AA's based on the Autoarray");
autoflag = true;
}
bruteflag = false;
return;
}
for(unsigned long nAbility=0 ; nAbility<NUM_ALT_ABILITIES ; nAbility++){
if(PALTABILITY pAbility=pAltAdvManager->GetAltAbility(nAbility)){
if(!stricmp(pCDBStr->GetString(pAbility->nName, 1, NULL), szArg1)){
if(GetCharInfo2()->AAPoints >= pAbility->Cost)
Spend(pAbility->Index);
else {
WriteChatColor("You do not have enough AA points to buy this Ability",CONCOLOR_YELLOW);
return;
}
}
}
}
}
void Spend(DWORD Idx){
ZeroMemory(&SpendPkt, sizeof(SpendPkt));
SpendPkt.FunctionM = 3;
SpendPkt.Index = Idx;
SendEQMessage(SP_Instant_AA, &SpendPkt, sizeof(SpendPkt));
}
PLUGIN_API VOID OnPulse(VOID){
if(bruteflag == true){
for(unsigned long nAbility=0 ; nAbility<NUM_ALT_ABILITIES ; nAbility++){
if(PALTABILITY pAbility=pAltAdvManager->GetAltAbility(nAbility)){
if(GetCharInfo2()->AAPoints >= pAbility->Cost)
Spend(pAbility->Index);
else
return;
}
}
}
if(autoflag == true){
for(int q = 0; q < 10;q++){
for(unsigned long nAbility=0 ; nAbility<NUM_ALT_ABILITIES ; nAbility++){
if(PALTABILITY pAbility=pAltAdvManager->GetAltAbility(nAbility)){
if(!stricmp(pCDBStr->GetString(pAbility->nName, 1, NULL), AutoArray[q])){
if(GetCharInfo2()->AAPoints >= pAbility->Cost)
Spend(pAbility->Index);
else
return;
}
}
}
}
}
}
PLUGIN_API VOID InitializePlugin(VOID){
DebugSpewAlways("Initializing MQ2AASpend");
WriteChatColor("MQ2AASpend -- By Zippzipp",CONCOLOR_YELLOW);
AddCommand("/aaspend",aaSpend);
}
PLUGIN_API VOID ShutdownPlugin(VOID){
DebugSpewAlways("Shutting down MQ2AASpend");
RemoveCommand("/aaspend");
}
Enjoy!!!
--Zippzipp
(like my stuff? Wanna donate? [email protected] is my paypal)
Last edited:


