本文整理汇总了C++中PlayerObject::getFirstName方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject::getFirstName方法的具体用法?C++ PlayerObject::getFirstName怎么用?C++ PlayerObject::getFirstName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject::getFirstName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _handleFindFriendDBReply
void ObjectController::_handleFindFriendDBReply(uint64 retCode,string friendName)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
friendName.convert(BSTRType_Unicode16);
if(retCode == 0)
{
gMessageLib->sendSystemMessage(player,L"","cmnty","friend_location_failed_noname","","",L"",0,"","",friendName.getUnicode16());
return;
}
PlayerObject* searchObject = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(retCode));
if(!searchObject)
{
gMessageLib->sendSystemMessage(player,L"","cmnty","friend_location_failed","","",L"",0,"","",friendName.getUnicode16());
return;
}
//are we on our targets friendlist???
if(!searchObject->checkFriendList(player->getFirstName().getCrc()))
{
gMessageLib->sendSystemMessage(player,L"","cmnty","friend_location_failed","","",L"",0,"","",friendName.getUnicode16());
return;
}
Datapad* thePad = dynamic_cast<Datapad*>(searchObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));
if(thePad && thePad->getCapacity())
{
//the datapad automatically checks for waypoint caspacity and gives the relevant error messages
thePad->requestNewWaypoint(searchObject->getFirstName().getAnsi(),searchObject->mPosition,static_cast<uint16>(gWorldManager->getZoneId()),Waypoint_blue);
}
}
示例2:
//======================================================================================================================
//
// Modifies the Admin List
//
void ObjectController::_handleTransferStructure(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
// requirement we have the structure targeted AND give the name of the recipient on the commandline
// OR we have the recipient targeted and stand NEXT to the structure were about to transfer
//do we have a valid donor ?
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
if(!player)
{
return;
}
// is the player online and near 30m ?
// we get the players id as targetid if yes, otherwise we get the name as string
// however, we do not want players that are not online
//now get the target player
PlayerObject* recipient = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(targetId));
if(!recipient)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "no_transfer_target"), player);
return;
}
//do we have a valid structure ??? check our target first
uint64 id = player->getTargetId();
Object* object = gWorldManager->getObjectById(id);
PlayerStructure* structure = dynamic_cast<PlayerStructure*>(object);
if(!structure)
{
// we need to get the nearest structure that we own
// for now dustoff
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "command_no_building"), player);
return;
}
//is the structure in Range???
float fTransferDistance = gWorldConfig->getConfiguration<float>("Player_Transfer_Structure_Distance",(float)8.0);
if(glm::distance(player->mPosition, structure->mPosition) > fTransferDistance)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "command_no_building"), player);
return;
}
StructureAsyncCommand command;
command.PlayerId = player->getId();
command.StructureId = structure->getId();
command.RecipientId = recipient->getId();
command.PlayerStr = recipient->getFirstName().getAnsi();
command.Command = Structure_Command_TransferStructure;
gStructureManager->checkNameOnPermissionList(structure->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
示例3: sendAdminFeedback
void ObjectController::sendAdminFeedback(BString reply) const
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
if ((player) && (player->isConnected()))
{
if (reply.getLength())
{
reply.convert(BSTRType_Unicode16);
gMessageLib->SendSystemMessage(reply.getUnicode16(), player, true);
}
else
{
DLOG(info) << "Admin :" << player->getFirstName().getAnsi();
}
}
else
{
if (reply.getDataLength())
{
DLOG(info) << "Admin (anon): " << reply.getAnsi();
}
else
{
}
}
}
示例4: DLOG
//======================================================================================================================
//
// provides the harvester with the current resources
//
void ObjectController::_handleHarvesterGetResourceData(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
if(!player)
{
return;
}
//do we have a valid structure ???
uint64 id = targetId;
Object* object = gWorldManager->getObjectById(id);
PlayerStructure* structure = dynamic_cast<PlayerStructure*>(object);
if(!structure)
{
//gMessageLib->sendSystemMessage(player,L"","player_structure","command_no_building");
return;
}
//is the structure in Range???
float fTransferDistance = gWorldConfig->getConfiguration<float>("Player_Structure_Operate_Distance",(float)10.0);
if(glm::distance(player->mPosition, structure->mPosition) > fTransferDistance)
{
DLOG(INFO) << " ObjectController::_handleHarvesterGetResourceData Structure not in Range";
return;
}
HarvesterObject* harvester = dynamic_cast<HarvesterObject*>(structure);
StructureAsyncCommand command;
command.Command = Structure_Command_GetResourceData;
command.PlayerId = player->getId();
command.StructureId = structure->getId();
gStructureManager->checkNameOnPermissionList(structure->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
return;
gMessageLib->sendHarvesterResourceData(structure,player);
DLOG(INFO) << " ObjectController::_handleHarvesterGetResourceData :: hino 7 baseline";
gMessageLib->sendBaselinesHINO_7(harvester,player);
//add the structure to the timer so the resource amounts are updated while we look at the hopper
//harvester->getTTS()->todo = ttE_UpdateHopper;
//harvester->getTTS()->playerId = player->getId();
//structure->getTTS()->projectedTime = 5000 + Anh_Utils::Clock::getSingleton()->getLocalTime();
//gStructureManager->addStructureforHopperUpdate(harvester->getId());
// this needs to be handled zoneserverside - otherwise the addition of a res will trigger a racecondition
// between the sql write query and the sql read please note that the harvesting itself happens through stored procedures
// and we cant keep the updatecounters synchronized
}
示例5: sscanf
//======================================================================================================================
//
// Modifies the Admin List
//
void ObjectController::_handleNameStructure(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
// requirement we have the structure targeted AND give the name of the recipient on the commandline
// OR we have the recipient targeted and stand NEXT to the structure were about to transfer
//do we have a valid donor ?
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
if(!player)
{
return;
}
//do we have a valid structure ??? check our target first
uint64 id = player->getTargetId();
Object* object = gWorldManager->getObjectById(id);
PlayerStructure* structure = dynamic_cast<PlayerStructure*>(object);
if(!structure)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "command_no_building"), player);
return;
}
//is the structure in Range???
float fTransferDistance = gWorldConfig->getConfiguration<float>("Player_Structure_Operate_Distance",(float)10.0);
if(glm::distance(player->mPosition, structure->mPosition) > fTransferDistance)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "command_no_building"), player);
return;
}
//find out where our structure is
BString dataStr;
message->getStringUnicode16(dataStr);
BString nameStr;
dataStr.convert(BSTRType_ANSI);
sscanf(dataStr.getAnsi(),"%s",nameStr.getAnsi());
if(nameStr.getLength() > 68)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "not_valid_name"), player);
return;
}
StructureAsyncCommand command;
command.Command = Structure_Command_RenameStructure;
command.PlayerId = player->getId();
command.StructureId = structure->getId();
gStructureManager->checkNameOnPermissionList(structure->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
示例6: onObjectEnter
void City::onObjectEnter(Object* object)
{
PlayerObject* player = (PlayerObject*)object;
//player->setCityRegionId(this->getId());
addKnownObjectSafe(object);
gLogger->log(LogManager::INFORMATION,"%s entered %s (%u players in city)",player->getFirstName().getAnsi(),mCityName.getAnsi(),mKnownPlayers.size());
}
示例7: onObjectEnter
void City::onObjectEnter(Object* object)
{
PlayerObject* player = (PlayerObject*)object;
//player->setCityRegionId(this->getId());
addVisitor(object);
DLOG(INFO) << player->getFirstName().getAnsi() << " entered "
<< mCityName << " (" << mVisitingPlayers.size() << " players in city)";
}
示例8: onObjectLeave
void City::onObjectLeave(Object* object)
{
PlayerObject* player = (PlayerObject*)object;
//if(player->getCityRegionId() == this->getId())
//player->setCityRegionId(0);
removeVisitor(object);
DLOG(INFO) << player->getFirstName().getAnsi() << " left "
<< mCityName << " (" << mVisitingPlayers.size() << " players in city)";
}
示例9: onObjectLeave
void City::onObjectLeave(Object* object)
{
PlayerObject* player = (PlayerObject*)object;
//if(player->getCityRegionId() == this->getId())
//player->setCityRegionId(0);
removeKnownObject(object);
gLogger->log(LogManager::DEBUG,"%s left %s (%u players in city)",player->getFirstName().getAnsi(),mCityName.getAnsi(),mKnownPlayers.size());
}
示例10: addObject
bool WorldManager::addObject(Object* object,bool manual)
{
uint64 key = object->getId();
//make sure objects arnt added several times!!!!
if(getObjectById(key))
{
gLogger->logMsgF("WorldManager::addObject Object already existant added several times or ID messup ???",MSG_HIGH);
return false;
}
mObjectMap.insert(key,object);
// if we want to set the parent manually or the object is from the snapshots and not a building, return
if(manual)
{
return true;
}
#if defined(_MSC_VER)
if(object->getId() < 0x0000000100000000 && object->getType() != ObjType_Building)
#else
if(object->getId() < 0x0000000100000000LLU && object->getType() != ObjType_Building)
#endif
{
// check if a crafting station - in that case add
Item* item = dynamic_cast<Item*> (object);
if(item)
{
if(!(item->getItemFamily() == ItemFamily_CraftingStations))
return true;
}
else
{
return true;
}
}
switch(object->getType())
{
// player, when a player enters a planet
case ObjType_Player:
{
PlayerObject* player = dynamic_cast<PlayerObject*>(object);
gLogger->logMsgF("New Player: %"PRIu64", Total Players on zone : %i",MSG_NORMAL,player->getId(),(getPlayerAccMap())->size() + 1);
// insert into the player map
mPlayerAccMap.insert(std::make_pair(player->getAccountId(),player));
// insert into cell
if(player->getParentId())
{
player->setSubZoneId(0);
if(CellObject* cell = dynamic_cast<CellObject*>(getObjectById(player->getParentId())))
{
cell->addObjectSecure(player);
}
else
{
gLogger->logMsgF("WorldManager::addObject: couldn't find cell %"PRIu64"",MSG_HIGH,player->getParentId());
}
}
// query the rtree for the qt region we are in
else
{
if(QTRegion* region = mSpatialIndex->getQTRegion(player->mPosition.x,player->mPosition.z))
{
player->setSubZoneId((uint32)region->getId());
region->mTree->addObject(player);
}
else
{
// we should never get here !
gLogger->logMsg("WorldManager::addObject: could not find zone region in map");
return false;
}
}
// initialize
initObjectsInRange(player);
gMessageLib->sendCreatePlayer(player,player);
// add ham to regeneration scheduler
player->getHam()->updateRegenRates(); // ERU: Note sure if this is needed here.
player->getHam()->checkForRegen();
// onPlayerEntered event, notify scripts
string params;
params.setLength(sprintf(params.getAnsi(),"%s %s %u",getPlanetNameThis(),player->getFirstName().getAnsi(),static_cast<uint32>(mPlayerAccMap.size())));
mWorldScriptsListener.handleScriptEvent("onPlayerEntered",params);
// Start player world position update. Used when player don't get any events from client (player not moving).
// addPlayerMovementUpdateTime(player, 1000);
}
break;
case ObjType_Structure:
//.........这里部分代码省略.........
示例11: handleObjectMenuSelect
void PlayerStructureTerminal::handleObjectMenuSelect(uint8 messageType,Object* srcObject)
{
PlayerObject* player = (PlayerObject*)srcObject;
if ((!player) ||(!player->isConnected()))
{
gLogger->logMsgF("HarvesterObject::handleObjectMenuSelect::could not find player",MSG_HIGH);
return;
}
switch(messageType)
{
case radId_serverTerminalPermissionsBanned:
{
StructureAsyncCommand command;
command.Command = Structure_Command_PermissionBan;
command.PlayerId = player->getId();
command.StructureId = this->getStructure();
gStructureManager->checkNameOnPermissionList(this->getStructure(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_serverTerminalPermissionsEnter:
{
StructureAsyncCommand command;
command.Command = Structure_Command_PermissionEntry;
command.PlayerId = player->getId();
command.StructureId = this->getStructure();
gStructureManager->checkNameOnPermissionList(this->getStructure(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_serverTerminalPermissionsAdmin:
{
StructureAsyncCommand command;
command.Command = Structure_Command_PermissionAdmin;
command.PlayerId = player->getId();
command.StructureId = this->getStructure();
gStructureManager->checkNameOnPermissionList(this->getStructure(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_serverTerminalManagementPrivacy:
{
StructureAsyncCommand command;
command.Command = Structure_Command_Privacy;
command.PlayerId = player->getId();
command.StructureId = this->getStructure();
gStructureManager->checkNameOnPermissionList(this->getStructure(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_serverTerminalManagementDestroy:
{
StructureAsyncCommand command;
command.Command = Structure_Command_Destroy;
command.PlayerId = player->getId();
command.StructureId = this->getStructure();
gStructureManager->checkNameOnPermissionList(this->getStructure(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_serverTerminalManagementStatus:
{
StructureAsyncCommand command;
command.Command = Structure_Command_ViewStatus;
command.PlayerId = player->getId();
command.StructureId = this->getStructure();
gStructureManager->checkNameOnPermissionList(this->getStructure(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_serverTerminalManagementPay:
{
StructureAsyncCommand command;
command.Command = Structure_Command_PayMaintenance;
command.PlayerId = player->getId();
command.StructureId = this->getStructure();
gStructureManager->checkNameOnPermissionList(this->getStructure(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
default:
break;
}
}
示例12: handleObjectMenuSelect
void FactoryObject::handleObjectMenuSelect(uint8 messageType,Object* srcObject)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(srcObject);
if(!player)
{
gLogger->logMsgF("FactoryObject::handleObjectMenuSelect::could not find player",MSG_HIGH);
return;
}
switch(messageType)
{
case radId_StopManufacture:
{
StructureAsyncCommand command;
command.Command = Structure_Command_StopFactory;
command.PlayerId = player->getId();
command.StructureId = this->getId();
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_StartManufacture:
{
StructureAsyncCommand command;
command.Command = Structure_Command_StartFactory;
command.PlayerId = player->getId();
command.StructureId = this->getId();
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_serverManfHopperInput:
{
StructureAsyncCommand command;
command.Command = Structure_Command_AccessInHopper;
command.PlayerId = player->getId();
command.StructureId = this->getId();
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"HOPPER",command);
}
break;
case radId_serverManfHopperOutput:
{
StructureAsyncCommand command;
command.Command = Structure_Command_AccessOutHopper;
command.PlayerId = player->getId();
command.StructureId = this->getId();
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"HOPPER",command);
}
break;
case radId_serverManfStationSchematic:
{
StructureAsyncCommand command;
command.Command = Structure_Command_AccessSchem;
command.PlayerId = player->getId();
command.StructureId = this->getId();
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_StructureStatus:
{
StructureAsyncCommand command;
command.Command = Structure_Command_ViewStatus;
command.PlayerId = player->getId();
command.StructureId = this->getId();
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_depositPower:
{
StructureAsyncCommand command;
command.Command = Structure_Command_DepositPower;
command.PlayerId = player->getId();
command.StructureId = this->getId();
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_payMaintenance:
{
StructureAsyncCommand command;
command.Command = Structure_Command_PayMaintenance;
command.PlayerId = player->getId();
command.StructureId = this->getId();
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
//.........这里部分代码省略.........
示例13: handleObjectMenuSelect
void HarvesterObject::handleObjectMenuSelect(uint8 messageType,Object* srcObject)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(srcObject);
if(!player)
{
gLogger->log(LogManager::DEBUG,"HarvesterObject::handleObjectMenuSelect::could not find player");
return;
}
switch(messageType)
{
case radId_StructureStatus:
{
StructureAsyncCommand command;
command.Command = Structure_Command_ViewStatus;
command.PlayerId = player->getId();
command.StructureId = this->getId();
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_depositPower:
{
StructureAsyncCommand command;
command.Command = Structure_Command_DepositPower;
command.PlayerId = player->getId();
command.StructureId = this->getId();
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_payMaintenance:
{
StructureAsyncCommand command;
command.Command = Structure_Command_PayMaintenance;
command.PlayerId = player->getId();
command.StructureId = this->getId();
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_serverTerminalManagementDestroy:
{
StructureAsyncCommand command;
command.Command = Structure_Command_Destroy;
command.PlayerId = player->getId();
command.StructureId = this->getId();
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_serverTerminalPermissionsAdmin:
{
StructureAsyncCommand command;
command.Command = Structure_Command_PermissionAdmin;
command.PlayerId = player->getId();
command.StructureId = this->getId();
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_serverTerminalPermissionsHopper:
{
StructureAsyncCommand command;
command.Command = Structure_Command_PermissionHopper;
command.PlayerId = player->getId();
command.StructureId = this->getId();
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_setName:
{
StructureAsyncCommand command;
command.Command = Structure_Command_RenameStructure;
command.PlayerId = player->getId();
command.StructureId = this->getId();
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case radId_operateHarvester:
{
StructureAsyncCommand command;
command.Command = Structure_Command_OperateHarvester;
//.........这里部分代码省略.........
示例14: _handleAddFriend
void ObjectController::_handleAddFriend(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
if(player->getContactListUpdatePending())
return;
else
player->setContactListUpdatePending(true);
string friendName;
int8 sql[1024],end[16],*sqlPointer;
message->getStringUnicode16(friendName);
friendName.convert(BSTRType_ANSI);
if(!friendName.getLength())
{
player->setContactListUpdatePending(false);
return;
}
if(player->isConnected())
gMessageLib->sendHeartBeat(player->getClient());
friendName.toLower();
// check if he's already our friend
if(player->checkFriendList(friendName.getCrc()))
{
friendName.convert(BSTRType_Unicode16);
gMessageLib->sendSystemMessage(player,L"","cmnty","friend_duplicate","","",L"",0,"","",friendName.getUnicode16());
player->setContactListUpdatePending(false);
return;
}
// or ignored
if(player->checkIgnoreList(friendName.getCrc()))
{
friendName.convert(BSTRType_Unicode16);
gMessageLib->sendSystemMessage(player,L"","cmnty","friend_fail_is_ignored","","",L"",0,"","",friendName.getUnicode16());
player->setContactListUpdatePending(false);
return;
}
// check our own name
string firstName = player->getFirstName().getAnsi();
firstName.toLower();
if(strcmp(firstName.getAnsi(),friendName.getAnsi()) == 0)
{
player->setContactListUpdatePending(false);
return;
}
// pull the db query
ObjControllerAsyncContainer* asyncContainer = new(mDBAsyncContainerPool.malloc()) ObjControllerAsyncContainer(OCQuery_AddFriend);
asyncContainer->mString = friendName.getAnsi();
sprintf(sql,"SELECT sf_addFriend(%"PRIu64",'",player->getId());
sprintf(end,"')");
sqlPointer = sql + strlen(sql);
sqlPointer += mDatabase->Escape_String(sqlPointer,friendName.getAnsi(),friendName.getLength());
strcat(sql,end);
mDatabase->ExecuteSqlAsync(this,asyncContainer,sql);
}
示例15: if
//======================================================================================================================
//
// Modifies the Admin List
//
void ObjectController::_handleModifyPermissionList(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
if(!player)
{
DLOG(INFO) << " ObjectController::_handleModifyPermissionList Player not found";
return;
}
//find out where our structure is
BString dataStr;
message->getStringUnicode16(dataStr);
BString playerStr,list,action;
dataStr.convert(BSTRType_ANSI);
int8 s1[64],s2[32],s3[32];
sscanf(dataStr.getAnsi(),"%32s %16s %16s",s1, s2, s3);
playerStr = s1;
list = s2;
action = s3;
if(playerStr.getLength() > 40)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "permission_40_char"), player);
return;
}
//TODO is target a structure?? used when using the commandline option
uint64 id = player->getTargetId();
Object* object = gWorldManager->getObjectById(id);
PlayerStructure* structure = dynamic_cast<PlayerStructure*>(object);
//if we have no structure that way, see whether we have a structure were we just used the adminlist
if(!structure)
{
id = player->getStructurePermissionId();
Object* object = gWorldManager->getObjectById(id);
structure = dynamic_cast<PlayerStructure*>(object);
}
if(!structure)
{
return;
}
//is the structure in Range???
float fAdminListDistance = gWorldConfig->getConfiguration<float>("Player_Admin_List_Distance",(float)32.0);
if(player->getParentId())
{
if(CellObject* cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(player->getParentId())))
{
if(HouseObject* house = dynamic_cast<HouseObject*>(gWorldManager->getObjectById(cell->getParentId())))
{
if(house->getId() != structure->getId())
{
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "command_no_building"), player);
return;
}
}
}
}
else if(glm::distance(player->mPosition, structure->mPosition) > fAdminListDistance)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "command_no_building"), player);
return;
}
player->setStructurePermissionId(0);
StructureAsyncCommand command;
command.PlayerId = player->getId();
command.StructureId = structure->getId();
command.List = list;
command.PlayerStr = playerStr;
if(action == "add")
{
command.Command = Structure_Command_AddPermission;
gStructureManager->checkNameOnPermissionList(structure->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
if(action == "remove")
{
command.Command = Structure_Command_RemovePermission;
gStructureManager->checkNameOnPermissionList(structure->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
}