本文整理汇总了C++中AddObject函数的典型用法代码示例。如果您正苦于以下问题:C++ AddObject函数的具体用法?C++ AddObject怎么用?C++ AddObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AddObject函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _HYLabel
//__________________________________________________________
_HYObjectInspector::_HYObjectInspector(void):_HYTWindow (objectInspectorTitle, false)
{
_HYRect canvasSettings = {30,50,30,50,HY_COMPONENT_NO_SCROLL};
_HYLabel* l1 = new _HYLabel (canvasSettings,GetOSWindowData());
canvasSettings.left = 110;
canvasSettings.right = 10000;
_HYPullDown* p1 = new _HYPullDown (canvasSettings,GetOSWindowData());
p1->EnableMenu(true);
canvasSettings.left = canvasSettings.right = 90;
_HYButtonBar* b1 = new _HYButtonBar(canvasSettings,GetOSWindowData());
canvasSettings.top = 20;
canvasSettings.left = 250;
canvasSettings.bottom = 10000;
canvasSettings.width = HY_COMPONENT_V_SCROLL;
_HYTable* ot = new _HYTable (canvasSettings,GetOSWindowData(),1,2,125,100,HY_TABLE_STATIC_TEXT);
canvasSettings.width = HY_COMPONENT_NO_SCROLL|HY_COMPONENT_BORDER_B|HY_COMPONENT_BORDER_T;
_HYTable* ot2 = new _HYTable (canvasSettings,GetOSWindowData(),1,2,125,20,HY_TABLE_STATIC_TEXT);
ot->SetMessageRecipient (this);
ot2->SetMessageRecipient (this);
b1->SetMessageRecipient (this);
p1->SetMessageRecipient (this);
_String toolTipText ("Open window with the object");
b1->AddButton (ProcureIconResource(HY_DATAPANEL_ICON_ID+7),&toolTipText);
toolTipText = "Delete selected object";
b1->AddButton (ProcureIconResource(HY_DATAPANEL_ICON_ID+3),&toolTipText);
toolTipText = "Read object from file";
b1->AddButton (ProcureIconResource(HY_DATAPANEL_ICON_ID+8),&toolTipText);
toolTipText = "Create new object";
b1->AddButton (ProcureIconResource(HY_DATAPANEL_ICON_ID+9),&toolTipText);
b1->EnableButton(0,false);
b1->EnableButton(1,false);
b1->EnableButton(2,false);
b1->EnableButton(3,false);
b1->SetButtonDim(16);
AddObject (l1);
AddObject (ot);
AddObject (ot2);
AddObject (p1);
AddObject (b1);
SetTableDimensions (3,3);
SetCell (0,0,b1);
SetCell (0,1,p1);
SetCell (0,2,p1);
SetCell (1,0,ot2);
SetCell (1,1,ot2);
SetCell (1,2,ot2);
SetCell (2,0,ot);
SetCell (2,1,ot);
SetCell (2,2,ot);
_HYFont labelFont;
#ifdef __WINDOZE__
labelFont.face = "MS Sans Serif";
labelFont.size = 10;
#else
#ifdef __HYPHY_GTK__
labelFont.face = _HY_SANS_FONT;
labelFont.size = 12;
#else
labelFont.face = "Geneva";
labelFont.size = 14;
#endif
#endif
labelFont.style = HY_FONT_PLAIN;
l1->SetFont (labelFont);
#ifdef __MAC__
labelFont.face = "Times";
labelFont.size = 12;
#endif
ot->SetFont (labelFont);
ot2->SetFont (labelFont);
l1->SetBackColor (boxBColor);
p1->SetBackColor (boxBColor);
b1->SetBackColor (boxBColor);
l1->SetForeColor (boxFColor);
l1->SetAlignFlags (HY_ALIGN_LEFT);
l1->SetShadow(true);
p1->SetAlignFlags (HY_ALIGN_LEFT);
b1->SetAlignFlags (HY_ALIGN_LEFT);
ot->selectionType = HY_TABLE_SEL_ROWS|HY_TABLE_DONT_SIZE|HY_TABLE_FOCUSABLE ;
ot2->selectionType = HY_TABLE_SEL_ROWS|HY_TABLE_DONT_SIZE;
_String cellValue ("Object ID");
ot2->SetCellData (&cellValue,0,0,HY_TABLE_BOLD|HY_TABLE_STATIC_TEXT|HY_TABLE_BEVELED|HY_TABLE_CANTSELECT|HY_TABLE_PULLDOWN,true);
cellValue = "Object Info";
ot2->SetCellData (&cellValue,0,1,HY_TABLE_STATIC_TEXT|HY_TABLE_BEVELED|HY_TABLE_CANTSELECT|HY_TABLE_BOLD,true);
l1->SetText (_String(" Class"));
p1->AddMenuItem ("Trees",-1);
p1->AddMenuItem ("Data Sets",-1);
p1->AddMenuItem ("Models",-1);
p1->AddMenuItem ("Likelihood Functions",-1);
p1->ChangeSelection (objectInspectorObjClass,false);
//.........这里部分代码省略.........
示例2: StateDB
void State::Load(Serializer& s){
StateDB(1,"myType");
s>>myType;
///State::ID
StateDB(1,"ID");
s>>ID;
///State::Images
unsigned int stateimagesize=0u;
StateDB(1,"stateimagesize");
s>>stateimagesize;
for(unsigned int a=0;a<stateimagesize;a++){
StateDB(1,"Image");
string img="";
s>>img;
///cout<<"Loading Image \'"<<img<<"\'"<<endl;
LoadImage(img);
}
///State::Fonts
unsigned int statefontsize=0u;
StateDB(1,"statefontsize");
s>>statefontsize;
for(unsigned int a=0;a<statefontsize;a++){
StateDB(1,"Font");
string font="";
s>>font;
///cout<<"Saving Font \'"<<font<<"\'"<<endl;
LoadFont(font);
}
///State::StateObjects
Game->GameStates[ID]=this;
///cout<<"Top of State Load"<<endl;
///cout<<"State Objects"<<endl;
unsigned int sos=0;
StateDB(1,"State Object Size");
s>>sos;
for(unsigned int a=0;a<sos;a++){
string Type;
s>>Type;
StateDB(1,"State Object \'"+Type+"\'");
///cout<<"Load Obj "<<a<<"/"<<sos<<"'" << Type << "'" <<endl;
s.Reader(s.Reader()-Type.size()-4u);
if(!Engine::Loaders.count(Type)){
cout<<"Unknown Object Type \'"<<Type<<"\' !"<<endl;
exit(1);
}
auto A=Engine::Loaders[Type];
if(A==NULL){
cout<<"NULL Function!"<<endl;
exit(1);
}
Object* O=new Object();
O=A(this,s);
O->DefEvents();
StateObjects.push_back(O);
}
///cout<<"State Adding Objects"<<endl;
StateDB(1,"Adding Object Size");
unsigned int aos=0;
s>>aos;
for(unsigned int a=0;a<aos;a++){
StateDB(1,"Adding Object");
Object* O=new Object(NULL,'D');
O->Load(s);
AddObject(O);
}
///cout<<"State Collision Objects"<<endl;
unsigned int cos=0;
StateDB(1,"Collision Object Size");
s>>cos;
for(unsigned int a=0;a<cos;a++){
StateDB(1,"Collision Object");
unsigned int id=0;
s>>id;
CollidingObjects.push_back(It2Ptr(id));
}
///cout<<"State Removing Objects"<<endl;
unsigned int ros=0;
StateDB(1,"Removing Object Size");
s>>ros;
for(unsigned int a=0;a<ros;a++){
StateDB(1,"Removing Object");
unsigned int id=0;
s>>id;
RemovingObjects.push_back(It2Ptr(id));
}
StateDB(1,"CLS");
///cout<<"State Other"<<endl;
s>>cls;
StateDB(1,"CellSize");
s>>CellSize;
StateDB(1,"Persistance");
s>>Persistance;
}
示例3: sin
bool BattleGroundAB::SetupBattleGround()
{
for (int i = 0 ; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
if( !AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i,BG_AB_OBJECTID_NODE_BANNER_0 + i,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i,BG_AB_OBJECTID_BANNER_CONT_A,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i,BG_AB_OBJECTID_BANNER_CONT_H,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i,BG_AB_OBJECTID_BANNER_A,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_BANNER_HORDE + 8*i,BG_AB_OBJECTID_BANNER_H,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_AURA_ALLY + 8*i,BG_AB_OBJECTID_AURA_A,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_AURA_HORDE + 8*i,BG_AB_OBJECTID_AURA_H,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i,BG_AB_OBJECTID_AURA_C,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
)
{
sLog.outErrorDb("BatteGroundAB: Failed to spawn some object BattleGround not created!");
return false;
}
}
if( !AddObject(BG_AB_OBJECT_GATE_A,BG_AB_OBJECTID_GATE_A,BG_AB_DoorPositions[0][0],BG_AB_DoorPositions[0][1],BG_AB_DoorPositions[0][2],BG_AB_DoorPositions[0][3],BG_AB_DoorPositions[0][4],BG_AB_DoorPositions[0][5],BG_AB_DoorPositions[0][6],BG_AB_DoorPositions[0][7],RESPAWN_IMMEDIATELY)
|| !AddObject(BG_AB_OBJECT_GATE_H,BG_AB_OBJECTID_GATE_H,BG_AB_DoorPositions[1][0],BG_AB_DoorPositions[1][1],BG_AB_DoorPositions[1][2],BG_AB_DoorPositions[1][3],BG_AB_DoorPositions[1][4],BG_AB_DoorPositions[1][5],BG_AB_DoorPositions[1][6],BG_AB_DoorPositions[1][7],RESPAWN_IMMEDIATELY)
)
{
sLog.outErrorDb("BatteGroundAB: Failed to spawn door object BattleGround not created!");
return false;
}
//buffs
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
if( !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
)
sLog.outErrorDb("BatteGroundAB: Failed to spawn buff object!");
}
return true;
}
示例4: OPvPCapturePoint
OPvPCapturePointEP_EWT::OPvPCapturePointEP_EWT(OutdoorPvP *pvp)
: OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_UnitsSummonedSide(0)
{
SetCapturePointData(EPCapturePoints[EP_EWT].entry, EPCapturePoints[EP_EWT].map, EPCapturePoints[EP_EWT].x, EPCapturePoints[EP_EWT].y, EPCapturePoints[EP_EWT].z, EPCapturePoints[EP_EWT].o, EPCapturePoints[EP_EWT].rot0, EPCapturePoints[EP_EWT].rot1, EPCapturePoints[EP_EWT].rot2, EPCapturePoints[EP_EWT].rot3);
AddObject(EP_EWT_FLAGS, EPTowerFlags[EP_EWT].entry, EPTowerFlags[EP_EWT].map, EPTowerFlags[EP_EWT].x, EPTowerFlags[EP_EWT].y, EPTowerFlags[EP_EWT].z, EPTowerFlags[EP_EWT].o, EPTowerFlags[EP_EWT].rot0, EPTowerFlags[EP_EWT].rot1, EPTowerFlags[EP_EWT].rot2, EPTowerFlags[EP_EWT].rot3);
}
示例5: switch
bool System::mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
{
if(!m_bEnableInput){
return true;
}
if(id==OIS::MB_Left){
Engine::Scene* pScene = GameSystem::GetSingleton()->GetCurrentSection()->GetScene();
switch(m_CM){
case enCM_Select:{
Ray ray = BuildRay(arg.state.X.abs,arg.state.Y.abs);
Engine::MovableObject* pObj=NULL;
if(pScene->GetStaticSceneNode()->RayCast(ray,pObj)){
m_pRayCastMesh = dynamic_cast<Engine::MeshEntity*>(pObj);
S8* pKey = Engine::GetGlobalSetting().m_pInputSystem->m_KeyArray;
if( pKey[OIS::KC_LCONTROL] == 0 &&
pKey[OIS::KC_RCONTROL] == 0)
{
m_lstSelectObj.clear();
}
if(m_pRayCastMesh!=NULL){
m_lstSelectObj.push_back(m_pRayCastMesh);
Engine::SceneNode* pNode = m_pRayCastMesh->GetParentSceneNode();
if(pNode!=NULL){
const Float3 vObjPos = pNode->GetGlobalPosition();
m_pObjController->SetPosition(pNode->GetGlobalPosition());
}
m_pObjController->SetSelectObjectBoundingBox( m_pRayCastMesh->GetWorldBoundingBox());
}else {
Engine::SceneNode* pNode = pObj->GetParentSceneNode();
if(pNode!=NULL){
m_lstSelectObj.push_back(m_pRayCastMesh);
m_pObjController->SetPosition(pNode->GetGlobalPosition());
m_pObjController->SetSelectObjectBoundingBox(pObj->GetWorldBoundingBox());
}
}
}
break;}
case enCM_SelectList:{
break;}
case enCM_Move:
case enCM_Rotate:
case enCM_Scale:{
m_bIsControl = false;
m_MoveType = Engine::eMRCT_None;
m_MoveDir = Float2(arg.state.X.abs,arg.state.Y.abs);
break;}
case enCM_Create:{
Ray ray = BuildRay(arg.state.X.abs,arg.state.Y.abs);
Engine::MovableObject* pObj=NULL;
float fDis=999999.0f;
if(pScene->GetStaticSceneNode()->RayCast(ray,pObj,&fDis)){
m_vRayCastPoint = ray.m_vStart + ray.m_vDirection*fDis;
switch(m_CT){
case enCT_Object:{
AddObject(m_strCreateObjectName,m_vRayCastPoint);
}break;
case enCT_Actor:{
AddActor(m_strCreateObjectName,m_vRayCastPoint);
}break;
}
}
break;}
}
}
return true;
}
示例6: GetNextBanner
void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target_obj)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
// All the node points are iterated to find the clicked one
for (uint8 i = 0; i < MAX_NODE_TYPES; ++i)
{
if (nodePoint[i].gameobject_entry == target_obj->GetEntry())
{
// THIS SHOULD NEEVEER HAPPEN
if (nodePoint[i].faction == player->GetTeamId())
return;
uint32 nextBanner = GetNextBanner(&nodePoint[i], player->GetTeamId(), false);
// we set the new settings of the nodePoint
nodePoint[i].faction = player->GetTeamId();
nodePoint[i].last_entry = nodePoint[i].gameobject_entry;
nodePoint[i].gameobject_entry = nextBanner;
// this is just needed if the next banner is grey
if (nodePoint[i].banners[BANNER_A_CONTESTED] == nextBanner || nodePoint[i].banners[BANNER_H_CONTESTED] == nextBanner)
{
nodePoint[i].timer = BANNER_STATE_CHANGE_TIME; // 1 minute for last change (real faction banner)
nodePoint[i].needChange = true;
RelocateDeadPlayers(BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1 + nodePoint[i].nodeType - 2]);
// if we are here means that the point has been lost, or it is the first capture
if (nodePoint[i].nodeType != NODE_TYPE_REFINERY && nodePoint[i].nodeType != NODE_TYPE_QUARRY)
if (BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2])
DelCreature(BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2);
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
SendMessage2ToAll(LANG_BG_IC_TEAM_ASSAULTED_NODE_1, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string);
SendMessage2ToAll(LANG_BG_IC_TEAM_ASSAULTED_NODE_2, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string, (player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE));
HandleContestedNodes(&nodePoint[i]);
}
else if (nextBanner == nodePoint[i].banners[BANNER_A_CONTROLLED] || nextBanner == nodePoint[i].banners[BANNER_H_CONTROLLED]) // if we are going to spawn the definitve faction banner, we dont need the timer anymore
{
nodePoint[i].timer = BANNER_STATE_CHANGE_TIME;
nodePoint[i].needChange = false;
SendMessage2ToAll(LANG_BG_IC_TEAM_DEFENDED_NODE, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string);
HandleCapturedNodes(&nodePoint[i], true);
UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
}
GameObject* banner = GetBGObject(nodePoint[i].gameobject_type);
if (!banner) // this should never happen
return;
float cords[4] = {banner->GetPositionX(), banner->GetPositionY(), banner->GetPositionZ(), banner->GetOrientation() };
DelObject(nodePoint[i].gameobject_type);
if (!AddObject(nodePoint[i].gameobject_type, nodePoint[i].gameobject_entry, cords[0], cords[1], cords[2], cords[3], 0, 0, 0, 0, RESPAWN_ONE_DAY))
{
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a banner (type: %u, entry: %u). Isle of Conquest BG cancelled.", nodePoint[i].gameobject_type, nodePoint[i].gameobject_entry);
EndBattleground(0);
}
GetBGObject(nodePoint[i].gameobject_type)->SetUInt32Value(GAMEOBJECT_FACTION, nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_Factions[1] : BG_IC_Factions[0]);
UpdateNodeWorldState(&nodePoint[i]);
// we dont need iterating if we are here
// If the needChange bool was set true, we will handle the rest in the Update Map function.
return;
}
}
}
示例7: GetBGObject
//.........这里部分代码省略.........
for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_A : BG_IC_NPC_GLAIVE_THROWER_2_H); ++u)
{
if (Creature* glaiveThrower = GetBGCreature(u))
{
if (!glaiveThrower->IsAlive())
glaiveThrower->Respawn(true);
}
}
docksTimer = DOCKS_UPDATE_TIME;
} else docksTimer -= diff;
}
}
if (nodePoint[i].nodeType == NODE_TYPE_WORKSHOP)
{
if (nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
{
if (siegeEngineWorkshopTimer <= diff)
{
uint8 siegeType = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
if (Creature* siege = GetBGCreature(siegeType)) // this always should be true
{
if (siege->IsAlive())
{
if (siege->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_UNK_14|UNIT_FLAG_IMMUNE_TO_PC))
// following sniffs the vehicle always has UNIT_FLAG_UNK_14
siege->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_IMMUNE_TO_PC);
else
siege->SetHealth(siege->GetMaxHealth());
}
else
siege->Respawn(true);
}
// we need to confirm if it is every 3 minutes
for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_A : BG_IC_NPC_DEMOLISHER_4_H); ++u)
{
if (Creature* demolisher = GetBGCreature(u))
{
if (!demolisher->IsAlive())
demolisher->Respawn(true);
}
}
siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
} else siegeEngineWorkshopTimer -= diff;
}
}
// the point is waiting for a change on its banner
if (nodePoint[i].needChange)
{
if (nodePoint[i].timer <= diff)
{
uint32 nextBanner = GetNextBanner(&nodePoint[i], nodePoint[i].faction, true);
nodePoint[i].last_entry = nodePoint[i].gameobject_entry;
nodePoint[i].gameobject_entry = nextBanner;
// nodePoint[i].faction = the faction should be the same one...
GameObject* banner = GetBGObject(nodePoint[i].gameobject_type);
if (!banner) // this should never happen
return;
float cords[4] = {banner->GetPositionX(), banner->GetPositionY(), banner->GetPositionZ(), banner->GetOrientation() };
DelObject(nodePoint[i].gameobject_type);
AddObject(nodePoint[i].gameobject_type, nodePoint[i].gameobject_entry, cords[0], cords[1], cords[2], cords[3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
GetBGObject(nodePoint[i].gameobject_type)->SetUInt32Value(GAMEOBJECT_FACTION, nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_Factions[1] : BG_IC_Factions[0]);
UpdateNodeWorldState(&nodePoint[i]);
HandleCapturedNodes(&nodePoint[i], false);
SendMessage2ToAll(LANG_BG_IC_TEAM_HAS_TAKEN_NODE, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL, (nodePoint[i].faction == TEAM_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE), nodePoint[i].string);
nodePoint[i].needChange = false;
nodePoint[i].timer = BANNER_STATE_CHANGE_TIME;
} else nodePoint[i].timer -= diff;
}
}
if (resourceTimer <= diff)
{
for (uint8 i = 0; i < NODE_TYPE_DOCKS; ++i)
{
if (nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
{
factionReinforcements[nodePoint[i].faction] += 1;
RewardHonorToTeam(RESOURCE_HONOR_AMOUNT, nodePoint[i].faction == TEAM_ALLIANCE ? ALLIANCE : HORDE);
UpdateWorldState((nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_ALLIANCE_RENFORT : BG_IC_HORDE_RENFORT), factionReinforcements[nodePoint[i].faction]);
}
}
resourceTimer = IC_RESOURCE_TIME;
} else resourceTimer -= diff;
}
示例8: AddObject
bool BattlegroundAB::SetupBattleground()
{
for (uint32 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
AddObject(BG_AB_OBJECT_BANNER_ALLY + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
AddObject(BG_AB_OBJECT_BANNER_HORDE + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
AddObject(BG_AB_OBJECT_BANNER_CONT_A + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
AddObject(BG_AB_OBJECT_BANNER_CONT_H + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
AddObject(BG_AB_OBJECT_AURA_ALLY + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_AURA_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
AddObject(BG_AB_OBJECT_AURA_HORDE + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_AURA_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
AddObject(BG_AB_OBJECT_AURA_CONTESTED + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
}
AddObject(BG_AB_OBJECT_GATE_A, BG_AB_OBJECTID_GATE_A, BG_AB_DoorPositions[0][0], BG_AB_DoorPositions[0][1], BG_AB_DoorPositions[0][2], BG_AB_DoorPositions[0][3], BG_AB_DoorPositions[0][4], BG_AB_DoorPositions[0][5], BG_AB_DoorPositions[0][6], BG_AB_DoorPositions[0][7], RESPAWN_IMMEDIATELY);
AddObject(BG_AB_OBJECT_GATE_H, BG_AB_OBJECTID_GATE_H, BG_AB_DoorPositions[1][0], BG_AB_DoorPositions[1][1], BG_AB_DoorPositions[1][2], BG_AB_DoorPositions[1][3], BG_AB_DoorPositions[1][4], BG_AB_DoorPositions[1][5], BG_AB_DoorPositions[1][6], BG_AB_DoorPositions[1][7], RESPAWN_IMMEDIATELY);
for (uint32 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY);
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY);
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY);
}
AddSpiritGuide(BG_AB_SPIRIT_ALIANCE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][3], TEAM_ALLIANCE);
AddSpiritGuide(BG_AB_SPIRIT_HORDE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][3], TEAM_HORDE);
for (uint32 i = BG_AB_OBJECT_BANNER_NEUTRAL; i < BG_AB_OBJECT_MAX; ++i)
if (BgObjects[i] == 0)
{
sLog->outErrorDb("BatteGroundAB: Failed to spawn some object Battleground not created!");
return false;
}
for (uint32 i = BG_AB_SPIRIT_ALIANCE; i <= BG_AB_SPIRIT_HORDE; ++i)
if (BgCreatures[i] == 0)
{
sLog->outErrorDb("BatteGroundAB: Failed to spawn spirit guides Battleground not created!");
return false;
}
return true;
}
示例9: CreateBitmap
//.........这里部分代码省略.........
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00
};
BYTE bPlay[] = {0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F
};
hBmp[PS_PLAY] = CreateBitmap(56, 7, 1, 1, bPlay);
hBmp[PS_PAUSE] = CreateBitmap(14, 7, 1, 1, bPause);
hBmp[PS_STOP] = CreateBitmap(8, 7, 1, 1, bStop);
// Initialize the text control (media)
m_Text1.Initialize();
m_Text1.SetOrigin(x, y);
m_Text1.SetSize(320 - x, 26);
m_Text1.SetAlignment(DT_CENTER | DT_VCENTER);
m_Text1.SetWordWrap(false);
m_Text1.SetText(_T(""));
m_Text1.SetFontPointSize(16);
m_Text1.SetStartDelay(5000);
m_Text1.SetEndDelay(2000);
m_Text1.EnableRepeat(true);
m_Text1.SetScrollDirection(SCROLL_HORZ);
m_Text1.SetSpeed(24);
// Initialize the progressbar control (media progress)
y += 30;
m_ProgBar[1].Initialize();
m_ProgBar[1].SetOrigin(x + 20, y);
m_ProgBar[1].SetSize(320 - x - 20, 14);
m_ProgBar[1].SetPos(0);
m_ProgBar[1].SetRange(0, 100);
m_ProgBar[1].SetProgressStyle(CLCDMyProgressBar::STYLE_FILLED_H);
// gfx
m_PlayState.Initialize();
m_PlayState.SetOrigin(x, y);
m_PlayState.SetSize(14, 14);
m_PlayState.SetBitmap(hBmp[PS_PLAY]);
m_PlayState.ResetUpdate();
m_PlayState.SetZoomLevel(2);
m_PlayState.SetSubpicWidth(7);
m_PlayState.SetAnimationRate(300);
m_PlayState.SetAlpha(false);
m_PlayState.GetSize();
// Initialize the text control (time / mpc messages)
y += 14;
m_Text[0].Initialize();
m_Text[0].SetOrigin(x, y);
m_Text[0].SetSize(320 - x, /*13*/50);
m_Text[0].SetAlignment(DT_CENTER);
m_Text[0].SetWordWrap(false);
m_Text[0].SetText(_T(""));
m_Text[0].SetFontPointSize(14);
hFont = m_Text[0].GetFont();
GetObject(hFont, sizeof(LOGFONT), &lf);
wcscpy_s(lf.lfFaceName, LF_FACESIZE, _T("Microsoft Sans Serif"));
m_Text[0].SetFont(lf);
y += 22;
m_Text[1].Initialize();
m_Text[1].SetOrigin(x, y);
m_Text[1].SetSize(320 - x, /*13*/50);
m_Text[1].SetAlignment(DT_CENTER);
m_Text[1].SetWordWrap(false);
m_Text[1].SetText(_T(""));
m_Text[1].SetFontPointSize(14);
hFont = m_Text[1].GetFont();
GetObject(hFont, sizeof(LOGFONT), &lf);
wcscpy_s(lf.lfFaceName, LF_FACESIZE, _T("Microsoft Sans Serif"));
m_Text[1].SetFont(lf);
// Initialize the progressbar control (volume)
m_ProgBar[0].Initialize();
m_ProgBar[0].SetOrigin(0, 0);
m_ProgBar[0].SetSize(14, 86);
m_ProgBar[0].SetPos(0);
m_ProgBar[0].SetRange(0, 100);
m_ProgBar[0].SetProgressStyle(CLCDMyProgressBar::STYLE_FILLED_V);
AddObject(&m_Text1);
AddObject(&m_Text[0]);
AddObject(&m_Text[1]);
AddObject(&m_ProgBar[0]);
AddObject(&m_ProgBar[1]);
AddObject(&m_PlayState);
return CLCDPage::Initialize();
}
示例10: AddObject
void InstanceScript::OnGameObjectCreate(GameObject* go)
{
AddObject(go, true);
AddDoor(go, true);
}
示例11: SetupBattleground
bool BattlegroundTP::SetupBattleground()
{
// flags X Y Z Orientation Rotation2 Rotation3
if (!AddObject(BG_TP_OBJECT_A_FLAG, BG_OBJECT_A_FLAG_TP_ENTRY, 2118.210f, 191.621f, 44.052f, 5.741259f, 0, 0, 0.9996573f, 0.02617699f, BG_TP_FLAG_RESPAWN_TIME/1000) // Cata
|| !AddObject(BG_TP_OBJECT_H_FLAG, BG_OBJECT_H_FLAG_TP_ENTRY, 1578.380f, 344.037f, 2.419f, 3.055978f, 0, 0, 0.008726535f, 0.9999619f, BG_TP_FLAG_RESPAWN_TIME/1000) // Cata
// buffs
|| !AddObject(BG_TP_OBJECT_SPEEDBUFF_1, BG_OBJECTID_SPEEDBUFF_ENTRY, 1545.402f, 304.028f, 0.5923f, -1.64061f, 0, 0, 0.7313537f, -0.6819983f, BUFF_RESPAWN_TIME) // Cata
|| !AddObject(BG_TP_OBJECT_SPEEDBUFF_2, BG_OBJECTID_SPEEDBUFF_ENTRY, 2171.279f, 222.334f, 43.8001f, 2.663309f, 0, 0, 0.7313537f, 0.6819984f, BUFF_RESPAWN_TIME) // Cata
|| !AddObject(BG_TP_OBJECT_REGENBUFF_1, BG_OBJECTID_REGENBUFF_ENTRY, 1753.957f, 242.092f, -14.1170f, 1.105848f, 0, 0, 0.1305263f, -0.9914448f, BUFF_RESPAWN_TIME) // Cata
|| !AddObject(BG_TP_OBJECT_REGENBUFF_2, BG_OBJECTID_REGENBUFF_ENTRY, 1952.121f, 383.857f, -10.2870f, 4.192612f, 0, 0, 0.333807f, -0.9426414f, BUFF_RESPAWN_TIME) // Cata
|| !AddObject(BG_TP_OBJECT_BERSERKBUFF_1, BG_OBJECTID_BERSERKERBUFF_ENTRY, 1934.369f, 226.064f, -17.0441f, 2.499154f, 0, 0, 0.5591929f, 0.8290376f, BUFF_RESPAWN_TIME) // Cata
|| !AddObject(BG_TP_OBJECT_BERSERKBUFF_2, BG_OBJECTID_BERSERKERBUFF_ENTRY, 1725.240f, 446.431f, -7.8327f, 5.709677f, 0, 0, 0.9396926f, -0.3420201f, BUFF_RESPAWN_TIME) // Cata
// alliance gates
|| !AddObject(BG_TP_OBJECT_DOOR_A_1, BG_OBJECT_DOOR_A_1_TP_ENTRY, 2115.399f, 150.175f, 43.526f, 2.62f, 0, 0, 0, 0, RESPAWN_IMMEDIATELY) // Cata
|| !AddObject(BG_TP_OBJECT_DOOR_A_2, BG_OBJECT_DOOR_A_2_TP_ENTRY, 2156.803f, 220.331f, 43.482f, 5.76f, 0, 0, 0, 0, RESPAWN_IMMEDIATELY) // Cata
|| !AddObject(BG_TP_OBJECT_DOOR_A_3, BG_OBJECT_DOOR_A_3_TP_ENTRY, 2126.760f, 224.051f, 43.647f, 2.63f, 0, 0, 0, 0, RESPAWN_IMMEDIATELY) // Cata
// horde gates
|| !AddObject(BG_TP_OBJECT_DOOR_H_1, BG_OBJECT_DOOR_H_1_TP_ENTRY, 1556.595f, 314.502f, 1.223f, 3.04f, 0, 0, 0, 0, RESPAWN_IMMEDIATELY)
|| !AddObject(BG_TP_OBJECT_DOOR_H_2, BG_OBJECT_DOOR_H_2_TP_ENTRY, 1587.415f, 319.935f, 1.522f, 6.20f, 0, 0, 0, 0, RESPAWN_IMMEDIATELY)
|| !AddObject(BG_TP_OBJECT_DOOR_H_3, BG_OBJECT_DOOR_H_3_TP_ENTRY, 1558.315f, 372.709f, 1.484f, 6.12f, 0, 0, 0, 0, RESPAWN_IMMEDIATELY)
)
{
sLog->outError(LOG_FILTER_SQL,"BatteGroundTP: Failed to spawn some object Battleground not created!");
return false;
}
WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(TP_GRAVEYARD_MIDDLE_ALLIANCE);
if (!sg || !AddSpiritGuide(TP_SPIRIT_ALLIANCE, sg->x, sg->y, sg->z, 3.641396f, ALLIANCE))
{
sLog->outError(LOG_FILTER_SQL,"BatteGroundTP: Failed to spawn Alliance spirit guide! Battleground not created!");
return false;
}
sg = sWorldSafeLocsStore.LookupEntry(TP_GRAVEYARD_START_ALLIANCE);
if (!sg || !AddSpiritGuide(TP_SPIRIT_ALLIANCE, sg->x, sg->y, sg->z, 3.641396f, ALLIANCE))
{
sLog->outError(LOG_FILTER_SQL,"BatteGroundTP: Failed to spawn Alliance start spirit guide! Battleground not created!");
return false;
}
sg = sWorldSafeLocsStore.LookupEntry(TP_GRAVEYARD_MIDDLE_HORDE);
if (!sg || !AddSpiritGuide(TP_SPIRIT_HORDE, sg->x, sg->y, sg->z, 3.641396f, HORDE))
{
sLog->outError(LOG_FILTER_SQL,"BatteGroundTP: Failed to spawn Horde spirit guide! Battleground not created!");
return false;
}
sg = sWorldSafeLocsStore.LookupEntry(TP_GRAVEYARD_START_HORDE);
if (!sg || !AddSpiritGuide(TP_SPIRIT_ALLIANCE, sg->x, sg->y, sg->z, 3.641396f, HORDE))
{
sLog->outError(LOG_FILTER_SQL,"BatteGroundTP: Failed to spawn Horde start spirit guide! Battleground not created!");
return false;
}
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BatteGroundTP: BG objects and spirit guides spawned");
return true;
}
示例12: DelCreature
void BattlegroundSA::CaptureGraveyard (BG_SA_Graveyards i, Player *Source)
{
if (GraveyardStatus[i] == Attackers)
return;
DelCreature(BG_SA_MAXNPC + i);
GraveyardStatus[i] = Source->GetTeamId();
WorldSafeLocsEntry const *sg = NULL;
sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], (GraveyardStatus[i] == TEAM_ALLIANCE ? ALLIANCE : HORDE));
uint32 npc = 0;
uint32 flag = 0;
switch (i)
{
case BG_SA_LEFT_CAPTURABLE_GY:
flag = BG_SA_LEFT_FLAG;
DelObject(flag);
AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0 : 1)), BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1], BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
npc = BG_SA_NPC_RIGSPARK;
AddCreature(BG_SA_NpcEntries[npc], npc, Attackers, BG_SA_NpcSpawnlocs[npc][0], BG_SA_NpcSpawnlocs[npc][1], BG_SA_NpcSpawnlocs[npc][2], BG_SA_NpcSpawnlocs[npc][3]);
UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0));
UpdateWorldState(BG_SA_LEFT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1));
if (Source->GetTeamId() == TEAM_ALLIANCE)
SendWarningToAll(LANG_BG_SA_A_GY_WEST);
else
SendWarningToAll(LANG_BG_SA_H_GY_WEST);
break;
case BG_SA_RIGHT_CAPTURABLE_GY:
flag = BG_SA_RIGHT_FLAG;
DelObject(flag);
AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0 : 1)), BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1], BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
npc = BG_SA_NPC_SPARKLIGHT;
AddCreature(BG_SA_NpcEntries[npc], npc, Attackers, BG_SA_NpcSpawnlocs[npc][0], BG_SA_NpcSpawnlocs[npc][1], BG_SA_NpcSpawnlocs[npc][2], BG_SA_NpcSpawnlocs[npc][3]);
UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0));
UpdateWorldState(BG_SA_RIGHT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1));
if (Source->GetTeamId() == TEAM_ALLIANCE)
SendWarningToAll(LANG_BG_SA_A_GY_EAST);
else
SendWarningToAll(LANG_BG_SA_H_GY_EAST);
break;
case BG_SA_CENTRAL_CAPTURABLE_GY:
flag = BG_SA_CENTRAL_FLAG;
DelObject(flag);
AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0 : 1)), BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1], BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0));
UpdateWorldState(BG_SA_CENTER_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1));
if (Source->GetTeamId() == TEAM_ALLIANCE)
SendWarningToAll(LANG_BG_SA_A_GY_SOUTH);
else
SendWarningToAll(LANG_BG_SA_H_GY_SOUTH);
break;
default:
ASSERT(0)
;
break;
};
}
示例13: TC_LOG_ERROR
bool BattlegroundIC::SetupBattleground()
{
for (uint8 i = 0; i < MAX_NORMAL_GAMEOBJECTS_SPAWNS; ++i)
{
if (!AddObject(BG_IC_ObjSpawnlocs[i].type, BG_IC_ObjSpawnlocs[i].entry, BG_IC_ObjSpawnlocs[i].x, BG_IC_ObjSpawnlocs[i].y, BG_IC_ObjSpawnlocs[i].z, BG_IC_ObjSpawnlocs[i].o, 0, 0, 0, 0, RESPAWN_ONE_DAY))
{
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning gameobject %u", BG_IC_ObjSpawnlocs[i].entry);
return false;
}
}
for (uint8 i = 0; i < MAX_FORTRESS_TELEPORTERS_SPAWNS; ++i)
{
if (!AddObject(BG_IC_Teleporters[i].type, BG_IC_Teleporters[i].entry, BG_IC_Teleporters[i].x, BG_IC_Teleporters[i].y, BG_IC_Teleporters[i].z, BG_IC_Teleporters[i].o, 0, 0, 0, 0, RESPAWN_ONE_DAY))
{
TC_LOG_ERROR("bg.battleground", "Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry);
return false;
}
}
for (uint8 i = 0; i < MAX_FORTRESS_TELEPORTER_EFFECTS_SPAWNS; ++i)
{
if (!AddObject(BG_IC_TeleporterEffects[i].type, BG_IC_TeleporterEffects[i].entry, BG_IC_TeleporterEffects[i].x, BG_IC_TeleporterEffects[i].y, BG_IC_TeleporterEffects[i].z, BG_IC_TeleporterEffects[i].o, 0, 0, 0, 0, RESPAWN_ONE_DAY))
{
TC_LOG_ERROR("bg.battleground", "Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry);
return false;
}
}
for (uint8 i = 2; i < MAX_NORMAL_NPCS_SPAWNS; ++i)
{
if (!AddCreature(BG_IC_NpcSpawnlocs[i].entry, BG_IC_NpcSpawnlocs[i].type, BG_IC_NpcSpawnlocs[i].x, BG_IC_NpcSpawnlocs[i].y, BG_IC_NpcSpawnlocs[i].z, BG_IC_NpcSpawnlocs[i].o, BG_IC_NpcSpawnlocs[i].team, RESPAWN_ONE_DAY))
{
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[i].entry);
return false;
}
}
if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+3, BG_IC_SpiritGuidePos[5], TEAM_ALLIANCE)
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+4, BG_IC_SpiritGuidePos[6], TEAM_HORDE)
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+5, BG_IC_SpiritGuidePos[7], TEAM_ALLIANCE)
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+6, BG_IC_SpiritGuidePos[8], TEAM_HORDE))
{
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: Failed to spawn initial spirit guide!");
return false;
}
gunshipHorde = sTransportMgr->CreateTransport(GO_HORDE_GUNSHIP, 0, GetBgMap());
gunshipAlliance = sTransportMgr->CreateTransport(GO_ALLIANCE_GUNSHIP, 0, GetBgMap());
if (!gunshipAlliance || !gunshipHorde)
{
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error creating gunships!");
return false;
}
gunshipHorde->EnableMovement(false);
gunshipAlliance->EnableMovement(false);
// setting correct factions for Keep Cannons
for (uint8 i = BG_IC_NPC_KEEP_CANNON_1; i <= BG_IC_NPC_KEEP_CANNON_12; ++i)
GetBGCreature(i)->setFaction(BG_IC_Factions[0]);
for (uint8 i = BG_IC_NPC_KEEP_CANNON_13; i <= BG_IC_NPC_KEEP_CANNON_25; ++i)
GetBGCreature(i)->setFaction(BG_IC_Factions[1]);
// correcting spawn time for keeps bombs
for (uint8 i = BG_IC_GO_HUGE_SEAFORIUM_BOMBS_A_1; i < BG_IC_GO_HUGE_SEAFORIUM_BOMBS_H_4; ++i)
GetBGObject(i)->SetRespawnTime(10);
return true;
}
示例14: SendTransportsRemove
bool BattlegroundSA::ResetObjs ()
{
for (int i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++)
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if (Player * plr = sObjectMgr->GetPlayer(itr->first))
SendTransportsRemove (plr);
uint32 atF = BG_SA_Factions[Attackers];
uint32 defF = BG_SA_Factions[Attackers ? TEAM_ALLIANCE : TEAM_HORDE];
for (uint8 i = 0; i < BG_SA_MAXOBJ; i++)
DelObject(i);
for (uint8 i = 0; i < BG_SA_MAXNPC; i++)
DelCreature(i);
for (uint8 i = BG_SA_MAXNPC; i < BG_SA_MAXNPC + BG_SA_MAX_GY; i++)
DelCreature(i);
for (uint8 i = 0; i < 6; i++)
GateStatus[i] = BG_SA_GATE_OK;
for (uint8 i = 0; i < BG_SA_BOAT_ONE; i++)
{
if (!AddObject(i, BG_SA_ObjEntries[i], BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1], BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3], 0, 0, 0, 0, RESPAWN_ONE_DAY))
return false;
}
for (uint8 i = BG_SA_BOAT_ONE; i < BG_SA_SIGIL_1; i++)
{
uint32 boatid = 0;
switch (i)
{
case BG_SA_BOAT_ONE:
boatid = Attackers ? BG_SA_BOAT_ONE_H : BG_SA_BOAT_ONE_A;
break;
case BG_SA_BOAT_TWO:
boatid = Attackers ? BG_SA_BOAT_TWO_H : BG_SA_BOAT_TWO_A;
break;
}
if (!AddObject(i, boatid, BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1], BG_SA_ObjSpawnlocs[i][2] + (Attackers ? -3.750f : 0), BG_SA_ObjSpawnlocs[i][3], 0, 0, 0, 0, RESPAWN_ONE_DAY))
return false;
}
for (uint8 i = BG_SA_SIGIL_1; i < BG_SA_CENTRAL_FLAG; i++)
{
if (!AddObject(i, BG_SA_ObjEntries[i], BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1], BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3], 0, 0, 0, 0, RESPAWN_ONE_DAY))
return false;
}
// MAD props for Kiper for discovering those values - 4 hours of his work.
GetBGObject(BG_SA_BOAT_ONE)->UpdateRotationFields(1.0f, 0.0002f);
GetBGObject(BG_SA_BOAT_TWO)->UpdateRotationFields(1.0f, 0.00001f);
SpawnBGObject(BG_SA_BOAT_ONE, RESPAWN_IMMEDIATELY);
SpawnBGObject(BG_SA_BOAT_TWO, RESPAWN_IMMEDIATELY);
//Cannons and demolishers - NPCs are spawned
//By capturing GYs.
for (uint8 i = 0; i < BG_SA_NPC_SPARKLIGHT; i++)
{
if (!AddCreature(BG_SA_NpcEntries[i], i, (Attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE), BG_SA_NpcSpawnlocs[i][0], BG_SA_NpcSpawnlocs[i][1], BG_SA_NpcSpawnlocs[i][2], BG_SA_NpcSpawnlocs[i][3], 600))
return false;
}
OverrideGunFaction();
DemolisherStartState(true);
for (uint8 i = 0; i <= BG_SA_TITAN_RELIC; i++)
{
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FACTION, defF);
}
GetBGObject(BG_SA_TITAN_RELIC)->SetUInt32Value(GAMEOBJECT_FACTION, atF);
GetBGObject(BG_SA_TITAN_RELIC)->Refresh();
for (uint8 i = 0; i <= 5; i++)
GateStatus[i] = BG_SA_GATE_OK;
TotalTime = 0;
ShipsStarted = false;
//Graveyards!
for (uint8 i = 0; i < BG_SA_MAX_GY; i++)
{
WorldSafeLocsEntry const *sg = NULL;
sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
if (!sg)
{
sLog->outError("SOTA: Can't find GY entry %u", BG_SA_GYEntries[i]);
return false;
}
if (i == BG_SA_BEACH_GY)
{
GraveyardStatus[i] = Attackers;
AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((Attackers == TEAM_HORDE) ? HORDE : ALLIANCE));
}
else
{
//.........这里部分代码省略.........
示例15: if
//.........这里部分代码省略.........
del = NA_DESTROYED_ROOST_S;
add = NA_ROOST_S;
add2 = NA_BOMB_WAGON_S;
if (m_ControllingFaction == HORDE)
m_WyvernStateSouth = WYVERN_ALLIANCE;
else
m_WyvernStateSouth = WYVERN_HORDE;
UpdateWyvernRoostWorldState(NA_ROOST_S);
break;
case NA_DESTROYED_ROOST_N:
del = NA_DESTROYED_ROOST_N;
add = NA_ROOST_N;
add2 = NA_BOMB_WAGON_N;
if (m_ControllingFaction == HORDE)
m_WyvernStateNorth = WYVERN_ALLIANCE;
else
m_WyvernStateNorth = WYVERN_HORDE;
UpdateWyvernRoostWorldState(NA_ROOST_N);
break;
case NA_DESTROYED_ROOST_W:
del = NA_DESTROYED_ROOST_W;
add = NA_ROOST_W;
add2 = NA_BOMB_WAGON_W;
if (m_ControllingFaction == HORDE)
m_WyvernStateWest = WYVERN_ALLIANCE;
else
m_WyvernStateWest = WYVERN_HORDE;
UpdateWyvernRoostWorldState(NA_ROOST_W);
break;
case NA_DESTROYED_ROOST_E:
del = NA_DESTROYED_ROOST_E;
add = NA_ROOST_E;
add2 = NA_BOMB_WAGON_E;
if (m_ControllingFaction == HORDE)
m_WyvernStateEast = WYVERN_ALLIANCE;
else
m_WyvernStateEast = WYVERN_HORDE;
UpdateWyvernRoostWorldState(NA_ROOST_E);
break;
case NA_BOMB_WAGON_S:
del = NA_BOMB_WAGON_S;
del2 = NA_ROOST_S;
add = NA_DESTROYED_ROOST_S;
if (m_ControllingFaction == HORDE)
m_WyvernStateSouth = WYVERN_NEU_ALLIANCE;
else
m_WyvernStateSouth = WYVERN_NEU_HORDE;
UpdateWyvernRoostWorldState(NA_ROOST_S);
break;
case NA_BOMB_WAGON_N:
del = NA_BOMB_WAGON_N;
del2 = NA_ROOST_N;
add = NA_DESTROYED_ROOST_N;
if (m_ControllingFaction == HORDE)
m_WyvernStateNorth = WYVERN_NEU_ALLIANCE;
else
m_WyvernStateNorth = WYVERN_NEU_HORDE;
UpdateWyvernRoostWorldState(NA_ROOST_N);
break;
case NA_BOMB_WAGON_W:
del = NA_BOMB_WAGON_W;
del2 = NA_ROOST_W;
add = NA_DESTROYED_ROOST_W;
if (m_ControllingFaction == HORDE)
m_WyvernStateWest = WYVERN_NEU_ALLIANCE;
else
m_WyvernStateWest = WYVERN_NEU_HORDE;
UpdateWyvernRoostWorldState(NA_ROOST_W);
break;
case NA_BOMB_WAGON_E:
del = NA_BOMB_WAGON_E;
del2 = NA_ROOST_E;
add = NA_DESTROYED_ROOST_E;
if (m_ControllingFaction == HORDE)
m_WyvernStateEast = WYVERN_NEU_ALLIANCE;
else
m_WyvernStateEast = WYVERN_NEU_HORDE;
UpdateWyvernRoostWorldState(NA_ROOST_E);
break;
default:
return -1;
break;
}
if (del>-1)
DelObject(del);
if (del2>-1)
DelObject(del2);
if (add>-1)
AddObject(add, gos[add].entry, gos[add].map, gos[add].x, gos[add].y, gos[add].z, gos[add].o, gos[add].rot0, gos[add].rot1, gos[add].rot2, gos[add].rot3);
if (add2>-1)
AddObject(add2, gos[add2].entry, gos[add2].map, gos[add2].x, gos[add2].y, gos[add2].z, gos[add2].o, gos[add2].rot0, gos[add2].rot1, gos[add2].rot2, gos[add2].rot3);
return retval;
}
return -1;
}