CGUID Script::GetNormalDupRgnID(long regionId) { CServerRegion* region = GameManager::GetInstance()->GetRgnManager()->FindRgnByTemplateID(RGN_NORMAL, regionId); if(region==NULL) return NULL_GUID; else return region->GetExID(); }
bool Script::ChangeRgn(long regionId, long x, long y, long dir, long range, long carriageDistance) { CPlayer* player = dynamic_cast<CPlayer*>(m_RunEnv.srcShape); if(player==NULL) return false; CServerRegion *region = GameManager::GetInstance()->GetRgnManager()-> FindRgnByTemplateID(RGN_NORMAL, regionId); if(region) return player->ChangeRegion(RGN_NORMAL, region->GetExID(), x, y, dir, regionId, 0, range, carriageDistance); return player->ChangeRegion(RGN_NORMAL, NULL_GUID, x, y, dir, regionId, 0, range, carriageDistance); }
void Script::SetRgnStrongPointState(const char* footholdName, int footholdState) { if(footholdName==NULL) return; CServerRegion* region = dynamic_cast<CServerRegion*>(m_RunEnv.region); if(region==NULL) return; region->SetStrongPointState(footholdName, footholdState); // 发送消息通知该场景所有玩家 CMessage msg(MSG_S2C_RGN_STRONGPOINT_STATE_CHANGE); msg.Add((long)region->GetID()); // region id msg.Add(region->GetExID()); // region guid msg.Add(footholdName); // strongpoint name msg.Add((long)footholdState); msg.SendToRegion(region); }
void Script::EditDupRgnName(const CGUID& regionGuid, const char* regionName) { if(regionName==NULL) return; CServerRegion* region = GameManager::GetInstance()->GetRgnManager()->FindRgnByRgnGUID(regionGuid); if(region==NULL) return; region->SetName(regionName); if(m_RunEnv.srcShape==NULL) return; // 发送消息给客户端 CMessage msg(MSG_S2C_RGN_CHANGENAME); msg.Add((long)region->GetRgnType()); msg.Add(region->GetExID()); msg.Add(region->GetID()); msg.Add(region->GetResourceID()); msg.Add((char*)region->GetName()); msg.SendToPlayer(m_RunEnv.srcShape->GetExID()); }
void Script::ClearCurGSDupRgn(int regionType) { CRgnManager* rgnManager = GameManager::GetInstance()->GetRgnManager(); if(rgnManager==NULL) return; CServerRegion* region = NULL; switch(regionType) { case RGN_PERSONAL: for(CRgnManager::RgnByIDMap::iterator it = rgnManager->GetPersonalDupRgnMap().begin(); it != rgnManager->GetPersonalDupRgnMap().end(); ++it) { region = it->second; // 如果该副本中有玩家则返回 if(region && (region->GetPlayerAmout() != 0)) continue; CMessage msg(MSG_S2W_RGN_DELETE); msg.Add(region->GetOwnerGUID()); // owner id msg.Add(region->GetExID()); // Region的GUID msg.Add((long)regionType); // 模板Rgn的Type msg.Add((long)-1);/*挂起的脚本ID*/ // 异步操作返回值变量名 msg.Add((char*)""); // 异步操作返回值变量名 msg.Add((char*)""); msg.Send(); } break; case RGN_PERSONAL_HOUSE: for(CRgnManager::RgnByIDMap::iterator it = rgnManager->GetPersonalHouseDupRgnMap().begin(); it != rgnManager->GetPersonalHouseDupRgnMap().end(); ++it) { region = it->second; // 如果该副本中有玩家则返回 if(region && (region->GetPlayerAmout() != 0)) continue; CMessage msg(MSG_S2W_RGN_DELETE); msg.Add(region->GetOwnerGUID()); // owner id msg.Add(region->GetExID()); // Region的GUID msg.Add((long)regionType); // 模板Rgn的Type msg.Add((long)-1);/*挂起的脚本ID*/ // 异步操作返回值变量名 msg.Add((char*)""); // 异步操作返回值变量名 msg.Add((char*)""); msg.Send(); } break; case RGN_TEAM: for(CRgnManager::RgnByIDMap::iterator it = rgnManager->GetTeamDupRgnMap().begin(); it != rgnManager->GetTeamDupRgnMap().end(); ++it) { region = it->second; // 如果该副本中有玩家则返回 if(region && (region->GetPlayerAmout() != 0)) continue; CMessage msg(MSG_S2W_RGN_DELETE); msg.Add(region->GetOwnerGUID()); // owner id msg.Add(region->GetExID()); // Region的GUID msg.Add((long)regionType); // 模板Rgn的Type msg.Add((long)-1);/*挂起的脚本ID*/ // 异步操作返回值变量名 msg.Add((char*)""); // 异步操作返回值变量名 msg.Add((char*)""); msg.Send(); } break; default: break; } }