If accepted, I would like access to the EQ1 forums.
This original MQ2 plugin adds a /tribute command in game with automatic tribute status management capabilities.
Usage: /tribute <auto|manual|on|off|forceoff|show>
This original MQ2 plugin adds a /tribute command in game with automatic tribute status management capabilities.
Usage: /tribute <auto|manual|on|off|forceoff|show>
Rich (BB code):
// MQ2TributeManager.cpp : Defines the entry point for the DLL application.
//
// MQ2TributeManager
// Manages tribute for you based on combat status
// Author: alt228, [email protected]
#include "../MQ2Plugin.h"
enum TributeMode
{
TributeMode_Manual,
TributeMode_Auto,
TributeMode_OffWhenExpired,
TributeMode_Unused
};
enum CombatState
{
CombatState_COMBAT,
CombatState_DEBUFFED,
CombatState_COOLDOWN,
CombatState_ACTIVE,
CombatState_RESTING
};
PreSetup("MQ2TributeManager");
//defaults
TributeMode mode = TributeMode_Manual;
int tributeFudge = 2000;
VOID SetTributeStatus(bool tributeOn)
{
if( tributeOn )
{
if( !(bool)*pTributeActive )
{
DebugSpewAlways("MQ2TributeManager::Turning on tribute");
DoCommand( (PSPAWNINFO)pCharSpawn, "/notify TributeBenefitWnd DowngradeButton leftmouseup" );
}
}
else
{
if( (bool)*pTributeActive )
{
DebugSpewAlways("MQ2TributeManager::Turning off tribute");
DoCommand( (PSPAWNINFO)pCharSpawn, "/notify TributeBenefitWnd DowngradeButton leftmouseup" );
}
}
}
VOID TributeManagerCmd(PSPAWNINFO characterSpawn, PCHAR line)
{
bool syntaxError = false;
if (line[0]==0)
{
syntaxError = true;
}
bool setMode = false;
TributeMode newMode = TributeMode_Unused;
bool setStatus = false;
bool newStatus = true;
bool showStatus = false;
CHAR thisArg[MAX_STRING] = {0};
int argNumber = 1;
bool moreArgs = true;
while(moreArgs && argNumber<10 )
{
DebugSpewAlways("MQ2TributeManager:: GetArg(%i)", argNumber);
GetArg(thisArg,line,argNumber);
argNumber++;
if( !thisArg || (strlen(thisArg)==0) )
{
moreArgs = false;
}
else if(stricmp(thisArg,"on") == 0)
{
setStatus = true;
newStatus = true;
}
else if(stricmp(thisArg,"off") == 0)
{
setMode = true;
newMode = TributeMode_OffWhenExpired;
}
else if(stricmp(thisArg,"forceoff") == 0)
{
setStatus = true;
newStatus = false;
setMode = true;
newMode = TributeMode_Manual;
}
else if(stricmp(thisArg,"auto") == 0)
{
setMode = true;
newMode = TributeMode_Auto;
}
else if(stricmp(thisArg,"manual") == 0)
{
setMode = true;
newMode = TributeMode_Manual;
}
else if(stricmp(thisArg,"show") == 0)
{
showStatus = true;
}
else
{
syntaxError = true;
}
}
if( syntaxError )
{
SyntaxError("Usage: /tribute <auto|manual|on|off|forceoff|show>");
return;
}
if( setStatus )
{
SetTributeStatus(newStatus);
}
if( setMode )
{
mode = newMode;
}
if( showStatus )
{
if( mode == TributeMode_Manual )
{
WriteChatColor("Tribute mode: manual");
}
else if( mode == TributeMode_Auto )
{
WriteChatColor("Tribute mode: automatic");
}
else if( mode == TributeMode_OffWhenExpired )
{
WriteChatColor("Tribute mode: off when expired");
}
if( gGameState == GAMESTATE_INGAME )
{
DebugSpewAlways("MQ2TributeManager:: Active Favor Cost: %i", pEQMisc->GetActiveFavorCost());
DebugSpewAlways("MQ2TributeManager:: Combat State: %i", (CombatState)((PCPLAYERWND)pPlayerWnd)->CombatState);
DebugSpewAlways("MQ2TributeManager:: Tribute Active: %i", *pTributeActive);
DebugSpewAlways("MQ2TributeManager:: Current Favor: %i", GetCharInfo()->CurrFavor);
DebugSpewAlways("MQ2TributeManager:: Tribute Timer: %i ms", GetCharInfo()->TributeTimer);
}
}
}
// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
DebugSpewAlways("Initializing MQ2TributeManager");
AddCommand("/tribute",TributeManagerCmd);
}
// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
DebugSpewAlways("Shutting down MQ2TributeManager");
RemoveCommand("/tribute");
}
// This is called every time MQ pulses
PLUGIN_API VOID OnPulse(VOID)
{
if( gGameState != GAMESTATE_INGAME )
{
return;
}
if( mode == TributeMode_Auto )
{
CombatState combatState = (CombatState)((PCPLAYERWND)pPlayerWnd)->CombatState;
bool inCombat = false;
if( combatState == CombatState_COMBAT )
{
inCombat = true;
}
int activeFavorCost = pEQMisc->GetActiveFavorCost();
PCHARINFO myCharInfo = GetCharInfo();
if( (inCombat) && (!*pTributeActive) && (activeFavorCost <= myCharInfo->CurrFavor) && (pEQMisc->GetActiveFavorCost() > 0) )
{
//activate tribute
SetTributeStatus(true);
}
else if( (!inCombat) && (*pTributeActive) && (myCharInfo->TributeTimer < tributeFudge) )
{
SetTributeStatus(false);
}
}
else if( mode == TributeMode_OffWhenExpired )
{
if( (bool)*pTributeActive == false )
{
mode = TributeMode_Manual;
return;
}
if( GetCharInfo()->TributeTimer < tributeFudge )
{
mode = TributeMode_Manual;
SetTributeStatus(false);
}
}
}
Last edited:



i would love to use this again, as it does save tribute, but not in the current form lol