// MQ2Outdoors.cpp : Defines the entry point for the DLL application.
//
// PLUGIN_API is only to be used for callbacks. All existing callbacks at this time
// are shown below. Remove the ones your plugin does not use. Always use Initialize
// and Shutdown for setup and cleanup, do NOT do it in DllMain.
// digitalpixel
// ${Outdoors} or ${Outdoors.CurrentZone}
// Returns true if zone matches zone name listed in array below.
#include "../MQ2Plugin.h"
PreSetup("MQ2Outdoors");
const char* OutdoorZones[] = {
// Unsure
"Abysmal Sea",
//"Ak'Anon",
"Crescent Reach",
"East Cabilis",
"East Freeport",
"Erudin",
//"Erudin Palace",
//"Freeport Sewers",
//"Grobb",
"Guild Hall",
"Guild Lobby",
//"Halas",
//"Kael Drakkel: A Daring Raid",
//"Katta Castellum",
"Katta Castrum",
//"Neriak Commons",
//"Neriak Foreign Quarter",
//"Neriak Third Gate",
//"North Kaladim",
"North Qeynos",
"North Qeynos: Sleeping on the Job",
"Northern Felwithe",
//"Oggok",
//"Paineel",
"The Plane of Knowledge",
"Rivervale",
//"Shadow Haven",
//"Shadowrest",
//"Shar Vahl",
//"Skyshrine",
//"Solusek's Eye: War Machines",
//"South Kaladim",
"South Qeynos",
"Southern Felwithe",
//"Surefall Glade",
"The Bazaar",
//"The Nexus",
//"Thurgadin",
//"West Cabilis",
"West Freeport",
// Pretty Sure
"Arcstone, Isle of Spirits",
"Asylum of Anguish",
"Barindu, Hanging Gardens",
"Barren Coast",
"Blackburrow",
"Blackburrow: Reinforced Blackburrow",
"Blackfeather Roost",
"Blacksail Folly: A Spy Among Them",
"Blacksail Folly: Buried Treasure",
"Blacksail Folly: Reduce His Numbers",
"Blacksail Folly: Running Rum",
"Blacksail Folly: Sharpeye's Demise",
"Blightfire Moors",
"Bloody Kithicor",
"Bloody Kithicor: Raid Instance",
"Bloody Kithicor: Safe Passage",
"Burning Woods",
"Butcherblock Mountains",
"Castle Mistmoore",
"Cazic-Thule",
"Cazic-Thule: Lost Temple of Cazic-Thule",
"City of Dranik",
"City of Mist",
"Cobalt Scar",
"Commonlands",
"Corathus Creep",
"Crushbone",
"Crushbone: Dethroning the Emperor",
"Dagnor's Cauldron",
"Dawnshroud Peaks",
"Deadbone Reef: Pirate Stew",
"Deadbone Reef: Shipping Lanes",
"Deadbone Reef: The Drowned Dead",
"Direwind Cliffs",
"Dominion of Despair",
"Doomfire, the Burning Lands",
"Dragonscale Hills",
"Dranik's Scar",
"Dreadlands",
"Dulak's Harbor",
"Dulak's Harbor: The Grozmok Stone",
"East Commonlands: A Griffin's Plight",
"East Freeport: The Poisoned Flounder",
"East Karana",
"Eastern Wastes",
"Eastern Wastes: Cage Kerafyrm",
"Emerald Jungle",
"Erud's Crossing",
"Eryslai, the Kingdom of Wind",
"Estate of Unrest",
"Estate of Unrest: Greater Unrest",
"Estate of Unrest: The Curse Begins",
"Everfrost Peaks",
"Everfrost Peaks: Battle for Permafrost",
"Field of Bone",
"Field of Scale",
"Field of Scale: Raid Instance",
"Firiona Vie",
"Fortress Mechanotus",
"Freeport Arena",
"Frontier Mountains",
"Frontier Mountains: One Shall Rule Them All",
"Gorge of King Xorbb",
"Goru`kar Mesa",
"Great Divide",
"Great Divide: The Defense of Thurgadin",
"Great Divide: The Founding of Thurgadin",
"Greater Faydark",
"Grieg's End",
"Grimling Forest",
"Grobb: Grobb Under Siege",
"Gulf of Gunthak",
"Gyrospire Beza",
"Gyrospire Beza: End the Return",
"Gyrospire Beza: How Does Your Garden Grow",
"Gyrospire Beza: It's All in Your Head",
"Gyrospire Beza: Sand in the Gears",
"Gyrospire Beza: Scout Gyrospire Beza",
"Gyrospire Zeka",
"Gyrospire Zeka: Cut Off the Head",
"Gyrospire Zeka: Did We Forget the Cheese",
"Gyrospire Zeka: Intelligence Gathering",
"Gyrospire Zeka: To Climb a Spire",
"Gyrospire Zeka: You Might Poke an Eye Out",
"Halls of Honor",
"Hate's Fury, The Scorned Maiden",
"Hate's Fury: Setting Sail",
"High Keep",
"High Keep: Pickclaw's Revenge",
"High Keep: Storming the Keep",
"Highpass Hold",
"Hills of Shade",
"Hollowshade Moor",
"Iceclad Ocean",
"Icefall Glacier",
"Innothule Swamp",
"Jardel's Hook: Jardel's Hidden Cove",
"Kaesora",
"Kaesora: Zebuxoruk's Pact",
"Karnor's Castle",
"Kithicor Forest",
"Kod'Taz, Broken Trial Grounds",
"Korafax, Home of the Riders",
"Korafax: Inside Information",
"Korafax: Kill the Shearspawn",
"Korafax: Meeting Adjourned",
"Korafax: Stardouser",
"Korascian Warrens",
"Lair of Terris Thule",
"Lake of Ill Omen",
"Lake Rathetear",
"Lavastorm Mountains",
"Lesser Faydark",
"Lesser Faydark: Brownies of Doom",
"Loping Plains",
"Maiden's Grave: If You Can't Beat Em",
"Maiden's Grave: Mer's Lost Love",
"Maiden's Grave: Never Trust a Siren",
"Maiden's Grave: Piecing Things Together",
"Maiden's Grave: The Grim News",
"Marus Seru",
"Misty Thicket",
"Monkey Rock: A Volatile Disease",
"Monkey Rock: An Experiment Gone Wrong",
"Monkey Rock: Cleansing the Island",
"Monkey Rock: Long Abandoned",
"Mons Letalis",
"Mountains of Rathe",
"Muramite Proving Grounds",
"Natimbi, The Broken Shores",
"Nedaria's Landing",
"Nektulos Forest",
"Nektulos Forest: Wanted Dead or Alive",
"Nobles' Causeway",
"North Karana",
"North Ro",
"Ocean of Tears",
"Oceangreen Hills",
"Oceangreen Village",
"Oceangreen Village: A Dread Challenger",
"Oceangreen Village: Stop the Contamination",
"Old Blackburrow",
"Old Blackburrow: Beat the Blackburrow Boss",
"Old Blackburrow: Freedom!",
"Old Blackburrow: Stop the Ascension",
"Old Blackburrow: Disrupting the Ritual",
"Old Bloodfields",
"Old Bloodfields: Holding the Fort",
"Old Commonlands",
"Old Commonlands: Bitter Victuals",
"Old Commonlands: Safe Passage",
"The Plane of Disease",
"The Plane of Fear",
"The Plane of Growth",
"The Plane of Hate",
"The Plane of Hate: Innoruuk's Realm",
"The Plane of Innovation ",
"The Plane of Justice",
"The Plane of Mischief",
"The Plane of Nightmare",
"The Plane of Sky",
"The Plane of Storms",
"The Plane of Time",
"The Plane of Tranquility",
"The Plane of Valor",
"Proving Grounds: The Mastery of Specialization",
"Qeynos Hills",
"Qinimi, Court of Nihilia",
"Qvic, Prayer Grounds of Calling",
"Ragrax, Stronghold of the Twelve",
"Redfeather Isle: Mystery of Aviak Island",
"Redfeather Isle: The Final Lyric",
"Relic, the Artifact City",
"Rivervale: Zombie Invasion",
"Riwwi, Coliseum of Games",
"Ruins of Takish-Hiz",
"S.H.I.P. Workshop: Administrative Assassination",
"S.H.I.P. Workshop: Deception and Interception",
"S.H.I.P. Workshop: Mechalossus",
"S.H.I.P. Workshop: S.H.I.P Sabotage!",
"S.H.I.P. Workshop: Tactical Teleportation",
"Sanctus Seru",
"Shadeweaver's Thicket",
"Shadowed Grove: Queen Nok Nok's Tomb",
"Shadowed Grove: The Rescue of Vodrak",
"Skyfire Mountains",
"Solteris, the Throne of Ro",
"South Karana",
"South Karana: The Gnolls Know",
"South Ro",
"Steamfont Mountains",
"Stillmoon Temple: Guardian of the Sands",
"Stillmoon Temple: Scales of Justice",
"Stone Hive",
"Stonebrunt Mountains",
"Stonebrunt Mountains: The Kejek Trials",
"Stoneroot Falls",
"Stoneroot Falls: A Rogue's Trust",
"Stoneroot Falls: Building the Disguise",
"Stoneroot Falls: Scouting the City",
"Suncrest Isle: Altar Call",
"Suncrest Isle: Pay a Visit",
"Suncrest Isle: Repaying the Tidewater Goblins",
"Suncrest Isle: Sunstone Savages",
"Suncrest Isle: The Secret of Suncrest Ridge",
"Sunderock Springs",
"Sunset Home",
"Sverag, Stronghold of Rage",
"Swamp of No Hope",
"Temple of Marr",
"The Arena",
"The Ascent",
"The Ascent: Death Comes Swiftly",
"The Ascent: Kessdona's Perch",
"The Ascent: Reflections of Silver",
"The Ascent: Signal Fires",
"The Ascent: Sudden Tremors",
"The Ascent: Drake Eggs",
"The Ascent: Storm Dragon Scales",
"The Bloodfields",
"The Broodlands",
"The Buried Sea",
"The Devastation",
"The Elddar Forest",
"The Feerrott",
"The Grey",
"The Hive",
"The Hive: Freeing an Elder",
"The Hive: Infiltrating the Hive",
"The Hive: The Accursed Book",
"The Hive: The Orb of Subversion",
"The Jaggedpine Forest",
"The Maiden's Eye",
"The Open Sea: Hired Hands",
"The Overthere",
"The Overthere: The Fall of the Shissar",
"The Precipice of War",
"The Ruined City of Dranik",
"The Scarlet Desert",
"The Steppes",
"The Tenebrous Mountains",
"The Twilight Sea",
"The Umbral Plains",
"The Void",
"The Wakening Land",
"The Warrens",
"Theater of Blood",
"Theater of the Tranquil",
"Thundercrest Isles",
"Thundercrest Isles: A Simple Task",
"Thundercrest Isles: An End to the Storms",
"Thundercrest Isles: Behind Closed Doors",
"Thundercrest Isles: History of the Isle",
"Thundercrest Isles: Holy Hour",
"Thundercrest Isles: Lair Unguarded",
"Thundercrest Isles: Scions of Thundercrest",
"Thundercrest Isles: Splitting the Storm",
"Thundercrest Isles: The Creator",
"Thundercrest Isles: The Gilded Scroll",
"Thundercrest Isles: Throes of Contagion",
"Timorous Deep",
"Tipt, Treacherous Crags",
"Torden, the Bastion of Thunder",
"Toxxulia Forest",
"Trakanon's Teeth",
"Undershore",
"Undershore: Trailing Longshadow",
"Valdeholm",
"Valdeholm: Kill Kangur",
"Valdeholm: Speak with the King",
"Valdeholm: Udengar the Traitor",
"Vegarlson, the Earthen Badlands",
"Vxed, The Crumbling Caverns",
"Wall of Slaughter",
"Warsliks Wood",
"West Karana",
"Western Wastes",
"Yxtta, Pulpit of Exiles"
};
int bOutdoors;
bool AreWeOutdoors()
{
PZONEINFO ZoneInfo = (PZONEINFO)pZoneInfo;
const char* current_zone = ZoneInfo->LongName;
const int zone_array = sizeof OutdoorZones / sizeof *OutdoorZones;
for(int i=0; i != zone_array; i++)
if(!stricmp(current_zone, OutdoorZones[i]))
return true;
return false;
}
class MQ2OutdoorsType *pOutdoorsType=0;
class MQ2OutdoorsType : public MQ2Type
{
public:
enum OutdoorsMembers
{
CurrentZone=1,
};
MQ2OutdoorsType():MQ2Type("Outdoors")
{
TypeMember(CurrentZone);
}
~MQ2OutdoorsType()
{
}
bool GetMember(MQ2VARPTR VarPtr, PCHAR Member, PCHAR Index, MQ2TYPEVAR &Dest)
{
PMQ2TYPEMEMBER pMember=MQ2OutdoorsType::FindMember(Member);
if (!pMember)
return false;
switch((OutdoorsMembers)pMember->ID)
{
case CurrentZone:
Dest.Int=bOutdoors;
Dest.Type=pBoolType;
return true;
}
return false;
}
bool ToString(MQ2VARPTR VarPtr, PCHAR Destination)
{
if (bOutdoors)
strcpy(Destination,"TRUE");
else
strcpy(Destination,"FALSE");
return true;
}
bool FromData(MQ2VARPTR &VarPtr, MQ2TYPEVAR &Source)
{
return false;
}
bool FromString(MQ2VARPTR &VarPtr, PCHAR Source)
{
return false;
}
};
BOOL dataOutdoors(PCHAR szName, MQ2TYPEVAR &Dest)
{
Dest.DWord=1;
Dest.Type=pOutdoorsType;
return true;
}
// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
DebugSpewAlways("Initializing MQ2Outdoors");
AddMQ2Data("Outdoors",dataOutdoors);
if(AreWeOutdoors() == true) {
bOutdoors = true;
} else {
bOutdoors = false;
}
pOutdoorsType = new MQ2OutdoorsType;
}
// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
DebugSpewAlways("Shutting down MQ2Outdoors");
RemoveMQ2Data("Outdoors");
delete pOutdoorsType;
}
// Called after entering a new zone
PLUGIN_API VOID OnZoned(VOID)
{
DebugSpewAlways("MQ2Outdoors::OnZoned()");
if(AreWeOutdoors() == true) {
bOutdoors = true;
} else {
bOutdoors = false;
}
}