210 lines
7.4 KiB
Plaintext
210 lines
7.4 KiB
Plaintext
#include "mn_i_pwfunctions"
|
|
|
|
void main()
|
|
{
|
|
string msg = GetPCChatMessage();
|
|
object oPC = GetPCChatSpeaker();
|
|
object curArea = GetArea(oPC);
|
|
int bIsDM = GetIsDM(oPC);
|
|
|
|
int DEBUG = TRUE;
|
|
|
|
if (DEBUG == TRUE && msg != "" && GetStringLeft(msg,1) == "#" && GetIsPC(oPC))
|
|
{
|
|
string cdkey = GetPCPublicCDKey(oPC, TRUE);
|
|
if (cdkey != "Q7RRT4X9")
|
|
{
|
|
return;
|
|
}
|
|
SetPCChatMessage();
|
|
string out = "";
|
|
if (msg == "#lvl")
|
|
{
|
|
int nCurrentL = GetHitDice(oPC);
|
|
int nXP = (((nCurrentL + 1)*nCurrentL)/2)*1000;
|
|
SetXP(oPC,nXP);
|
|
out = "Gained a level";
|
|
} else if (msg == "#m")
|
|
{
|
|
object oArea = GetArea( oPC );
|
|
ExploreAreaForPlayer( oArea, oPC );
|
|
out = "Explored area";
|
|
} else if (msg == "#plot")
|
|
{
|
|
int isPlot = GetPlotFlag(oPC);
|
|
if (isPlot == TRUE)
|
|
{
|
|
SetPlotFlag(oPC, FALSE);
|
|
out = "Toggled plot flag to false";
|
|
} else
|
|
{
|
|
SetPlotFlag(oPC, TRUE);
|
|
out = "Toggled plot flag to true";
|
|
}
|
|
} else if (msg == "#givedebugitems")
|
|
{
|
|
out = "Added debug items";
|
|
CreateItemOnObject("mn_aidb_initer", oPC);
|
|
CreateItemOnObject("mn_aidb_telring", oPC);
|
|
CreateItemOnObject("mn_testsword", oPC);
|
|
} else if (msg == "#givegold")
|
|
{
|
|
out = "Added gold";
|
|
GiveGoldToCreature(oPC, 500000);
|
|
}
|
|
else if (msg == "#givetokens")
|
|
{
|
|
out = "Added tokens";
|
|
CreateItemOnObject("ldf_token", oPC, 50);
|
|
}
|
|
else if (msg == "#giveseeds")
|
|
{
|
|
out = "Added seeds";
|
|
CreateItemOnObject("seed_apple", oPC, 10);
|
|
CreateItemOnObject("seed_blueberry", oPC, 10);
|
|
CreateItemOnObject("seed_cherie", oPC, 10);
|
|
CreateItemOnObject("seed_corn", oPC, 10);
|
|
CreateItemOnObject("seed_fungi", oPC, 10);
|
|
CreateItemOnObject("seed_highfern", oPC, 10);
|
|
}
|
|
else
|
|
{
|
|
out = "The following debug commands are supported:\n\n";
|
|
out += "#lvl - Gain a level.\n";
|
|
out += "#m - Explore current map\n";
|
|
out += "#plot - Toggle plot flag\n";
|
|
out += "#givedebugitems - Add debug items to inventory\n";
|
|
out += "#givegold - Add debug items to inventory\n";
|
|
out += "#givetokens - Add forgetokens to inventory\n";
|
|
out += "#giveseeds - Add seeds to inventory\n";
|
|
}
|
|
FloatingTextStringOnCreature(out, oPC, FALSE);
|
|
return;
|
|
}
|
|
// Handle DM commands (starts with !)
|
|
if (msg == "" || GetStringLeft(msg,1) != "!" || bIsDM == FALSE)
|
|
{
|
|
return;
|
|
}
|
|
|
|
msg = GetStringRight(msg, GetStringLength(msg)-1);
|
|
msg = GetStringLowerCase(msg);
|
|
FloatingTextStringOnCreature(msg, oPC, FALSE);
|
|
if ( TestStringAgainstPattern("**help**", msg))
|
|
{
|
|
string out = "The following commands are supported:\n\n";
|
|
out += "wipekey!<playerAccountName> - Cleans CDkeys associated with player.\n";
|
|
out += "Teleportation constants: Dynamic = 1, stationary = 2, divine = 4, OOC = 8, all = 15, none = 0, all = 83\n";
|
|
out += "taib!<number> - Sets current area's incoming teleportation block to number.\n";
|
|
out += "taob!<number> - Sets current area's outgoing teleportation block to number.\n";
|
|
out += "tpcb!<number> - Sets self-block to number.\n";
|
|
out += "tele!<number> - Teleports self to default WP with type <number>.\n\n";
|
|
out += "Cleanup constants: playerdrop = 1, environment = 2, dm = 4, exempt = 8, unmarked = 16, marked = 7, all = 31\n";
|
|
out += "Object constants: Creature = 1, Item = 2, AoE = 16, PLC = 64\n";
|
|
out += "spawn!<number> - Spawns placeable, item, creature, and bag, near PC, marked for cleanup with flag <number>.\n";
|
|
out += "cleanup!<number>!<number2> - Performs cleanup of area using method <number2>, targetting <number>.\n";
|
|
FloatingTextStringOnCreature(out, oPC, FALSE);
|
|
SetPCChatMessage();
|
|
}
|
|
else if ( TestStringAgainstPattern("*a(!)*n(!)*n", msg))
|
|
{
|
|
SetPCChatMessage();
|
|
string out = "";
|
|
int delimiter = FindSubString(msg, "!");
|
|
int delimiter2 = FindSubString(msg, "!", delimiter+1);
|
|
int number1 = StringToInt( GetSubString(msg, delimiter+1, (delimiter2-delimiter)-1) );
|
|
int number2 = StringToInt( GetStringRight(msg, (GetStringLength(msg)-(delimiter2+1)) ) );
|
|
string command = GetStringLeft(msg, delimiter);
|
|
// out += "delimiter: "+IntToString(delimiter)+" - delimiter2: "+IntToString(delimiter2)+"\n";
|
|
// out += command+" : "+GetSubString(msg, delimiter+1, (delimiter2-delimiter)-1)+" : "+GetStringRight(msg, (GetStringLength(msg)-(delimiter2+1)) );
|
|
|
|
if (command == "cleanup")
|
|
{
|
|
CleanupArea( GetArea(oPC), number1, number2 );
|
|
out +="Cleanup performed: Targets: "+IntToString(number1)+", using policy: "+IntToString(number2);
|
|
}
|
|
|
|
FloatingTextStringOnCreature(out, oPC, FALSE);
|
|
|
|
}
|
|
else if ( TestStringAgainstPattern("*a(!)*n", msg) )
|
|
{
|
|
SetPCChatMessage();
|
|
string out = "";
|
|
int delimiter = FindSubString(msg, "!");
|
|
int number = StringToInt( GetStringRight(msg, (GetStringLength(msg)-(delimiter+1)) ) );
|
|
string command = GetStringLeft(msg, delimiter);
|
|
string numberstr = GetStringRight(msg, (GetStringLength(msg)-(delimiter+1)) );
|
|
|
|
if (command == "taib")
|
|
{
|
|
SetLocalInt( curArea, AREA_BLOCK_TELEPORT_INCOMING, number );
|
|
out+="Area now blocks incoming: "+IntToString(number);
|
|
}
|
|
else if (command == "taob")
|
|
{
|
|
SetLocalInt( curArea, AREA_BLOCK_TELEPORT_OUTGOING, number );
|
|
out+="Area now blocks outgoing: "+IntToString(number);
|
|
}
|
|
else if (command == "tpcb")
|
|
{
|
|
SetLocalInt( oPC, PC_P_BLOCK_TELEPORT, number );
|
|
out+="PC now blocked: "+IntToString(number);
|
|
}
|
|
else if (command == "tele")
|
|
{
|
|
object dest = GetWaypointByTag("WP_TELE_SHORT");
|
|
DoScriptTeleport( oPC, dest, number, TELEPORT_ANIMATION_UNSUMMONEFFECT, TELEPORT_SPEED_DELAYED );
|
|
}
|
|
else if (command == "cleanup")
|
|
{
|
|
// CleanupArea( GetArea(oPC),
|
|
}
|
|
else
|
|
{
|
|
out += "Unrecognized command: "+command+" Use !help for list of accepted commands";
|
|
}
|
|
|
|
FloatingTextStringOnCreature(out, oPC, FALSE);
|
|
}
|
|
else if ( TestStringAgainstPattern("*a(!)*a", msg) )
|
|
{
|
|
SetPCChatMessage();
|
|
string out = "";
|
|
int delimiter = FindSubString(msg, "!");
|
|
string command = GetStringLeft(msg, delimiter);
|
|
string argument = GetStringRight(msg, (GetStringLength(msg)-(delimiter+1)) );
|
|
|
|
if (command == "wipekey")
|
|
{
|
|
string sPName = GetStringLowerCase(argument);
|
|
string sStoredKey = FetchPString("playerkeys", sPName, "key01");
|
|
if (sStoredKey == "")
|
|
{
|
|
out += "No key found for player acount: '"+sPName+"' - make sure you entered the right account name.";
|
|
}
|
|
else
|
|
{
|
|
DeletePString("playerkeys", sPName, "key01");
|
|
out += "CD key link wiped for player acount: '"+sPName+"'.";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
out += "Unrecognized command: "+command+" Use !help for list of accepted commands";
|
|
}
|
|
|
|
FloatingTextStringOnCreature(out, oPC, FALSE);
|
|
}
|
|
else
|
|
{
|
|
if (msg == "")
|
|
{
|
|
}
|
|
else
|
|
{
|
|
FloatingTextStringOnCreature("Unrecognized command: "+msg, oPC, FALSE);
|
|
}
|
|
}
|
|
}
|