当前位置: 首页>>代码示例>>C++>>正文


C++ GameObject::GetFloatValue方法代码示例

本文整理汇总了C++中GameObject::GetFloatValue方法的典型用法代码示例。如果您正苦于以下问题:C++ GameObject::GetFloatValue方法的具体用法?C++ GameObject::GetFloatValue怎么用?C++ GameObject::GetFloatValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameObject的用法示例。


在下文中一共展示了GameObject::GetFloatValue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initialize

bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayInfoEntry& info)
{
    ModelList::const_iterator it = model_list.find(info.Displayid);
    if (it == model_list.end())
        return false;

    G3D::AABox mdl_box(it->second.bound);
    // ignore models with no bounds
    if (mdl_box == G3D::AABox::zero())
    {
        std::cout << "Model " << it->second.name << " has zero bounds, loading skipped" << std::endl;
        return false;
    }

    iModel = ((VMAP::VMapManager2*)VMAP::VMapFactory::createOrGetVMapManager())->acquireModelInstance(sWorld->GetDataPath() + "vmaps/", it->second.name);

    if (!iModel)
        return false;

    name = it->second.name;
    //flags = VMAP::MOD_M2;
    //adtId = 0;
    //ID = 0;
    iPos = Vector3(go.GetPositionX(), go.GetPositionY(), go.GetPositionZ());
    phasemask = go.GetPhaseMask();
    iScale = go.GetFloatValue(OBJECT_FIELD_SCALE_X);
    iInvScale = 1.f / iScale;

    G3D::Matrix3 iRotation = G3D::Matrix3::fromEulerAnglesZYX(go.GetOrientation(), 0, 0);
    iInvRot = iRotation.inverse();
    // transform bounding box:
    mdl_box = AABox(mdl_box.low() * iScale, mdl_box.high() * iScale);
    AABox rotated_bounds;
    for (int i = 0; i < 8; ++i)
        rotated_bounds.merge(iRotation * mdl_box.corner(i));

    this->iBound = rotated_bounds + iPos;
#ifdef SPAWN_CORNERS
    // test:
    for (int i = 0; i < 8; ++i)
    {
        Vector3 pos(iBound.corner(i));
        if (Creature* c = const_cast<GameObject&>(go).SummonCreature(24440, pos.x, pos.y, pos.z, 0, TEMPSUMMON_MANUAL_DESPAWN))
        {
            c->setFaction(35);
            c->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.1f);
        }
    }
#endif

    return true;
}
开发者ID:ArbacalTrinty,项目名称:TrinityCore,代码行数:52,代码来源:GameObjectModel.cpp

示例2: HandleGOInfo

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;
}
开发者ID:Chero,项目名称:abcwow,代码行数:67,代码来源:Level2.cpp

示例3: HandleGOSpawn

bool ChatHandler::HandleGOSpawn(const char *args, WorldSession *m_session)
{
	std::stringstream sstext;

	char* pEntryID = strtok((char*)args, " ");
	if (!pEntryID)
		return false;

	uint32 EntryID  = atoi(pEntryID);

	bool Save = false;
	char* pSave = strtok(NULL, " ");
	if (pSave)
		Save = (atoi(pSave)>0?true:false);

	GameObjectInfo* goi = GameObjectNameStorage.LookupEntry(EntryID);
	if(!goi)
	{
		sstext << "GameObject Info '" << EntryID << "' Not Found" << '\0';
		SystemMessage(m_session, sstext.str().c_str());
		return true;
	}

	sLog.outDebug("Spawning GameObject By Entry '%u'", EntryID);
	sstext << "Spawning GameObject By Entry '" << EntryID << "'" << '\0';
	SystemMessage(m_session, sstext.str().c_str());

	GameObject *go = m_session->GetPlayer()->GetMapMgr()->CreateGameObject(EntryID);

	Player *chr = m_session->GetPlayer();
	uint32 mapid = chr->GetMapId();
	float x = chr->GetPositionX();
	float y = chr->GetPositionY();
	float z = chr->GetPositionZ();
	float o = chr->GetOrientation();

	go->SetInstanceID(chr->GetInstanceID());
	go->CreateFromProto(EntryID,mapid,x,y,z,o);

	/* fuck blizz coordinate system */
	go->SetFloatValue(GAMEOBJECT_ROTATION_02, sinf(o / 2));
	go->SetFloatValue(GAMEOBJECT_ROTATION_03, cosf(o / 2));
	go->PushToWorld(m_session->GetPlayer()->GetMapMgr());

	// Create sapwn instance
	GOSpawn * gs = new GOSpawn;
	gs->entry = go->GetEntry();
	gs->facing = go->GetOrientation();
	gs->faction = go->GetUInt32Value(GAMEOBJECT_FACTION);
	gs->flags = go->GetUInt32Value(GAMEOBJECT_FLAGS);
	gs->id = objmgr.GenerateGameObjectSpawnID();
	gs->o = go->GetFloatValue(GAMEOBJECT_ROTATION);
	gs->o1 = go->GetFloatValue(GAMEOBJECT_ROTATION_01);
	gs->o2 = go->GetFloatValue(GAMEOBJECT_ROTATION_02);
	gs->o3 = go->GetFloatValue(GAMEOBJECT_ROTATION_03);
	gs->scale = go->GetFloatValue(OBJECT_FIELD_SCALE_X);
	gs->x = go->GetPositionX();
	gs->y = go->GetPositionY();
	gs->z = go->GetPositionZ();
	gs->state = go->GetUInt32Value(GAMEOBJECT_STATE);
	//gs->stateNpcLink = 0;

	uint32 cx = m_session->GetPlayer()->GetMapMgr()->GetPosX(m_session->GetPlayer()->GetPositionX());
	uint32 cy = m_session->GetPlayer()->GetMapMgr()->GetPosY(m_session->GetPlayer()->GetPositionY());

	m_session->GetPlayer()->GetMapMgr()->GetBaseMap()->GetSpawnsListAndCreate(cx,cy)->GOSpawns.push_back(gs);
	go->m_spawn = gs;

	//go->AddToWorld();

	if(Save == true)
	{
		// If we're saving, create template and add index
		go->SaveToDB();
	}
	sGMLog.writefromsession( m_session, "spawned gameobject %s, entry %u at %u %f %f %f%s", GameObjectNameStorage.LookupEntry(gs->entry)->Name, gs->entry, m_session->GetPlayer()->GetMapId(), gs->x, gs->y, gs->z, Save ? ", saved in DB" : "" );
	return true;
}
开发者ID:Chero,项目名称:abcwow,代码行数:78,代码来源:Level2.cpp

示例4: HandleGOInfo

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;
}
开发者ID:Chero,项目名称:abcwow,代码行数:69,代码来源:Level2.cpp

示例5: HandleGOInfo

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;
}
开发者ID:Goatform,项目名称:ascent,代码行数:78,代码来源:Level2.cpp

示例6: HandleGameObjectTargetCommand


//.........这里部分代码省略.........
                        pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetMapId(), name.c_str());
            }
        }
        else
        {
            std::ostringstream eventFilter;
            eventFilter << " AND (event IS NULL ";
            bool initString = true;

            for (GameEventMgr::ActiveEvents::const_iterator itr = activeEventsList.begin(); itr != activeEventsList.end(); ++itr)
            {
                if (initString)
                {
                    eventFilter << "OR event IN (" <<*itr;
                    initString =false;
                }
                else
                eventFilter << ", " << *itr;
            }

            if (!initString)
            eventFilter << "))";
            else
            eventFilter << ")";

            result = WorldDatabase.PQuery("SELECT gameobject.guid, id, position_x, position_y, position_z, orientation, map, phaseMask, "
                    "(POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ FROM gameobject "
                    "LEFT OUTER JOIN game_event_gameobject on gameobject.guid = game_event_gameobject.guid WHERE map = '%i' %s ORDER BY order_ ASC LIMIT 10",
                    handler->GetSession()->GetPlayer()->GetPositionX(), handler->GetSession()->GetPlayer()->GetPositionY(), handler->GetSession()->GetPlayer()->GetPositionZ(),
                    handler->GetSession()->GetPlayer()->GetMapId(), eventFilter.str().c_str());
        }

        if (!result)
        {
            handler->SendSysMessage(LANG_COMMAND_TARGETOBJNOTFOUND);
            return true;
        }

        bool found = false;
        float x, y, z, o;
        uint32 lowguid, id;
        uint16 mapid, phase;
        uint32 pool_id;

        do
        {
            Field *fields = result->Fetch();
            lowguid = fields[0].GetUInt32();
            id = fields[1].GetUInt32();
            x = fields[2].GetFloat();
            y = fields[3].GetFloat();
            z = fields[4].GetFloat();
            o = fields[5].GetFloat();
            mapid = fields[6].GetUInt16();
            phase = fields[7].GetUInt16();
            pool_id = sPoolMgr->IsPartOfAPool<GameObject>(lowguid);
            if (!pool_id || sPoolMgr->IsSpawnedObject<GameObject>(lowguid))
                found = true;
        }
        while (result->NextRow() && (!found));

        if (!found)
        {
            handler->PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, id);
            return false;
        }

        GameObjectInfo const* goI = sObjectMgr->GetGameObjectInfo(id);

        if (!goI)
        {
            handler->PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, id);
            return false;
        }

        GameObject* target = handler->GetSession()->GetPlayer()->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid, id, HIGHGUID_GAMEOBJECT));
        if (target)
            scale = target->GetFloatValue(OBJECT_FIELD_SCALE_X);
        
        if (!scale)
        {
            handler->PSendSysMessage(LANG_GOINFO_SCALE_ERROR);
            return false;
        }

        handler->PSendSysMessage(LANG_GAMEOBJECT_DETAIL, lowguid, goI->name, lowguid, id, x, y, z, mapid, o, phase, scale);

        if (target)
        {
            int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - time(NULL));
            if (curRespawnDelay < 0)
                curRespawnDelay = 0;

            std::string curRespawnDelayStr = secsToTimeString(curRespawnDelay, true);
            std::string defRespawnDelayStr = secsToTimeString(target->GetRespawnDelay(), true);

            handler->PSendSysMessage(LANG_COMMAND_RAWPAWNTIMES, defRespawnDelayStr.c_str(), curRespawnDelayStr.c_str());
        }
        return true;
    }
开发者ID:Kretol,项目名称:ArkCORE,代码行数:101,代码来源:cs_gobject.cpp

示例7: SpawnBattleground

void AlteracValley::SpawnBattleground()
{
		
	// Alliance Gate
	/*GameObject *gate = SpawnGameObject(180255, 529, 1284.597290, 1281.166626, -15.977916, 0.706859, 32, 114, 1.5799990);
	gate->SetFloatValue(GAMEOBJECT_ROTATION,0.0129570);
	gate->SetFloatValue(GAMEOBJECT_ROTATION_01,-0.0602880);
	gate->SetFloatValue(GAMEOBJECT_ROTATION_02,0.3449600);
	gate->SetFloatValue(GAMEOBJECT_ROTATION_03,0.9365900);
	m_Gates.insert(gate);
	
	// Horde Gate
	gate = SpawnGameObject(180256, 529, 708.0902710, 708.4479370, -17.3898964, -2.3910990, 32, 114, 1.5699990);
	gate->SetFloatValue(GAMEOBJECT_ROTATION,0.0502910);
	gate->SetFloatValue(GAMEOBJECT_ROTATION_01,0.0151270);
	gate->SetFloatValue(GAMEOBJECT_ROTATION_02,0.9292169);
	gate->SetFloatValue(GAMEOBJECT_ROTATION_03,-0.3657840);
	m_Gates.insert(gate);*/
	
	// -- Places Banners --
	
	// Frostworlf gravyard
	GameObject *pbanner = SpawnGameObject(178393 ,30 ,-1083.244385 ,-345.994507 ,55.124435 ,4.596910, 32, 84, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pbanner->AddToWorld();
	
	if(pbanner->GetInfo()->sound3)
	{
		pbanner->pcbannerAura = SpawnGameObject(pbanner->GetInfo()->sound3, 30, pbanner->GetPositionX(), pbanner->GetPositionY(), pbanner->GetPositionZ(), pbanner->GetOrientation(), 32, 114, 5);
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_03));
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
		pbanner->pcbannerAura->AddToWorld();
	}
	
	pbanner->bannerslot = 0;
	
	// Iceblood graveyard
	pbanner = SpawnGameObject(178393, 30 ,-612.329285 ,-396.660095 ,60.858463 ,2.916166, 32, 84, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pbanner->AddToWorld();
	
	if(pbanner->GetInfo()->sound3)
	{
		pbanner->pcbannerAura = SpawnGameObject(pbanner->GetInfo()->sound3, 30, pbanner->GetPositionX(), pbanner->GetPositionY(), pbanner->GetPositionZ(), pbanner->GetOrientation(), 32, 114, 5);
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_03));
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
		pbanner->pcbannerAura->AddToWorld();
	}
	
	pbanner->bannerslot = 1;
	
	// Stormpike gravyard
	pbanner = SpawnGameObject(178389, 30 ,669.968567 ,-293.467468 ,30.283821 ,3.152932, 32, 83, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pbanner->AddToWorld();
	
	if(pbanner->GetInfo()->sound3)
	{
		pbanner->pcbannerAura = SpawnGameObject(pbanner->GetInfo()->sound3, 30, pbanner->GetPositionX(), pbanner->GetPositionY(), pbanner->GetPositionZ(), pbanner->GetOrientation(), 32, 114, 5);
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_03));
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
		pbanner->pcbannerAura->AddToWorld();
	}
	
	pbanner->bannerslot = 2;
	
	// Stoneheart gravyard
	pbanner = SpawnGameObject(178389, 30 ,78.205989 ,-405.1715 ,47.11583 ,1.535766, 32, 83, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pbanner->AddToWorld();
	
	if(pbanner->GetInfo()->sound3)
	{
		pbanner->pcbannerAura = SpawnGameObject(pbanner->GetInfo()->sound3, 30, pbanner->GetPositionX(), pbanner->GetPositionY(), pbanner->GetPositionZ(), pbanner->GetOrientation(), 32, 114, 5);
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_03));
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
		pbanner->pcbannerAura->AddToWorld();
	}
	
	pbanner->bannerslot = 3;
//.........这里部分代码省略.........
开发者ID:jameyboor,项目名称:Antrix,代码行数:101,代码来源:AlteracValley.cpp

示例8: EventCaptureBase

void AlteracValley::EventCaptureBase(Player *src,uint32 bannerslot)
{
	if(!gcbanner[bannerslot])
		return;
		
	   /*uint64 guid = src->GetGUID();
	std::map<uint64, BattlegroundScore>::iterator itr = m_PlayerScores.find(guid);
	if(itr == m_PlayerScores.end())
	{
		SendMessageToPlayer(src, "INTERNAL ERROR: Could not find in internal player score map!", true);
		return;
	}
	itr->second.FlagCaptures++;
	UpdatePVPData();*/
			
	//uint32 rbasesfield = src->m_bgTeam ? AB_HORDE_CAPTUREBASE : AB_ALLIANCE_CAPTUREBASE;
	   
	uint32 goentry = 0;
	if(bannerslot < 6) // outside flags are diferent
		goentry = src->m_bgTeam ? 178393:178389;
	else
		goentry = src->m_bgTeam ? 178946:178935;

	GameObject *pcbanner = src->GetCurrentBattleground()->SpawnGameObject(goentry, 30, gcbanner[bannerslot]->GetPositionX(), gcbanner[bannerslot]->GetPositionY(), gcbanner[bannerslot]->GetPositionZ(), gcbanner[bannerslot]->GetOrientation(), 32, src->m_bgTeam ?84:83, 1);
	pcbanner->SetFloatValue(GAMEOBJECT_ROTATION_02,gcbanner[bannerslot]->GetFloatValue(GAMEOBJECT_ROTATION_02));
	pcbanner->SetFloatValue(GAMEOBJECT_ROTATION_03,gcbanner[bannerslot]->GetFloatValue(GAMEOBJECT_ROTATION_03));
	pcbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pcbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pcbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pcbanner->AddToWorld();
	
	if(pcbanner->GetInfo()->sound3)
	{
		pcbanner->pcbannerAura = src->GetCurrentBattleground()->SpawnGameObject(pcbanner->GetInfo()->sound3, 30, pcbanner->GetPositionX(), pcbanner->GetPositionY(), pcbanner->GetPositionZ(), pcbanner->GetOrientation(), 32, 114, 5);
		pcbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pcbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
		pcbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pcbanner->GetFloatValue(GAMEOBJECT_ROTATION_03));
		pcbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
		pcbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
		pcbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
		pcbanner->pcbannerAura->AddToWorld();
	}
	
	if(gcbanner[bannerslot]->pcbannerAura)
	{
		if( gcbanner[bannerslot]->pcbannerAura->IsInWorld() )
			gcbanner[bannerslot]->pcbannerAura->RemoveFromWorld();
		delete gcbanner[bannerslot]->pcbannerAura;
	}
	
	if( gcbanner[bannerslot]->IsInWorld() )
			gcbanner[bannerslot]->RemoveFromWorld();
	delete gcbanner[bannerslot];
	
	gcbanner[bannerslot] = NULL;
	
	// Play sound
	WorldPacket pkt;
	pkt.Initialize(SMSG_PLAY_SOUND);
	pkt << uint32(src->m_bgTeam ? SOUND_HORDE_CAPTURE : SOUND_ALLIANCE_CAPTURE);
	SendPacketToAll(&pkt);
	
	char message[300];   
	static char *resnames[11] = {"Frostworlf Gravyard","Iceblood Graveyard","Stormpike Gravyard",
									"Stoneheart gravyard","Relief Hunt","Stormpike Aid Station",
									"Iceblood Tower","Stoneheart Bunker","Icewing Bunker",
									"Stormpike North Bunker","Stormpike South Bunker"};
					
	snprintf(message, 300, "The %s has taken the %s!", src->m_bgTeam ? "Horde" : "Alliance" , resnames[bannerslot] );
		
	WorldPacket *data = BuildMessageChat(src->m_bgTeam ? 0x54:0x53, 0x27, message, 0);
	SendPacketToAll(data);
	delete data;
}
开发者ID:jameyboor,项目名称:Antrix,代码行数:73,代码来源:AlteracValley.cpp

示例9: HandleGOInfo


//.........这里部分代码省略.........
    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;
}
开发者ID:Refuge89,项目名称:Hearthstone,代码行数:101,代码来源:Level2.cpp

示例10: HandleGOSpawn

bool ChatHandler::HandleGOSpawn(const char *args, WorldSession *m_session)
{
    if(!args)
        return false;

    char* pEntryID = strtok((char*)args, " ");
    if (!pEntryID)
        return false;

    uint32 EntryID = atoi(pEntryID);
    if((GameObjectNameStorage.LookupEntry(EntryID) == NULL) || (objmgr.SQLCheckExists("gameobject_names", "entry", EntryID) == NULL))
    {
        RedSystemMessage(m_session, "Invalid Gameobject ID(%u).", EntryID);
        return true;
    }

    bool Save = m_session->HasGMPermissions() ? true : false;
    char* pSave = strtok(NULL, " ");
    if(pSave)
        Save = (atoi(pSave) > 0 ? true : false);

    GameObject* go = m_session->GetPlayer()->GetMapMgr()->CreateGameObject(EntryID);
    if(go == NULL)
    {
        RedSystemMessage(m_session, "Spawn of Gameobject(%u) failed.", EntryID);
        return true;
    }
    go->Init();

    Player* chr = m_session->GetPlayer();
    uint32 mapid = chr->GetMapId();
    float x = chr->GetPositionX();
    float y = chr->GetPositionY();
    float z = chr->GetPositionZ();
    float o = chr->GetOrientation();
    go->CreateFromProto(EntryID,mapid,x,y,z,o);
    BlueSystemMessage(m_session, "Spawning Gameobject(%u) at current position", EntryID);

    if(Save == true) // If we're saving, create template and add index
    {
        // Create spawn instance
        GOSpawn *gs = new GOSpawn;
        gs->entry = go->GetEntry();
        gs->facing = go->GetOrientation();
        gs->faction = go->GetUInt32Value(GAMEOBJECT_FACTION);
        gs->flags = go->GetUInt32Value(GAMEOBJECT_FLAGS);
        gs->id = objmgr.GenerateGameObjectSpawnID();
        gs->scale = go->GetFloatValue(OBJECT_FIELD_SCALE_X);
        gs->x = x;
        gs->y = y;
        gs->z = z;
        gs->state = go->GetByte(GAMEOBJECT_BYTES_1, GAMEOBJECT_BYTES_STATE);
        gs->phase = chr->GetPhaseMask();
        go->Load(gs);
        go->SaveToDB();
        uint32 cx = chr->GetMapMgr()->GetPosX(x);
        uint32 cy = chr->GetMapMgr()->GetPosY(y);
        chr->GetMapMgr()->AddGoSpawn(cx, cy, gs);
    }

    go->SetPhaseMask(chr->GetPhaseMask());
    go->SetInstanceID(chr->GetInstanceID());
    go->PushToWorld(m_session->GetPlayer()->GetMapMgr());

    sWorld.LogGM(m_session, "Spawned gameobject %u at %f %f %f (%s)", EntryID, x, y, z, Save ? "Saved" : "Not Saved");
    return true;
}
开发者ID:Refuge89,项目名称:Hearthstone,代码行数:67,代码来源:Level2.cpp


注:本文中的GameObject::GetFloatValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。