本文整理汇总了C++中PlayerObject::getJediState方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject::getJediState方法的具体用法?C++ PlayerObject::getJediState怎么用?C++ PlayerObject::getJediState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject::getJediState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: savePlayer
void WorldManager::savePlayer(uint32 accId,bool remove, WMLogOut mLogout, CharacterLoadingContainer* clContainer)
{
PlayerObject* playerObject = getPlayerByAccId(accId);
if(!playerObject) {
DLOG(INFO) << "WorldManager::savePlayer could not find player with AccId:" <<accId<<", save aborted.";
return;
}
// WMQuery_SavePlayer_Position is the query handler called by the buffmanager when all the buffcallbacks are finished
// we prepare the asynccontainer here already
WMAsyncContainer* asyncContainer = new(mWM_DB_AsyncPool.ordered_malloc()) WMAsyncContainer(WMQuery_SavePlayer_Position);
if(remove)
{
asyncContainer->mBool = true;
}
//clarify what handler we have to call after saving - if any
asyncContainer->mObject = playerObject;
asyncContainer->mLogout = mLogout;
asyncContainer->clContainer = clContainer;
switch (mLogout)
{
case WMLogOut_LogOut:
case WMLogOut_Char_Load:
mDatabase->executeSqlAsync(this,asyncContainer,"UPDATE characters SET parent_id=%"PRIu64",oX=%f,oY=%f,oZ=%f,oW=%f,x=%f,y=%f,z=%f,planet_id=%u,jedistate=%u WHERE id=%"PRIu64"",playerObject->getParentId()
,playerObject->mDirection.x,playerObject->mDirection.y,playerObject->mDirection.z,playerObject->mDirection.w
,playerObject->mPosition.x,playerObject->mPosition.y,playerObject->mPosition.z
,mZoneId,playerObject->getJediState(),playerObject->getId());
break;
case WMLogOut_No_LogOut:
case WMLogOut_Zone_Transfer:
//start by saving the buffs the buffmanager will deal with the buffspecific db callbacks and start the position safe at their end
//which will return its callback to the worldmanager
//if no buff was there to be saved we will continue directly
if(playerObject && playerObject->isConnected() && !playerObject->isBeingDestroyed())
{
if(!gBuffManager->SaveBuffsAsync(asyncContainer, this, playerObject, GetCurrentGlobalTick()))
{
// position save will be called by the buff callback if there is any buff
mDatabase->executeSqlAsync(this,asyncContainer,"UPDATE characters SET parent_id=%"PRIu64",oX=%f,oY=%f,oZ=%f,oW=%f,x=%f,y=%f,z=%f,planet_id=%u,jedistate=%u WHERE id=%"PRIu64"",playerObject->getParentId()
,playerObject->mDirection.x,playerObject->mDirection.y,playerObject->mDirection.z,playerObject->mDirection.w
,playerObject->mPosition.x,playerObject->mPosition.y,playerObject->mPosition.z
,mZoneId,playerObject->getJediState(),playerObject->getId());
}
}
break;
default:
DLOG(INFO) << "We should never get in here, make sure to call savePlayer with the enum WMLogOut";
}
}
示例2: fillAttributeList
void LightsaberCrystalComponentImplementation::fillAttributeList(AttributeListMessage* alm, CreatureObject* object) {
TangibleObjectImplementation::fillAttributeList(alm, object);
PlayerObject* player = object->getPlayerObject();
if (player->getJediState() > 1 || player->isPrivileged()){
if (owner == ""){
StringBuffer str;
str << "\\#FF6600" << "UNTUNED" ;
alm->insertAttribute("crystal_owner", str);
} else {
alm->insertAttribute("crystal_owner", owner);
}
}
if (getColor() != 31){
if (owner == ""){
StringBuffer str2;
str2 << "@jedi_spam:saber_color_" << getColor();
alm->insertAttribute("color", str2);
} else {
StringBuffer str3;
str3 << "@jedi_spam:saber_color_" << getColor();
alm->insertAttribute("color", str3);
}
}
if (player->getJediState() > 1 || player->isPrivileged()){
if (getColor() == 31){
if (owner != ""){
alm->insertAttribute("mindamage", minimumDamage);
alm->insertAttribute("maxdamage", maximumDamage);
alm->insertAttribute("wpn_attack_speed", attackSpeed);
alm->insertAttribute("wpn_wound_chance", woundChance);
alm->insertAttribute("wpn_attack_cost_health", sacHealth);
alm->insertAttribute("wpn_attack_cost_action", sacAction);
alm->insertAttribute("wpn_attack_cost_mind", sacMind);
alm->insertAttribute("forcecost", forceCost);
} else {
StringBuffer str;
str << "@jedi_spam:crystal_quality_" << getQuality();
alm->insertAttribute("quality", str);
}
}
}
}
示例3: handleDatabaseJobComplete
void BuffManager::handleDatabaseJobComplete(void *ref, DatabaseResult *result)
{
buffAsyncContainer* asyncContainer = reinterpret_cast<buffAsyncContainer*>(ref);
if(!asyncContainer)
{
if(result)
//mDatabase->DestroyResult(result);
return;
}
switch(asyncContainer->mQueryType)
{
//we started saving a player ASync - give it back to the WorldManager
case BMQuery_Save_Async:
{
//get the player and check whether this was the last buff callback
PlayerObject* playerObject = asyncContainer->player;
playerObject->DecBuffAsyncCount();
//if this is the last callback continue with saving the players data
if(!playerObject->GetBuffAsyncCount())
{
//the asynccontainer was prepared by the worldmanager
WMAsyncContainer* asContainer = asyncContainer->asyncContainer;
// position save - the callback will be in the worldmanager to proceed with the rest of the safe
mDatabase->executeSqlAsync(reinterpret_cast<DatabaseCallback*>(asyncContainer->callBack),asContainer,"UPDATE %s.characters SET parent_id=%" PRIu64 ",oX=%f,oY=%f,oZ=%f,oW=%f,x=%f,y=%f,z=%f,planet_id=%u,jedistate=%u WHERE id=%" PRIu64 "",
mDatabase->galaxy(),playerObject->getParentId()
,playerObject->mDirection.x,playerObject->mDirection.y,playerObject->mDirection.z,playerObject->mDirection.w
,playerObject->mPosition.x,playerObject->mPosition.y,playerObject->mPosition.z
,gWorldManager->getZoneId(),playerObject->getJediState(),playerObject->getId());
//Free up Memory
SAFE_DELETE(asyncContainer);
BuffList::iterator it = playerObject->GetBuffList()->begin();
while(it != playerObject->GetBuffList()->end())
{
SAFE_DELETE(*it);
it = playerObject->GetBuffList()->erase(it);
}
}
}
break;
case BMQuery_Buffs:
{
LoadBuffsFromResult(asyncContainer, result);
}
break;
case BMQuery_Buff_Attributes:
{
LoadBuffAttributesFromResult(asyncContainer, result);
}
break;
case BMQuery_Delete:
{
SAFE_DELETE(asyncContainer);
}
break;
case BMQuery_Null:
{
}
break;
default:
{
}
break;
}
}
示例4: fullfillsSkillPrerequisites
bool SkillManager::fullfillsSkillPrerequisites(const String& skillName, CreatureObject* creature) {
Skill* skill = skillMap.get(skillName.hashCode());
if (skill == NULL) {
return false;
}
Vector<String>* requiredSpecies = skill->getSpeciesRequired();
if (requiredSpecies->size() > 0) {
bool foundSpecies = false;
for (int i = 0; i < requiredSpecies->size(); i++) {
if (creature->getSpeciesName() == requiredSpecies->get(i)) {
foundSpecies = true;
break;
}
}
if (!foundSpecies) {
return false;
}
}
//Check for required skills.
Vector<String>* requiredSkills = skill->getSkillsRequired();
for (int i = 0; i < requiredSkills->size(); ++i) {
String requiredSkillName = requiredSkills->get(i);
Skill* requiredSkill = skillMap.get(requiredSkillName.hashCode());
if (requiredSkill == NULL) {
continue;
}
if (!creature->hasSkill(requiredSkillName)) {
return false;
}
}
PlayerObject* ghost = creature->getPlayerObject();
if(ghost == NULL || ghost->getJediState() < skill->getJediStateRequired()) {
return false;
}
if (ghost->isPrivileged())
return true;
if (skillName.beginsWith("force_sensitive")) { // Check for Force Sensitive boxes.
int index = skillName.indexOf("0");
if (index != -1) {
String skillNameFinal = skillName.subString(0, skillName.length() - 3);
if (creature->getScreenPlayState("VillageUnlockScreenPlay:" + skillNameFinal) < 2) {
return false;
}
}
}
if(skillName == "force_title_jedi_rank_01" && getForceSensitiveSkillCount(creature, false) < 24) {
return false;
}
if(skillName == "force_title_jedi_rank_03" && !knightPrereqsMet(creature, "")) {
return false;
}
return true;
}