コード例 #1
0
ファイル: ISXEQCommands.cpp プロジェクト: clausjensen/mq
// ***************************************************************************
// Function:    CMD_Where
// Description: Our '/where' command
//              Displays the direction and distance to the closest spawn
// Usage:       /where <spawn>
// ***************************************************************************
int CMD_Where(int argc, char* argv[])
{
   if (argc<2)
   {
      WriteChatf("Syntax: %s <spawn>",argv[0]);
      return 0;
   }
    if (!ppSpawnManager) return 0;
    if (!pSpawnList) return 0;
   PSPAWNINFO pChar = GetCharInfo()->pSpawn;
    PSPAWNINFO pSpawnClosest = NULL;
    SEARCHSPAWN SearchSpawn;
    ClearSearchSpawn(&SearchSpawn);
    CHAR szMsg[MAX_STRING] = {0};
    CHAR szName[MAX_STRING] = {0};
    CHAR szArg[MAX_STRING] = {0};
   
    bRunNextCommand = TRUE;
   SearchSpawn.SpawnType= PC;

   ParseSearchSpawn(1,argc,argv,SearchSpawn);

    if (!(pSpawnClosest = SearchThroughSpawns(&SearchSpawn,pChar))) {
        sprintf(szMsg,"There were no matches for: %s",FormatSearchSpawn(szArg,&SearchSpawn));
    } else {
        INT Angle = (INT)((atan2f(pChar->X - pSpawnClosest->X, pChar->Y - pSpawnClosest->Y) * 180.0f / PI + 360.0f) / 22.5f + 0.5f) % 16;
        sprintf(szMsg,"The closest '%s' is a level %d %s %s and %1.2f away to the %s, Z difference = %1.2f",
            CleanupName(strcpy(szName,pSpawnClosest->Name),FALSE),
            pSpawnClosest->Level,
            pEverQuest->GetRaceDesc(pSpawnClosest->Race),
            GetClassDesc(pSpawnClosest->Class),
            DistanceToSpawn(pChar,pSpawnClosest),
            szHeading[Angle],
            pSpawnClosest->Z-pChar->Z);
        DebugSpew("Where - %s",szMsg);
    }
    WriteChatColor(szMsg,USERCOLOR_WHO);
   
    return 0;
}
コード例 #2
0
ファイル: ISXEQMapCommands.cpp プロジェクト: isxGames/ISXEQ
int CMD_MapShow(int argc, char *argv[])
{
    if (argc<2)
    {
        WriteChatf("Syntax: %s <spawnfilter>|reset",argv[0]);
        return 0;
    };
    if (!stricmp(argv[1],"reset"))
    {
        MapClear();
        MapGenerate();
        WriteChatf("Map spawns regenerated");
        return 0;
    }
    if (PCHARINFO pCharInfo=GetCharInfo())
    {
        SEARCHSPAWN ssShow;
        ClearSearchSpawn(&ssShow);
        ParseSearchSpawn(1,argc,argv,ssShow);
        WriteChatf("%d previously hidden spawns shown",MapShow(ssShow));
    }
    return 0;
}
コード例 #3
0
ファイル: ISXEQMapCommands.cpp プロジェクト: isxGames/ISXEQ
int CMD_MapHide(int argc, char *argv[])
{
    if (argc<2)
    {
        WriteChatf("Syntax: %s <spawnfilter>|reset",argv[0]);
        return 0;
    };
    if (!stricmp(argv[1],"reset"))
    {
        MapClear();
        MapGenerate();
        WriteChatColor("Map spawns regenerated",USERCOLOR_DEFAULT);
        return 0;
    }
    if (PCHARINFO pCharInfo=GetCharInfo())
    {
        SEARCHSPAWN ssHide;
        ClearSearchSpawn(&ssHide);
        ParseSearchSpawn(1,argc,argv,ssHide);
        WriteChatf("%d mapped spawns hidden",MapHide(ssHide));
    }
    return 0;
}
コード例 #4
0
ファイル: ISXEQMapCommands.cpp プロジェクト: isxGames/ISXEQ
VOID MapFilterSetting( DWORD nMapFilter, int arg, int argc, char *argv[])
{
    CHAR szBuffer[MAX_STRING] = {0};
    CHAR Buff[MAX_STRING]={0};
    PCHAR szFilterMap[] = {
        "hide",
        "show",
        NULL
    };
    PMAPFILTER pMapFilter=&MapFilterOptions[nMapFilter];
    if (!RequirementsMet(nMapFilter))
    {
        WriteChatf("'%s' requires '%s' option.  Please enable this option first.",pMapFilter->szName,MapFilterOptions[pMapFilter->RequiresOption].szName);
        return;
    }
    if (arg>=argc) 
    {
        // NO VALUE
        char szBuffer[2048]={0};
        if (pMapFilter->bIsToggle) 
        {
            sprintf(szBuffer,"%s: %s",pMapFilter->szName,szFilterMap[pMapFilter->Enabled]);
        } 
        else if (nMapFilter == MAPFILTER_Custom) 
        {
            if (IsOptionEnabled(nMapFilter)==0)
            {
                sprintf(szBuffer,"%s: Off",pMapFilter->szName);
            } 
            else 
            {
                sprintf(szBuffer,"%s: %s",pMapFilter->szName,FormatSearchSpawn(Buff,&MapFilterCustom));
            }
        } 
        else 
        {
            sprintf(szBuffer,"%s: %d",pMapFilter->szName,pMapFilter->Enabled);
        }
        if (pMapFilter->DefaultColor != -1) 
        {
            DWORD R,G,B;
            R= (pMapFilter->Color&0xFF0000)/0x10000;
            G= (pMapFilter->Color&0xFF00)/0x100;
            B= pMapFilter->Color&0xFF;
            WriteChatf("%s (Color: %d %d %d)",szBuffer,R,G,B);
        }
        else
            WriteChatf("%s",szBuffer);
        return;
    } 


    if (pMapFilter->bIsToggle) 
    {
        if (!stricmp(szFilterMap[0],argv[arg])) 
        {
            pMapFilter->Enabled = 0;
        } 
        else if (!stricmp(szFilterMap[1],argv[arg])) 
        {
            pMapFilter->Enabled = 1;
        } 
        else 
        {
            pMapFilter->Enabled = 1 - pMapFilter->Enabled;
        }
        WriteChatf("%s is now set to: %s",pMapFilter->szName,szFilterMap[IsOptionEnabled(nMapFilter)]);
    } 
    else if (nMapFilter == MAPFILTER_Custom)
    {
        ClearSearchSpawn(&MapFilterCustom);
        {
            pMapFilter->Enabled = 1;
            ParseSearchSpawn(arg+1,argc,argv,MapFilterCustom);
            WriteChatf("%s is now set to: %s",pMapFilter->szName,FormatSearchSpawn(Buff,&MapFilterCustom));
        }
    } 
    else 
    {
        pMapFilter->Enabled = atoi(argv[arg]);
        WriteChatf("%s is now set to: %d",pMapFilter->szName,pMapFilter->Enabled);
    }

    itoa(pMapFilter->Enabled,szBuffer,10);
    pISInterface->SetSettingi("ISXEQMap.xml","Map Filters",pMapFilter->szName,pMapFilter->Enabled);
    pISInterface->SaveSettings("ISXEQMap.xml");
}
コード例 #5
0
// ***************************************************************************
// Function:    MapFilters
// Description: Our '/mapfilter' command
//              Sets map filters
// Usage:       /mapfilter [options|help]
// ***************************************************************************
VOID MapFilterSetting(PSPAWNINFO pChar, DWORD nMapFilter, PCHAR szValue)
{
	CHAR szBuffer[MAX_STRING] = { 0 };
	CHAR Buff[MAX_STRING] = { 0 };
	DWORD dwValue = 0;
	PCHAR szFilterMap[] = {
		"hide",
		"show",
		NULL
	};
	if (!pChar) return;
	PMAPFILTER pMapFilter = &MapFilterOptions[nMapFilter];
	if (!RequirementsMet(nMapFilter))
	{
		sprintf_s(szBuffer, "'%s' requires '%s' option.  Please enable this option first.", pMapFilter->szName, MapFilterOptions[pMapFilter->RequiresOption].szName);
		WriteChatColor(szBuffer, USERCOLOR_DEFAULT);
		return;
	}
	if (!szValue) {
		if (pMapFilter->bIsToggle) {
			sprintf_s(szBuffer, "%s: %s", pMapFilter->szName, szFilterMap[pMapFilter->Enabled]);
		}
		else if (nMapFilter == MAPFILTER_Custom) {
			if (IsOptionEnabled(nMapFilter) == 0) {
				sprintf_s(szBuffer, "%s: Off", pMapFilter->szName);
			}
			else {
				sprintf_s(szBuffer, "%s: %s", pMapFilter->szName, FormatSearchSpawn(Buff, sizeof(Buff), &MapFilterCustom));
			}
		}
		else {
			sprintf_s(szBuffer, "%s: %d", pMapFilter->szName, pMapFilter->Enabled);
		}
		if (pMapFilter->DefaultColor != -1) {
			CHAR szBuffer2[MAX_STRING] = { 0 };
			DWORD R, G, B;
			R = (pMapFilter->Color & 0xFF0000) / 0x10000;
			G = (pMapFilter->Color & 0xFF00) / 0x100;
			B = pMapFilter->Color & 0xFF;
			sprintf_s(szBuffer2, "%s (Color: %d %d %d)", szBuffer, R, G, B);
			strcpy_s(szBuffer, szBuffer2);
		}
	}
	else {
		if (pMapFilter->bIsToggle) {
			if (!_stricmp(szFilterMap[0], szValue)) {
				pMapFilter->Enabled = 0;
			}
			else if (!_stricmp(szFilterMap[1], szValue)) {
				pMapFilter->Enabled = 1;
			}
			else {
				pMapFilter->Enabled = 1 - pMapFilter->Enabled;
			}
			sprintf_s(szBuffer, "%s is now set to: %s", pMapFilter->szName, szFilterMap[IsOptionEnabled(nMapFilter)]);
		}
		else if (nMapFilter == MAPFILTER_Custom) {
			ClearSearchSpawn(&MapFilterCustom);
			if (szValue[0] == 0) {
				pMapFilter->Enabled = 0;
				sprintf_s(szBuffer, "%s is now set to: Off", pMapFilter->szName);
			}
			else {
				pMapFilter->Enabled = 1;
				ParseSearchSpawn(szValue, &MapFilterCustom);
				sprintf_s(szBuffer, "%s is now set to: %s", pMapFilter->szName, FormatSearchSpawn(Buff, sizeof(Buff), &MapFilterCustom));
			}
		}
		else if (nMapFilter == MAPFILTER_Marker) {
			CHAR szBuffer2[MAX_STRING] = { 0 };
			GetArg(szBuffer2, szValue, 1);

			if (!_stricmp(szFilterMap[0], szValue)) {
				pMapFilter->Enabled = 0;
				sprintf_s(szBuffer, "%s is now set to: %s", pMapFilter->szName, szFilterMap[IsOptionEnabled(nMapFilter)]);
			}
			else if (!_stricmp(szFilterMap[1], szValue)) {
				pMapFilter->Enabled = 1;
				sprintf_s(szBuffer, "%s is now set to: %s", pMapFilter->szName, szFilterMap[IsOptionEnabled(nMapFilter)]);
			}
			else {
				pMapFilter->Enabled = 1;
				sprintf_s(szBuffer, "%s %s", pMapFilter->szName, FormatMarker(szValue, Buff, sizeof(Buff)));
			}
		}
		else {
			pMapFilter->Enabled = atoi(szValue);
			sprintf_s(szBuffer, "%s is now set to: %d", pMapFilter->szName, pMapFilter->Enabled);
		}
	}
	WriteChatColor(szBuffer, USERCOLOR_DEFAULT);
	if (szValue) {
		_itoa_s(pMapFilter->Enabled, szBuffer, 10);
		WritePrivateProfileString("Map Filters", pMapFilter->szName, szBuffer, INIFileName);
	}
}