Beispiel #1
0
bool	ArtisanManager::getRadioactiveSample(PlayerObject* player, CurrentResource* resource, SurveyTool* tool)
{
    uint32					resType			= resource->getType()->getCategoryId();
    uint16					resPE			= resource->getAttribute(ResAttr_PE);
    
    //these are the radioactive types
    if(resType == 477 || resType == 476 /* || resType == 475*/)
    {
        //did we already warn the player on the wounds ???
        if(!player->getSampleData()->mPassRadioactive)
        {
            //UI Integration

            WindowAsyncContainerCommand* asyncContainer = new  WindowAsyncContainerCommand(Window_Query_Radioactive_Sample);
            asyncContainer->PlayerId		= player->getId();
            asyncContainer->ToolId			= tool->getId();
            asyncContainer->CurrentResource	= resource;

            gUIManager->createNewMessageBox(this,"radioactiveSample","@survey:radioactive_sample_t","@survey:radioactive_sample_d",player,SUI_Window_SmplRadioactive_MsgBox, SUI_MB_YESNO,asyncContainer);
            //Pause Sampling
            player->getSampleData()->mPendingSample = false;
            return true;
        }
        Ham* hamz = player->getHam();
        uint32 playerBF = hamz->getBattleFatigue();
        
        uint32 woundDmg = 50*(1 + (playerBF/100)) + (50*(1 + (resPE/1000)));
        uint32 bfDmg    = static_cast<uint32>(0.075*resPE);
        uint32 hamReduc = 100*(2+ (resPE/1000));

        if(resPE >= 500)
        {
            //wound and BF dmg
            hamz->updateBattleFatigue(bfDmg);
            hamz->updatePropertyValue(HamBar_Health,HamProperty_Wounds, woundDmg); 
            hamz->updatePropertyValue(HamBar_Action,HamProperty_Wounds, woundDmg);
            hamz->updatePropertyValue(HamBar_Mind,HamProperty_Wounds, woundDmg);
        }
        
        //this should be a timed debuff per instance -- Do not cause wounds unless potential energy >= 500
        // each time a radioactive is sampled, there is a 5 minute debuff
        // this currently doesn't work properly as when the debuff wears off, the buff class doesn't ensure 
        // we don't have more ham than we should.
        
        BuffAttribute* healthdebuffAttribute = new BuffAttribute(attr_health, -(int)hamReduc,0,hamReduc); 
        Buff* healthdebuff = Buff::SimpleBuff(player, player, 300000,0, gWorldManager->GetCurrentGlobalTick());
        healthdebuff->AddAttribute(healthdebuffAttribute);	
        player->AddBuff(healthdebuff,true);

        healthdebuffAttribute = new BuffAttribute(attr_action, -(int)hamReduc,0,hamReduc); 
        healthdebuff = Buff::SimpleBuff(player, player, 300000, 0, gWorldManager->GetCurrentGlobalTick());
        healthdebuff->AddAttribute(healthdebuffAttribute);	
        player->AddBuff(healthdebuff,true);
    }
    else
        return false;

    return true;
}
void WorldManager::savePlayerSync(uint32 accId,bool remove)
{
    PlayerObject* playerObject = getPlayerByAccId(accId);
    Ham* ham = playerObject->getHam();

    mDatabase->destroyResult(mDatabase->executeSynchSql("UPDATE characters SET parent_id=%"PRIu64",oX=%f,oY=%f,oZ=%f,oW=%f,x=%f,y=%f,z=%f,planet_id=%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->getId()));
   

    mDatabase->destroyResult(mDatabase->executeSynchSql("UPDATE character_attributes SET health_current=%u,action_current=%u,mind_current=%u"
                             ",health_wounds=%u,strength_wounds=%u,constitution_wounds=%u,action_wounds=%u,quickness_wounds=%u"
                             ",stamina_wounds=%u,mind_wounds=%u,focus_wounds=%u,willpower_wounds=%u,battlefatigue=%u,posture=%u,moodId=%u,title=\'%s\'"
                             ",character_flags=%u,states=%"PRIu64",language=%u, group_id=%"PRIu64" WHERE character_id=%"PRIu64"",
                             ham->mHealth.getCurrentHitPoints() - ham->mHealth.getModifier(), //Llloydyboy Added the -Modifier so that when buffs are reinitialised, it doesn't screw up HAM
                             ham->mAction.getCurrentHitPoints() - ham->mAction.getModifier(), //Llloydyboy Added the -Modifier so that when buffs are reinitialised, it doesn't screw up HAM
                             ham->mMind.getCurrentHitPoints() - ham->mMind.getModifier(),	 //Llloydyboy Added the -Modifier so that when buffs are reinitialised, it doesn't screw up HAM
                             ham->mHealth.getWounds(),
                             ham->mStrength.getWounds(),
                             ham->mConstitution.getWounds(),
                             ham->mAction.getWounds(),
                             ham->mQuickness.getWounds(),
                             ham->mStamina.getWounds(),
                             ham->mMind.getWounds(),
                             ham->mFocus.getWounds(),
                             ham->mWillpower.getWounds(),
                             ham->getBattleFatigue(),
                             playerObject->states.getPosture(),
                             playerObject->getMoodId(),
                             playerObject->getTitle().getAnsi(),
                             playerObject->getPlayerFlags(),
							 playerObject->states.getAction(),
                             playerObject->getLanguage(),
                             playerObject->getGroupId(),
                             playerObject->getId()));

    gBuffManager->SaveBuffs(playerObject, GetCurrentGlobalTick());
    if(remove)
        destroyObject(playerObject);
}