コード例 #1
0
GameObject *MapManagerScript::FindClosestGameObject( uint32 pEntry, float pX, float pY, float pZ )
{
    GameObject *CurrentObject = NULLGOB, *Creturn = NULL;
    float closestDistance = 50000.0f, currentDistance;
    for ( HM_NAMESPACE::hash_map<uint32, GameObject*>::iterator Iter = _manager->m_gameObjectStorage.begin(); Iter != _manager->m_gameObjectStorage.end(); Iter++ )
    {
        CurrentObject = ( *Iter ).second;
        if ( CurrentObject != NULL )
        { 
            if ( CurrentObject->GetEntry() == pEntry )
            {
                currentDistance = CurrentObject->CalcDistance(pX, pY, pZ);
                if(currentDistance <= closestDistance)
                {
                    closestDistance = currentDistance;
                    Creturn = CurrentObject;
                }
            }
        }
    }

    return Creturn;
}
コード例 #2
0
ファイル: Level2.cpp プロジェクト: Chero/abcwow
bool ChatHandler::HandleGOInfo(const char *args, WorldSession *m_session)
{
	GameObjectInfo *GOInfo = NULL;
	GameObject *GObj = m_session->GetPlayer()->GetSelectedGo();
	if( !GObj )
	{
		RedSystemMessage(m_session, "No selected GameObject...");
		return true;
	}

	SystemMessage(m_session, "%s Informations:",MSG_COLOR_SUBWHITE);
	SystemMessage(m_session, "%s Entry:%s%u",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->GetEntry());
	SystemMessage(m_session, "%s Model:%s%u",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->GetUInt32Value(GAMEOBJECT_DISPLAYID));
	SystemMessage(m_session, "%s State:%s%u",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->GetUInt32Value(GAMEOBJECT_STATE));
	SystemMessage(m_session, "%s flags:%s%u",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->GetUInt32Value(GAMEOBJECT_FLAGS));
	SystemMessage(m_session, "%s dynflags:%s%u",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->GetUInt32Value(GAMEOBJECT_DYN_FLAGS));
	SystemMessage(m_session, "%s faction:%s%u",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->GetUInt32Value(GAMEOBJECT_FACTION));

	char gotypetxt[50];
	switch( GObj->GetUInt32Value(GAMEOBJECT_TYPE_ID) )
	{
	case GAMEOBJECT_TYPE_DOOR:			strcpy(gotypetxt,"Door");	break;
	case GAMEOBJECT_TYPE_BUTTON:		strcpy(gotypetxt,"Button");	break;
	case GAMEOBJECT_TYPE_QUESTGIVER:	strcpy(gotypetxt,"Quest Giver");	break;
	case GAMEOBJECT_TYPE_CHEST:			strcpy(gotypetxt,"Chest");	break;
	case GAMEOBJECT_TYPE_BINDER:		strcpy(gotypetxt,"Binder");	break;
	case GAMEOBJECT_TYPE_GENERIC:		strcpy(gotypetxt,"Generic");	break;
	case GAMEOBJECT_TYPE_TRAP:			strcpy(gotypetxt,"Trap");	break;
	case GAMEOBJECT_TYPE_CHAIR:			strcpy(gotypetxt,"Chair");	break;
	case GAMEOBJECT_TYPE_SPELL_FOCUS:   strcpy(gotypetxt,"Spell Focus");	break;
	case GAMEOBJECT_TYPE_TEXT:			strcpy(gotypetxt,"Text");	break;
	case GAMEOBJECT_TYPE_GOOBER:		strcpy(gotypetxt,"Goober");	break;
	case GAMEOBJECT_TYPE_TRANSPORT:		strcpy(gotypetxt,"Transport");	break;
	case GAMEOBJECT_TYPE_AREADAMAGE:	strcpy(gotypetxt,"Area Damage");	break;
	case GAMEOBJECT_TYPE_CAMERA:		strcpy(gotypetxt,"Camera");	break;
	case GAMEOBJECT_TYPE_MAP_OBJECT:	strcpy(gotypetxt,"Map Object");	break;
	case GAMEOBJECT_TYPE_MO_TRANSPORT:  strcpy(gotypetxt,"Mo Transport");	break;
	case GAMEOBJECT_TYPE_DUEL_ARBITER:  strcpy(gotypetxt,"Duel Arbiter");	break;
	case GAMEOBJECT_TYPE_FISHINGNODE:   strcpy(gotypetxt,"Fishing Node");	break;
	case GAMEOBJECT_TYPE_RITUAL:		strcpy(gotypetxt,"Ritual");	break;
	case GAMEOBJECT_TYPE_MAILBOX:		strcpy(gotypetxt,"Mailbox");	break;
	case GAMEOBJECT_TYPE_AUCTIONHOUSE:  strcpy(gotypetxt,"Auction House");	break;
	case GAMEOBJECT_TYPE_GUARDPOST:		strcpy(gotypetxt,"Guard Post");	break;
	case GAMEOBJECT_TYPE_SPELLCASTER:   strcpy(gotypetxt,"Spell Caster");	break;
	case GAMEOBJECT_TYPE_MEETINGSTONE:  strcpy(gotypetxt,"Meeting Stone");	break;
	case GAMEOBJECT_TYPE_FLAGSTAND:		strcpy(gotypetxt,"Flag Stand");	break;
	case GAMEOBJECT_TYPE_FISHINGHOLE:   strcpy(gotypetxt,"Fishing Hole");	break;
	case GAMEOBJECT_TYPE_FLAGDROP:		strcpy(gotypetxt,"Flag Drop");	break;
	default:							strcpy(gotypetxt,"Unknown.");	break;
	}
	SystemMessage(m_session, "%s Type:%s%u -- %s",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->GetUInt32Value(GAMEOBJECT_TYPE_ID),gotypetxt);

	SystemMessage(m_session, "%s Distance:%s%u",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->CalcDistance((Object*)m_session->GetPlayer()));

	GOInfo = GameObjectNameStorage.LookupEntry(GObj->GetEntry());
	if( !GOInfo )
	{
		RedSystemMessage(m_session, "This GameObject doesn't have template, you won't be able to get some informations nor to spawn a GO with this entry.");
		return true;
	}

	if( GOInfo->Name )
		SystemMessage(m_session, "%s Name:%s%s",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GOInfo->Name);
	SystemMessage(m_session, "%s Size:%s%u",MSG_COLOR_GREEN,MSG_COLOR_LIGHTBLUE,GObj->GetFloatValue(OBJECT_FIELD_SCALE_X));

	return true;
}
コード例 #3
0
ファイル: Level2.cpp プロジェクト: Chero/abcwow
bool ChatHandler::HandleGOInfo(const char *args, WorldSession *m_session)
{
	std::string name;
	GameObjectInfo *GOInfo = NULL;
	GameObject *GObj = NULL;

	GObj = m_session->GetPlayer()->m_GM_SelectedGO;
	if( !GObj )
	{
		RedSystemMessage(m_session, "No selected GameObject...");
		return true;
	}

	switch( GObj->GetUInt32Value(GAMEOBJECT_TYPE_ID) )
	{
	case GAMEOBJECT_TYPE_DOOR:		  name = "Door";	break;
	case GAMEOBJECT_TYPE_BUTTON:		name = "Button";	break;
	case GAMEOBJECT_TYPE_QUESTGIVER:	name = "Quest Giver";	break;
	case GAMEOBJECT_TYPE_CHEST:		 name = "Chest";	break;
	case GAMEOBJECT_TYPE_BINDER:		name = "Binder";	break;
	case GAMEOBJECT_TYPE_GENERIC:	   name = "Generic";	break;
	case GAMEOBJECT_TYPE_TRAP:		  name = "Trap";	break;
	case GAMEOBJECT_TYPE_CHAIR:		 name = "Chair";	break;
	case GAMEOBJECT_TYPE_SPELL_FOCUS:   name = "Spell Focus";	break;
	case GAMEOBJECT_TYPE_TEXT:		  name = "Text";	break;
	case GAMEOBJECT_TYPE_GOOBER:		name = "Goober";	break;
	case GAMEOBJECT_TYPE_TRANSPORT:	 name = "Transport";	break;
	case GAMEOBJECT_TYPE_AREADAMAGE:	name = "Area Damage";	break;
	case GAMEOBJECT_TYPE_CAMERA:		name = "Camera";	break;
	case GAMEOBJECT_TYPE_MAP_OBJECT:	name = "Map Object";	break;
	case GAMEOBJECT_TYPE_MO_TRANSPORT:  name = "Mo Transport";	break;
	case GAMEOBJECT_TYPE_DUEL_ARBITER:  name = "Duel Arbiter";	break;
	case GAMEOBJECT_TYPE_FISHINGNODE:   name = "Fishing Node";	break;
	case GAMEOBJECT_TYPE_RITUAL:		name = "Ritual";	break;
	case GAMEOBJECT_TYPE_MAILBOX:	   name = "Mailbox";	break;
	case GAMEOBJECT_TYPE_AUCTIONHOUSE:  name = "Auction House";	break;
	case GAMEOBJECT_TYPE_GUARDPOST:	 name = "Guard Post";	break;
	case GAMEOBJECT_TYPE_SPELLCASTER:  name = "Spell Caster";	break;
	case GAMEOBJECT_TYPE_MEETINGSTONE:  name = "Meeting Stone";	break;
	case GAMEOBJECT_TYPE_FLAGSTAND:	 name = "Flag Stand";	break;
	case GAMEOBJECT_TYPE_FISHINGHOLE:   name = "Fishing Hole";	break;
	case GAMEOBJECT_TYPE_FLAGDROP:	  name = "Flag Drop";	break;
	default:							name = "Unknown type.";	break;
	}

	GOInfo = GameObjectNameStorage.LookupEntry(GObj->GetEntry());
	if( !GOInfo )
	{
		RedSystemMessage(m_session, "This GameObject doesn't have template, you won't be able to get some informations nor to spawn a GO with this entry.");
		return true;
	}
	else
	{
	BlueSystemMessage(m_session,"Informations:");
	GreenSystemMessage(m_session,"Entry:%s %d",MSG_COLOR_LIGHTBLUE, GObj->GetEntry());
	GreenSystemMessage(m_session,"Model:%s %d",MSG_COLOR_LIGHTBLUE, GObj->GetUInt32Value(GAMEOBJECT_DISPLAYID));
	GreenSystemMessage(m_session,"State:%s %d",MSG_COLOR_LIGHTBLUE, GObj->GetUInt32Value(GAMEOBJECT_STATE));
	GreenSystemMessage(m_session,"Flags:%s %d",MSG_COLOR_LIGHTBLUE, GObj->GetUInt32Value(GAMEOBJECT_FLAGS));
	GreenSystemMessage(m_session,"DynFlags:%s %d",MSG_COLOR_LIGHTBLUE, GObj->GetUInt32Value(GAMEOBJECT_DYN_FLAGS));
	GreenSystemMessage(m_session,"Faction:%s %d",MSG_COLOR_LIGHTBLUE, GObj->GetUInt32Value(GAMEOBJECT_FACTION));
	GreenSystemMessage(m_session,"TypeID:%s %d",MSG_COLOR_LIGHTBLUE, GObj->GetUInt32Value(GAMEOBJECT_TYPE_ID));
	GreenSystemMessage(m_session,"Type:%s %s", MSG_COLOR_LIGHTBLUE, name.c_str());
	GreenSystemMessage(m_session," "); //force whitespace line :/
	GreenSystemMessage(m_session,"Distance:%s %d metres",MSG_COLOR_LIGHTBLUE, uint32(GObj->CalcDistance((Object*)m_session->GetPlayer()))); //brackets much :D
	GreenSystemMessage(m_session,"Name:%s %s",MSG_COLOR_LIGHTBLUE, GOInfo->Name);
	GreenSystemMessage(m_session,"Size:%s %f",MSG_COLOR_LIGHTBLUE, GObj->GetFloatValue(OBJECT_FIELD_SCALE_X));
	}
	return true;
}
コード例 #4
0
ファイル: Level2.cpp プロジェクト: Goatform/ascent
bool ChatHandler::HandleGOInfo(const char *args, WorldSession *m_session)
{
	std::stringstream sstext;
	GameObjectInfo *GOInfo = NULL;
	GameObject *GObj = NULL;

	GObj = m_session->GetPlayer()->m_GM_SelectedGO;
	if( !GObj )
	{
		RedSystemMessage(m_session, "No selected GameObject...");
		return true;
	}
	
	sstext
		<< MSG_COLOR_SUBWHITE << "Informations:\n"
		<< MSG_COLOR_GREEN << "Entry: " << MSG_COLOR_LIGHTBLUE << GObj->GetEntry()						  << "\n"
		<< MSG_COLOR_GREEN << "Model: " << MSG_COLOR_LIGHTBLUE << GObj->GetUInt32Value(GAMEOBJECT_DISPLAYID)<< "\n"
		<< MSG_COLOR_GREEN << "State: " << MSG_COLOR_LIGHTBLUE << GObj->GetUInt32Value(GAMEOBJECT_STATE)<< "\n"
		<< MSG_COLOR_GREEN << "flags: " << MSG_COLOR_LIGHTBLUE << GObj->GetUInt32Value(GAMEOBJECT_FLAGS)<< "\n"
		<< MSG_COLOR_GREEN << "dynflags:" << MSG_COLOR_LIGHTBLUE << GObj->GetUInt32Value(GAMEOBJECT_DYN_FLAGS) << "\n"
		<< MSG_COLOR_GREEN << "faction: " << MSG_COLOR_LIGHTBLUE << GObj->GetUInt32Value(GAMEOBJECT_FACTION)<< "\n"
		<< MSG_COLOR_GREEN << "Type: "  << MSG_COLOR_LIGHTBLUE << GObj->GetUInt32Value(GAMEOBJECT_TYPE_ID)  << " -- ";

	switch( GObj->GetUInt32Value(GAMEOBJECT_TYPE_ID) )
	{
	case GAMEOBJECT_TYPE_DOOR:		  sstext << "Door";	break;
	case GAMEOBJECT_TYPE_BUTTON:		sstext << "Button";	break;
	case GAMEOBJECT_TYPE_QUESTGIVER:	sstext << "Quest Giver";	break;
	case GAMEOBJECT_TYPE_CHEST:		 sstext << "Chest";	break;
	case GAMEOBJECT_TYPE_BINDER:		sstext << "Binder";	break;
	case GAMEOBJECT_TYPE_GENERIC:	   sstext << "Generic";	break;
	case GAMEOBJECT_TYPE_TRAP:		  sstext << "Trap";	break;
	case GAMEOBJECT_TYPE_CHAIR:		 sstext << "Chair";	break;
	case GAMEOBJECT_TYPE_SPELL_FOCUS:   sstext << "Spell Focus";	break;
	case GAMEOBJECT_TYPE_TEXT:		  sstext << "Text";	break;
	case GAMEOBJECT_TYPE_GOOBER:		sstext << "Goober";	break;
	case GAMEOBJECT_TYPE_TRANSPORT:	 sstext << "Transport";	break;
	case GAMEOBJECT_TYPE_AREADAMAGE:	sstext << "Area Damage";	break;
	case GAMEOBJECT_TYPE_CAMERA:		sstext << "Camera";	break;
	case GAMEOBJECT_TYPE_MAP_OBJECT:	sstext << "Map Object";	break;
	case GAMEOBJECT_TYPE_MO_TRANSPORT:  sstext << "Mo Transport";	break;
	case GAMEOBJECT_TYPE_DUEL_ARBITER:  sstext << "Duel Arbiter";	break;
	case GAMEOBJECT_TYPE_FISHINGNODE:   sstext << "Fishing Node";	break;
	case GAMEOBJECT_TYPE_RITUAL:		sstext << "Ritual";	break;
	case GAMEOBJECT_TYPE_MAILBOX:	   sstext << "Mailbox";	break;
	case GAMEOBJECT_TYPE_AUCTIONHOUSE:  sstext << "Auction House";	break;
	case GAMEOBJECT_TYPE_GUARDPOST:	 sstext << "Guard Post";	break;
	case GAMEOBJECT_TYPE_SPELLCASTER:   sstext << "Spell Caster";	break;
	case GAMEOBJECT_TYPE_MEETINGSTONE:  sstext << "Meeting Stone";	break;
	case GAMEOBJECT_TYPE_FLAGSTAND:	 sstext << "Flag Stand";	break;
	case GAMEOBJECT_TYPE_FISHINGHOLE:   sstext << "Fishing Hole";	break;
	case GAMEOBJECT_TYPE_FLAGDROP:	  sstext << "Flag Drop";	break;
	default:							sstext << "Unknown.";	break;
	}

	sstext
		<< "\n"
		<< MSG_COLOR_GREEN << "Distance: " << MSG_COLOR_LIGHTBLUE << GObj->CalcDistance((Object*)m_session->GetPlayer());

	GOInfo = GameObjectNameStorage.LookupEntry(GObj->GetEntry());
	if( !GOInfo )
	{
		RedSystemMessage(m_session, "This GameObject doesn't have template, you won't be able to get some informations nor to spawn a GO with this entry.");
		sstext << "|r";
		SystemMessage(m_session, sstext.str().c_str());
		return true;
	}

	sstext
		<< "\n"
		<< MSG_COLOR_GREEN << "Name: "  << MSG_COLOR_LIGHTBLUE << GOInfo->Name	  << "\n"
		<< MSG_COLOR_GREEN << "Size: "  << MSG_COLOR_LIGHTBLUE << GObj->GetFloatValue(OBJECT_FIELD_SCALE_X)	  << "\n"
		<< "|r";

	SystemMessage(m_session, sstext.str().c_str());

	return true;
}
コード例 #5
0
ファイル: Level2.cpp プロジェクト: Refuge89/Hearthstone
bool ChatHandler::HandleGOInfo(const char *args, WorldSession *m_session)
{
    std::stringstream sstext;
    GameObject *GObj = NULL;

    GObj = m_session->GetPlayer()->m_GM_SelectedGO;
    if( !GObj )
    {
        RedSystemMessage(m_session, "No selected GameObject...");
        return true;
    }

    WhiteSystemMessage(m_session, "Information:");
    if(GObj->m_spawn)
        GreenSystemMessage(m_session, "SpawnID: %s%u|r", MSG_COLOR_LIGHTBLUE, GObj->m_spawn->id);
    GreenSystemMessage(m_session, "Entry: %s%u|r", MSG_COLOR_LIGHTBLUE, GObj->GetEntry());
    GreenSystemMessage(m_session, "Model: %s%u|r", MSG_COLOR_LIGHTBLUE, GObj->GetDisplayId());
    GreenSystemMessage(m_session, "State: %s%u|r", MSG_COLOR_LIGHTBLUE, GObj->GetState());
    GreenSystemMessage(m_session, "flags: %s%u|r", MSG_COLOR_LIGHTBLUE, GObj->GetFlags());
    GreenSystemMessage(m_session, "dynflags: %s%u|r", MSG_COLOR_LIGHTBLUE, GObj->GetUInt32Value(GAMEOBJECT_DYNAMIC));
    GreenSystemMessage(m_session, "faction: %s%u|r", MSG_COLOR_LIGHTBLUE, GObj->GetUInt32Value(GAMEOBJECT_FACTION));

    std::stringstream gottext;
    uint8 type = GObj->GetByte(GAMEOBJECT_BYTES_1, GAMEOBJECT_BYTES_TYPE_ID);
    switch(type)
    {
    case GAMEOBJECT_TYPE_DOOR:
        gottext << "Door";
        break;
    case GAMEOBJECT_TYPE_BUTTON:
        gottext << "Button";
        break;
    case GAMEOBJECT_TYPE_QUESTGIVER:
        gottext << "Quest Giver";
        break;
    case GAMEOBJECT_TYPE_CHEST:
        gottext << "Chest";
        break;
    case GAMEOBJECT_TYPE_BINDER:
        gottext << "Binder";
        break;
    case GAMEOBJECT_TYPE_GENERIC:
        gottext << "Generic";
        break;
    case GAMEOBJECT_TYPE_TRAP:
        gottext << "Trap";
        break;
    case GAMEOBJECT_TYPE_CHAIR:
        gottext << "Chair";
        break;
    case GAMEOBJECT_TYPE_SPELL_FOCUS:
        gottext << "Spell Focus";
        break;
    case GAMEOBJECT_TYPE_TEXT:
        gottext << "Text";
        break;
    case GAMEOBJECT_TYPE_GOOBER:
        gottext << "Goober";
        break;
    case GAMEOBJECT_TYPE_TRANSPORT:
        gottext << "Transport";
        break;
    case GAMEOBJECT_TYPE_AREADAMAGE:
        gottext << "Area Damage";
        break;
    case GAMEOBJECT_TYPE_CAMERA:
        gottext << "Camera";
        break;
    case GAMEOBJECT_TYPE_MAP_OBJECT:
        gottext << "Map Object";
        break;
    case GAMEOBJECT_TYPE_MO_TRANSPORT:
        gottext << "Mo Transport";
        break;
    case GAMEOBJECT_TYPE_DUEL_ARBITER:
        gottext << "Duel Arbiter";
        break;
    case GAMEOBJECT_TYPE_FISHINGNODE:
        gottext << "Fishing Node";
        break;
    case GAMEOBJECT_TYPE_RITUAL:
        gottext << "Ritual";
        break;
    case GAMEOBJECT_TYPE_MAILBOX:
        gottext << "Mailbox";
        break;
    case GAMEOBJECT_TYPE_AUCTIONHOUSE:
        gottext << "Auction House";
        break;
    case GAMEOBJECT_TYPE_GUARDPOST:
        gottext << "Guard Post";
        break;
    case GAMEOBJECT_TYPE_SPELLCASTER:
        gottext << "Spell Caster";
        break;
    case GAMEOBJECT_TYPE_MEETINGSTONE:
        gottext << "Meeting Stone";
        break;
    case GAMEOBJECT_TYPE_FLAGSTAND:
        gottext << "Flag Stand";
        break;
    case GAMEOBJECT_TYPE_FISHINGHOLE:
        gottext << "Fishing Hole";
        break;
    case GAMEOBJECT_TYPE_FLAGDROP:
        gottext << "Flag Drop";
        break;
    case GAMEOBJECT_TYPE_MINI_GAME:
        gottext << "Mini Game";
        break;
    case GAMEOBJECT_TYPE_LOTTERY_KIOSK:
        gottext << "Lottery KIOSK";
        break;
    case GAMEOBJECT_TYPE_CAPTURE_POINT:
        gottext << "Capture Point";
        break;
    case GAMEOBJECT_TYPE_AURA_GENERATOR:
        gottext << "Aura Generator";
        break;
    case GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY:
        gottext << "Dungeon Difficulty";
        break;
    case GAMEOBJECT_TYPE_BARBER_CHAIR:
        gottext << "Barber Chair";
        break;
    case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING:
        gottext << "Destructible Building";
        break;
    case GAMEOBJECT_TYPE_GUILD_BANK:
        gottext << "Guild Bank";
        break;
    case GAMEOBJECT_TYPE_TRAPDOOR:
        gottext << "Trap Door";
        break;
    default:
        gottext << "Unknown.";
        break;
    }
    GreenSystemMessage(m_session, "Type: %s%u|r -- %s", MSG_COLOR_LIGHTBLUE, type, gottext.str().c_str());
    GreenSystemMessage(m_session, "Distance: %s%f|r", MSG_COLOR_LIGHTBLUE, GObj->CalcDistance((Object*)m_session->GetPlayer()));
    GreenSystemMessage(m_session, "Size: %s%f|r", MSG_COLOR_LIGHTBLUE, GObj->GetFloatValue(OBJECT_FIELD_SCALE_X));
    if(GObj->GetInfo())
        GreenSystemMessage(m_session, "Name: %s%s|r", MSG_COLOR_LIGHTBLUE, GObj->GetInfo()->Name);
    GreenSystemMessage(m_session, "Phase: %s%u|r", MSG_COLOR_LIGHTBLUE, GObj->GetPhaseMask());
    SystemMessage(m_session, sstext.str().c_str());
    return true;
}