Merge branch 'main/gingo-test' into main/atys-live

main/atys-live live/895
Nuno 3 years ago
commit 3868876ab4

@ -4553,13 +4553,20 @@ void CCharacterCL::applyBehaviourFlyingHPs(const CBehaviourContext &bc, const MB
{
nlassert(targetHitDates.size()==bc.Targets.Targets.size());
if(!bc.Targets.Targets.empty())
if (behaviour.DeltaHP == 0 || bc.Targets.Targets.empty())
return;
CRGBA deltaHPColor(0, 0, 0);
for (size_t i=0; i<bc.Targets.Targets.size(); ++i)
{
if(behaviour.DeltaHP != 0)
if(bc.Targets.Targets[i].DeltaHP == 0)
continue;
CEntityCL *target2 = EntitiesMngr.entity(bc.Targets.Targets[i].TargetSlot);
if(target2)
{
CRGBA deltaHPColor(0, 0, 0);
// if it's a hit
if( behaviour.DeltaHP < 0 )
if(bc.Targets.Targets[i].DeltaHP < 0)
{
// if the behaviour is casted by the user
if( slot() == 0 )
@ -4590,13 +4597,7 @@ void CCharacterCL::applyBehaviourFlyingHPs(const CBehaviourContext &bc, const MB
deltaHPColor = CRGBA(0,220,0);
}
// Set the delta HP
for (size_t i=0; i<bc.Targets.Targets.size(); ++i)
{
CEntityCL *target2 = EntitiesMngr.entity(bc.Targets.Targets[i].TargetSlot);
if(target2)
target2->addHPOutput(behaviour.DeltaHP, deltaHPColor, float(targetHitDates[i]-TimeInSec));
}
target2->addHPOutput(bc.Targets.Targets[i].DeltaHP, deltaHPColor, float(targetHitDates[i]-TimeInSec));
}
}
}
@ -9705,7 +9706,7 @@ NLMISC_COMMAND(projectile, "Cast a projectile on another entity", "<spellID> <st
double dist = (target->pos() - ch->pos()).norm();
bool resist = false;
if (args.size() > 4) fromString(args[4], resist);
bc.Targets.Targets.push_back(CMultiTarget::CTarget(targetSlot, resist, (uint8) ceilf((float) (dist / MULTI_TARGET_DISTANCE_UNIT))));
bc.Targets.Targets.push_back(CMultiTarget::CTarget(targetSlot, resist, (uint8) ceilf((float) (dist / MULTI_TARGET_DISTANCE_UNIT)), -11));
}
bc.BehavTime = TimeInSec;
ch->applyBehaviour(bc);
@ -9743,7 +9744,7 @@ NLMISC_COMMAND(mtProjectile, "Cast a projectile on one or several entities", "<c
if (mainTarget)
{
double dist = (mainTarget->pos() - ch->pos()).norm();
bc.Targets.Targets.push_back(CMultiTarget::CTarget(mainTargetSlot, false, (uint8) ceilf((float) (dist / MULTI_TARGET_DISTANCE_UNIT))));
bc.Targets.Targets.push_back(CMultiTarget::CTarget(mainTargetSlot, false, (uint8) ceilf((float) (dist / MULTI_TARGET_DISTANCE_UNIT)), 1));
for(sint k = 1; k < (sint) (args.size() - 4); ++k)
{
uint secondaryTargetSlot;
@ -9753,7 +9754,7 @@ NLMISC_COMMAND(mtProjectile, "Cast a projectile on one or several entities", "<c
if (secondaryTarget)
{
dist = (secondaryTarget->pos() - mainTarget->pos()).norm();
bc.Targets.Targets.push_back(CMultiTarget::CTarget(secondaryTargetSlot, false, (uint8) ceilf((float) (dist / MULTI_TARGET_DISTANCE_UNIT))));
bc.Targets.Targets.push_back(CMultiTarget::CTarget(secondaryTargetSlot, false, (uint8) ceilf((float) (dist / MULTI_TARGET_DISTANCE_UNIT)), k+1));
}
}
}
@ -9770,7 +9771,7 @@ NLMISC_COMMAND(mtProjectile, "Cast a projectile on one or several entities", "<c
if (target)
{
double dist = (target->pos() - ch->pos()).norm();
bc.Targets.Targets.push_back(CMultiTarget::CTarget(targetSlot, false, (uint8) ceilf((float) (dist / MULTI_TARGET_DISTANCE_UNIT))));
bc.Targets.Targets.push_back(CMultiTarget::CTarget(targetSlot, false, (uint8) ceilf((float) (dist / MULTI_TARGET_DISTANCE_UNIT)), k+1));
}
}
}
@ -9787,7 +9788,7 @@ NLMISC_COMMAND(mtProjectile, "Cast a projectile on one or several entities", "<c
if (target)
{
double dist = (target->pos() - startSlot->pos()).norm();
bc.Targets.Targets.push_back(CMultiTarget::CTarget(targetSlot, false, (uint8) ceilf((float) (dist / MULTI_TARGET_DISTANCE_UNIT))));
bc.Targets.Targets.push_back(CMultiTarget::CTarget(targetSlot, false, (uint8) ceilf((float) (dist / MULTI_TARGET_DISTANCE_UNIT)), k+1));
startSlot = target;
}
}
@ -10100,6 +10101,7 @@ NLMISC_COMMAND(attack, "simulate an attack", "<slot> <intensity> <hit_type> <loc
CMultiTarget::CTarget target;
target.TargetSlot = UserEntity->selection();
target.Info = dsPower | (dsType << 3);
target.DeltaHP = -20;
bc.Targets.Targets.push_back(target);
bc.BehavTime = TimeInSec;
bc.Behav.DeltaHP = -20;
@ -10154,7 +10156,7 @@ NLMISC_COMMAND(rangeAttack, "simulate a range attack", "<slot> [intensity] [loca
CEntityCL *target = EntitiesMngr.entity(targetSlot);
if (!target) return false;
double dist = (target->pos() - entity->pos()).norm();
bc.Targets.Targets.push_back(CMultiTarget::CTarget(targetSlot, false, (uint8) ceilf((float) (dist / MULTI_TARGET_DISTANCE_UNIT))));
bc.Targets.Targets.push_back(CMultiTarget::CTarget(targetSlot, false, (uint8) ceilf((float) (dist / MULTI_TARGET_DISTANCE_UNIT)), -10));
bc.Behav.DeltaHP = -10;
entity->applyBehaviour(bc);
return true;
@ -10188,7 +10190,7 @@ NLMISC_COMMAND(creatureAttack, "simulate a creature attack (2 attaques per creat
{
fromString(args[8], resist);
}
bc.Targets.Targets.push_back(CMultiTarget::CTarget(targetSlot, false, (uint8) ceilf((float) (dist / MULTI_TARGET_DISTANCE_UNIT))));
bc.Targets.Targets.push_back(CMultiTarget::CTarget(targetSlot, false, (uint8) ceilf((float) (dist / MULTI_TARGET_DISTANCE_UNIT)), -15));
bc.Behav.CreatureAttack.ActionDuration = 0;
uint magicImpactIntensity = 1;
if (args.size() > 3)

@ -413,6 +413,7 @@ CClientConfig::CClientConfig()
CameraRecorderPrefix = "cam_rec";
CameraRecorderBlend = true;
ScreenShotDirectory = "screenshots";
ScreenShotWidth = 0;
ScreenShotHeight = 0;
ScreenShotFullDetail = true;
@ -1142,6 +1143,7 @@ void CClientConfig::setValues()
READ_BOOL_FV(CameraRecorderBlend)
// Screenshot
READ_STRING_FV(ScreenShotDirectory)
READ_INT_FV(ScreenShotWidth)
READ_INT_FV(ScreenShotHeight)
READ_BOOL_FV(ScreenShotFullDetail)

@ -306,6 +306,7 @@ struct CClientConfig
bool CameraRecorderBlend;
/// Screen shot
string ScreenShotDirectory;
uint ScreenShotWidth; // If 0 : normal screen shot, else custom screen shot without interface
uint ScreenShotHeight;
bool ScreenShotFullDetail; // If set to true, then load balancing will be disabled for the duration of the screenshot

@ -408,6 +408,18 @@ NLMISC_COMMAND(afk, "Set the player as 'away from keyboard'","[<custom text>]")
return true;
}
NLMISC_COMMAND(selfkill, "Kill the player ","")
{
CBitMemStream out;
if(!GenericMsgHeaderMngr.pushNameToStream("COMMAND:SELFKILL", out))
{
nlwarning("Unknown message name COMMAND:SELFKILL");
return false;
}
NetMngr.push(out);
return true;
}
bool randomCheckCharset(std::string const& str)
{
std::string::const_iterator it, itEnd = str.end();

@ -1095,6 +1095,20 @@ public:
REGISTER_ACTION_HANDLER( CHandlerContextWebPage, "context_web_page");
// ***************************************************************************
class CHandlerFullMap : public IActionHandler
{
public:
void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
CLuaManager::getInstance().executeLuaScript("game:openFullMap()", true);
}
};
REGISTER_ACTION_HANDLER( CHandlerFullMap, "fullmap");
// ***************************************************************************
@ -1958,7 +1972,7 @@ public:
bool womanTitle = false;
if (pChar != NULL)
womanTitle = pChar->getGender() == GSGENDER::female;
copyInout = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout), womanTitle);
// Sometimes translation contains another title
@ -2665,9 +2679,9 @@ class CAHAddShape : public IActionHandler
instance.setPos(CVector((float)x, (float)y, (float)z));
instance.setRotQuat(dir.getRot());
}
instance.setTransformMode(UTransformable::RotEuler);
// if the shape is a particle system, additionnal parameters are user params
UParticleSystemInstance psi;
psi.cast (instance);
@ -3402,7 +3416,7 @@ class CHandlerGameConfigVREnable : public IActionHandler
// VR_CONFIG
CCtrlBaseButton *pBut = dynamic_cast<CCtrlBaseButton*>(CWidgetManager::getInstance()->getElementFromId(GAME_CONFIG_VR_ENABLE_BUTTON));
if (pBut)
if (pBut)
{
// hide or show device list depending on enabled or not
updateVRDevicesComboUI(pBut->getPushed());
@ -3541,7 +3555,7 @@ class CHandlerGameConfigApply : public IActionHandler
NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CHAT:AUTO_CHANNEL")->setValue32(pCS->getPushed());
CCtrlBaseButton *pBut = dynamic_cast<CCtrlBaseButton*>(CWidgetManager::getInstance()->getElementFromId(GAME_CONFIG_VR_ENABLE_BUTTON));
if (pBut)
if (pBut)
{
// store the new config variables
ClientCfg.VREnable = pBut->getPushed();

@ -208,7 +208,7 @@ void CInterfaceItemEdition::CItemEditionWindow::begin()
{
if(_CurrItemSheet && !WindowName.empty())
{
const CItemSheet *pIS = _CurrItemSheet->asItemSheet();
if ((pIS != NULL) && ITEMFAMILY::isTextCustomizable(pIS->Family) )
{
@ -342,7 +342,7 @@ void CInterfaceItemEdition::CItemEditionWindow::begin()
// ********************************************************************************************
void CInterfaceItemEdition::CItemEditionWindow::end()
{
CDBCtrlSheet *pCSItem = _CurrItemSheet;
std::string windowName = WindowName;
if(pCSItem && !windowName.empty())
@ -371,7 +371,7 @@ void CInterfaceItemEdition::CItemEditionWindow::end()
editBoxShort->setActive(false);
editShort->setActive(false);
editBoxLarge->setActive(false);
editLarge->setActive(false);
editLarge->setActive(false);
display->setActive(false);
editButtons->setActive(false);
closeButton->setActive(false);
@ -413,7 +413,7 @@ void CInterfaceItemEdition::CItemEditionWindow::validate()
textValid = editLarge->getActive();
text = editBoxLarge->getInputString();
}
if (textValid)
{
CBitMemStream out;
@ -562,7 +562,7 @@ static void openStackItem(CCtrlBase *pCaller, CDBCtrlSheet *pCSSrc, CDBCtrlSheet
//=====================================================================================================================
static void sendExchangeAddToServer(uint16 srcSlotIndex, uint16 destSlotIndex, uint16 quantitySrc)
static void sendExchangeAddToServer(uint16 srcInvIndex, uint16 srcSlotIndex, uint16 destSlotIndex, uint16 quantitySrc)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
@ -571,6 +571,7 @@ static void openStackItem(CCtrlBase *pCaller, CDBCtrlSheet *pCSSrc, CDBCtrlSheet
if(GenericMsgHeaderMngr.pushNameToStream(sMsg, out))
{
// Swap all the Src (quantity= quantitySrc) to dest
out.serial(srcInvIndex);
out.serial(srcSlotIndex);
out.serial(destSlotIndex);
out.serial(quantitySrc);
@ -615,7 +616,7 @@ static void openStackItem(CCtrlBase *pCaller, CDBCtrlSheet *pCSSrc, CDBCtrlSheet
NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:EXCHANGE:ACCEPTED")->setValue32(0);
// send msg to server
sendExchangeAddToServer((uint16)src->getIndexInDB(), (uint8)dest->getIndexInDB(), (uint16)quantitySrc);
sendExchangeAddToServer((uint16) src->getSecondIndexInDB(), (uint16)src->getIndexInDB(), (uint8)dest->getIndexInDB(), (uint16)quantitySrc);
}
else
{
@ -725,7 +726,7 @@ static void validateStackItem(CDBCtrlSheet *pCSSrc, CDBCtrlSheet *pCSDst, sint32
NLGUI::CDBManager::getInstance()->getDbProp("LOCAL:EXCHANGE:ACCEPTED")->setValue32(0);
// send msg to server
sendExchangeAddToServer((uint16)pCSSrc->getIndexInDB(), (uint8)pCSDst->getIndexInDB(), (uint16)val);
sendExchangeAddToServer((uint16)pCSSrc->getSecondIndexInDB(), (uint16)pCSSrc->getIndexInDB(), (uint8)pCSDst->getIndexInDB(), (uint16)val);
}
}
}
@ -746,6 +747,10 @@ public:
CInterfaceElement *pElt = CWidgetManager::getInstance()->getElementFromId(src);
CDBCtrlSheet *pCSSrc = dynamic_cast<CDBCtrlSheet*>(pElt);
CDBCtrlSheet *pCSDst = dynamic_cast<CDBCtrlSheet*>(pCaller);
// end drag
getInventory().endDrag();
if ((pCSSrc == NULL) || (pCSDst == NULL)) return;
if (pCSSrc->getType() == CCtrlSheetInfo::SheetType_Item)
@ -1049,9 +1054,21 @@ class CCanDropToExchange : public IActionHandler
if (!pCSSrc || !pCSDst) return;
// Exchange can only be done from bag to exchange inventories
if (pCSSrc->getSecondIndexInDB() == INVENTORIES::bag &&
pCSDst->getSecondIndexInDB() == INVENTORIES::exchange)
uint32 srcInventory = pCSSrc->getSecondIndexInDB();
if (
(srcInventory == INVENTORIES::bag ||
srcInventory == INVENTORIES::pet_animal1 ||
srcInventory == INVENTORIES::pet_animal2 ||
srcInventory == INVENTORIES::pet_animal3 ||
srcInventory == INVENTORIES::pet_animal4 ||
srcInventory == INVENTORIES::pet_animal5 ||
srcInventory == INVENTORIES::pet_animal6 ||
srcInventory == INVENTORIES::pet_animal7 ||
srcInventory == INVENTORIES::guild ||
srcInventory == INVENTORIES::player_room)
&& getInventory().isInventoryAvailable((INVENTORIES::TInventory) pCSSrc->getSecondIndexInDB())
&& pCSDst->getSecondIndexInDB() == INVENTORIES::exchange
)
{
if (checkCanExchangeItem(pCSSrc))
{
@ -1722,7 +1739,7 @@ void CItemMenuInBagInfoWaiter::infoReceived()
void CItemMenuInBagInfoWaiter::infoValidated(CDBCtrlSheet* ctrlSheet)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
// get the dialog stack
CInterfaceGroup* pMenu = dynamic_cast<CInterfaceGroup*>( CWidgetManager::getInstance()->getElementFromId("ui:interface:item_menu_in_bag") );
if(!pMenu) return;
@ -1868,7 +1885,7 @@ class CHandlerItemMenuCheck : public IActionHandler
}
if (pItemTextDisplay && pIS->Family == ITEMFAMILY::SCROLL)
{
if (pCS->getInventoryIndex()==INVENTORIES::bag)
if (pCS->getInventoryIndex()==INVENTORIES::bag && pIS->Scroll.Label.empty())
pItemTextDisplay->setActive(true);
pItemInfos->setActive(false);
}
@ -1960,16 +1977,15 @@ class CHandlerItemMenuCheck : public IActionHandler
for(i=0;i<MAX_INVENTORY_ANIMAL;i++)
{
if (pMoveToPa[i])
pMoveToPa[i]->setActive(invId!=INVENTORIES::guild &&
(uint)invId!=INVENTORIES::pet_animal+i &&
pMoveToPa[i]->setActive((uint)invId!=INVENTORIES::pet_animal+i &&
invMngr.isInventoryPresent((INVENTORIES::TInventory)(INVENTORIES::pet_animal+i)) );
}
if (pMoveToGuild)
pMoveToGuild->setActive(invId==INVENTORIES::bag && invMngr.isInventoryPresent(INVENTORIES::guild));
pMoveToGuild->setActive(invId!=INVENTORIES::guild && invMngr.isInventoryPresent(INVENTORIES::guild));
if (pMoveToRoom)
pMoveToRoom->setActive(invId==INVENTORIES::bag && invMngr.isInventoryPresent(INVENTORIES::player_room));
pMoveToRoom->setActive(invId!=INVENTORIES::player_room && invMngr.isInventoryPresent(INVENTORIES::player_room));
// std case: can drop / destroy
if(pDrop) pDrop->setActive(invId!=INVENTORIES::guild);
@ -2037,7 +2053,7 @@ class CHandlerItemMenuCheck : public IActionHandler
if (pMoveSubMenu) pMoveSubMenu->setActive(false);
}
if (bIsLockedByOwner)
if (bIsLockedByOwner)
{
if (pLockUnlock) pLockUnlock->setHardText("uimUnlockItem");
// Cannot drop/destroy if locked by owner
@ -2050,7 +2066,8 @@ class CHandlerItemMenuCheck : public IActionHandler
}
// Only show lock menu item if inventory contains the info
if (pLockUnlock) pLockUnlock->setActive(pCS->canOwnerLock());
if (invId!=INVENTORIES::guild)
if (pLockUnlock) pLockUnlock->setActive(pCS->canOwnerLock());
// **** Gray Entries
@ -2207,7 +2224,7 @@ class CHandlerItemMenuBaseCheck : public IActionHandler
CViewTextMenu *pDestroy = dynamic_cast<CViewTextMenu*>(pMenu->getView("destroy"));
CViewTextMenu *pLockUnlock = dynamic_cast<CViewTextMenu*>(pMenu->getView("lockunlock"));
if (pCS->getLockedByOwner())
if (pCS->getLockedByOwner())
{
pLockUnlock->setHardText("uimUnlockItem");
// Cannot destroy if locked by owner
@ -2364,7 +2381,7 @@ class CHandlerItemTextDisplay : public IActionHandler
std::string const& windowName = sParams;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CDBCtrlSheet *pCSItem = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getCtrlLaunchingModal());
if (pCSItem == NULL || windowName.empty())
if (pCSItem == NULL || windowName.empty())
return;
const CItemSheet *pIS = pCSItem->asItemSheet();
@ -2385,7 +2402,7 @@ class CHandlerItemTextEdition : public IActionHandler
std::string const& windowName = sParams;
CInterfaceManager *pIM = CInterfaceManager::getInstance();
CDBCtrlSheet *pCSItem = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getCtrlLaunchingModal());
if (pCSItem == NULL || windowName.empty())
if (pCSItem == NULL || windowName.empty())
return;
CInterfaceItemEdition::getInstance()->setCurrWindow(pCSItem, windowName, true);

@ -62,9 +62,6 @@ extern NLMISC::CLog g_log;
////////////
//static CCDBNodeLeaf *MenuColorWidgetValue = NULL; // db entry for the color menu widget (Red)
static const string ScreenshotsDirectory("screenshots/"); // don't forget the final /
void preRenderNewSky ();
// ***************************************************************************
@ -602,11 +599,6 @@ void displayScreenShotSavedInfo(const string &filename)
pIM->displaySystemInfo(msg);
}
void initScreenshot()
{
if (!CFile::isExists(ScreenshotsDirectory)) CFile::createDirectory(ScreenshotsDirectory);
}
bool screenshotZBuffer(const std::string &filename)
{
std::string::size_type pos = filename.find(".");
@ -672,6 +664,11 @@ bool screenshotZBuffer(const std::string &filename)
static std::string findNewScreenShotFileName(std::string filename)
{
// make screenshot directory if it does not exist
if (!CFile::isExists(ClientCfg.ScreenShotDirectory))
CFile::createDirectory(ClientCfg.ScreenShotDirectory);
filename = CPath::standardizePath(ClientCfg.ScreenShotDirectory) + filename;
static char cstime[25];
time_t dtime;
time(&dtime);
@ -698,7 +695,7 @@ void screenShotTGA()
CBitmap btm;
getBuffer (btm);
string filename = findNewScreenShotFileName(ScreenshotsDirectory+"screenshot.tga");
string filename = findNewScreenShotFileName("screenshot.tga");
COFile fs(filename);
if (!btm.writeTGA(fs, 24, false))
@ -720,7 +717,7 @@ void screenShotPNG()
CBitmap btm;
getBuffer (btm);
string filename = findNewScreenShotFileName(ScreenshotsDirectory+"screenshot.png");
string filename = findNewScreenShotFileName("screenshot.png");
COFile fs(filename);
if (!btm.writePNG(fs, 24))
@ -742,7 +739,7 @@ void screenShotJPG()
CBitmap btm;
getBuffer (btm);
string filename = findNewScreenShotFileName(ScreenshotsDirectory+"screenshot.jpg");
string filename = findNewScreenShotFileName("screenshot.jpg");
COFile fs(filename);
if (!btm.writeJPG(fs))

@ -181,7 +181,6 @@ public:
/** Capture current content of framebuffer and save the result. If a custom size is asked in ClientCfg, then the scene is rendered again
* instead (possibly multiple time)
*/
void initScreenshot();
void screenShotTGA();
void screenShotPNG();
void screenShotJPG();

@ -50,6 +50,10 @@ using namespace NLMISC;
// ***************************************************************************
const std::string FaberPlanDB= "UI:PHRASE:FABER:FABER_PLAN:SHEET";
const std::string FaberPlanHpBuffDB= "UI:PHRASE:FABER:FABER_PLAN:HP_BUFF";
const std::string FaberPlanSapBuffDB= "UI:PHRASE:FABER:FABER_PLAN:SAP_BUFF";
const std::string FaberPlanStaBuffDB= "UI:PHRASE:FABER:FABER_PLAN:STA_BUFF";
const std::string FaberPlanFocusBuffDB= "UI:PHRASE:FABER:FABER_PLAN:FOCUS_BUFF";
const std::string MPFaberDB= "UI:PHRASE:FABER:MP_BUILD";
const std::string MPSelectionDB= "UI:PHRASE:FABER:MP_SELECT";
const std::string MPQuantityDb= "UI:PHRASE:FABER:MP_QUANTITY";
@ -170,6 +174,16 @@ void CActionPhraseFaber::launchFaberCastWindow(sint32 memoryLine, uint memoryIn
if(node)
node->setValue32(0);
// Reset buff values
node = NLGUI::CDBManager::getInstance()->getDbProp(FaberPlanHpBuffDB, false);
if (node) node->setValue32(0);
node = NLGUI::CDBManager::getInstance()->getDbProp(FaberPlanSapBuffDB, false);
if (node) node->setValue32(0);
node = NLGUI::CDBManager::getInstance()->getDbProp(FaberPlanStaBuffDB, false);
if (node) node->setValue32(0);
node = NLGUI::CDBManager::getInstance()->getDbProp(FaberPlanFocusBuffDB, false);
if (node) node->setValue32(0);
// Reset the result item
node= NLGUI::CDBManager::getInstance()->getDbProp(ItemResultSheetDB, false);
if(node)
@ -1565,6 +1579,14 @@ void CActionPhraseFaber::updateItemResult()
uint phraseSlot= pPM->getMemorizedPhrase(_ExecuteFromMemoryLine, _ExecuteFromMemoryIndex);
const CSPhraseCom &phrase= pPM->getPhrase(phraseSlot);
uint32 recommendedPropId= pBM->getBrickPropId("cr_recommended");
uint32 crHp = pBM->getBrickPropId("cr_hp");
uint32 crSap = pBM->getBrickPropId("cr_sap");
uint32 crSta = pBM->getBrickPropId("cr_sta");
uint32 crFocus = pBM->getBrickPropId("cr_focus");
sint32 hpBuff = 0;
sint32 sapBuff = 0;
sint32 staBuff = 0;
sint32 focusBuff = 0;
for(i=0;i<phrase.Bricks.size();i++)
{
CSBrickSheet *brick= pBM->getBrick(phrase.Bricks[i]);
@ -1578,10 +1600,30 @@ void CActionPhraseFaber::updateItemResult()
// minimze the level
minLevel= min(minLevel, sint32(brick->Properties[j].Value));
}
if (brick->Properties[j].PropId == crHp)
hpBuff = sint32(brick->Properties[j].Value);
if (brick->Properties[j].PropId == crSap)
sapBuff = sint32(brick->Properties[j].Value);
if (brick->Properties[j].PropId == crSta)
staBuff = sint32(brick->Properties[j].Value);
if (brick->Properties[j].PropId == crFocus)
focusBuff = sint32(brick->Properties[j].Value);
}
}
}
{
NLGUI::CDBManager *cdb = NLGUI::CDBManager::getInstance();
NLMISC::CCDBNodeLeaf *node = cdb->getDbProp(FaberPlanHpBuffDB, false);
if (node) node->setValue32(hpBuff);
node = cdb->getDbProp(FaberPlanSapBuffDB, false);
if (node) node->setValue32(sapBuff);
node = cdb->getDbProp(FaberPlanStaBuffDB, false);
if (node) node->setValue32(staBuff);
node = cdb->getDbProp(FaberPlanFocusBuffDB, false);
if (node) node->setValue32(focusBuff);
}
// **** Parse all MPs setuped, to compute level and stats
uint totalItemPartMPReq= 0;

@ -2534,7 +2534,8 @@ void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelecti
// there is max 4 icons
sint32 hArea = (hSheet / 4);
sint32 xIcon = x;
sint32 yIcon = y;
// move buff icons up a row, quantity text is displayed on bottom-left corner
sint32 yIcon = y + hArea;
for (uint i = 0; i < _BuffIcons.size(); ++i)
{
sint32 wIcon = _BuffIcons[i].IconW;

@ -799,7 +799,11 @@ static DECLARE_INTERFACE_USER_FCT(getAnimalInventoryStateText)
// According to server status, change the inventory text
uint status= (uint)args[0].getInteger();
if(ANIMAL_STATUS::isInStable((ANIMAL_STATUS::EAnimalStatus)status))
if(ANIMAL_STATUS::isInBag((ANIMAL_STATUS::EAnimalStatus)status))
{
result.setString("uiAnimalInBag");
}
else if(ANIMAL_STATUS::isInStable((ANIMAL_STATUS::EAnimalStatus)status))
{
result.setString("uiAnimalInStable");
}

@ -2903,32 +2903,6 @@ class CHandlerInvCanDropTo : public IActionHandler
if ((pListDstText != NULL) || (pListDstIcon != NULL))
{
bool bCanDrop = true;
// WE CANT DND if we want to dnd from other bag than BAG to guild bag
if (pListDstIcon != NULL)
{
if (pListDstIcon->getInvType() == CInventoryManager::InvGuild)
if (strnicmp(pCSSrc->getSheet().c_str(),"LOCAL:INVENTORY:BAG", 19) != 0)
bCanDrop = false;
}
if (pListDstText != NULL)
{
if (pListDstText->getInvType() == CInventoryManager::InvGuild)
if (strnicmp(pCSSrc->getSheet().c_str(),"LOCAL:INVENTORY:BAG", 19) != 0)
bCanDrop = false;
}
// WE CANT DND if we want to dnd from guild bag to other bag than BAG
if (pListDstIcon != NULL)
{
if (pListDstIcon->getInvType() != CInventoryManager::InvBag)
if (strnicmp(pCSSrc->getSheet().c_str(),"SERVER:GUILD:INVENTORY", 19) == 0)
bCanDrop = false;
}
if (pListDstText != NULL)
{
if (pListDstText->getInvType() != CInventoryManager::InvBag)
if (strnicmp(pCSSrc->getSheet().c_str(),"SERVER:GUILD:INVENTORY", 19) == 0)
bCanDrop = false;
}
// WE CANT DND when packer/mount is too far
if (pListDstIcon != NULL)
@ -3100,7 +3074,6 @@ class CHandlerInvDropTo : public IActionHandler
else if (((pListDstText != NULL) && (pListDstText->getInvType() == CInventoryManager::InvGuild)) ||
((pListDstIcon != NULL) && (pListDstIcon->getInvType() == CInventoryManager::InvGuild)))
{
if (strnicmp(pCSSrc->getSheet().c_str(), "LOCAL:INVENTORY:BAG", 19) == 0)
CAHManager::getInstance()->runActionHandler("proc", pCSSrc, "move_to_guild");
}
else if (((pListDstText != NULL) && (pListDstText->getInvType() == CInventoryManager::InvRoom)) ||

@ -1000,9 +1000,6 @@ bool mainLoop()
// initialize the structure for the ping.
Ping.init();
// initialize screenshots directory
initScreenshot();
// Call a function for a demo to init.
if (ClientCfg.Local)

@ -1630,7 +1630,7 @@ const char *CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CSheetI
const char *CStringManagerClient::getTitleLocalizedName(const string &titleId, bool women)
{
vector<string> listInfos = getTitleInfos(titleId, women);
if (!listInfos.empty())
{
_TitleWords.push_back(listInfos[0]);
@ -1681,7 +1681,19 @@ vector<string> CStringManagerClient::getTitleInfos(const string &titleId, bool w
{
if (titleId[0] != '#')
{
listInfos[0] = getSpecialWord(listInfos[0], women);
// Check special case like SON_OF|jane|joe (with SON_OF = "Son of {1} and {2}")
vector<string> titleReps;
splitString(listInfos[0], string("|"), titleReps);
if (titleReps.size() > 1)
{
listInfos[0] = getSpecialWord(titleReps[0], women);
for(uint i=1; i < titleReps.size(); ++i )
{
while(strFindReplace(listInfos[0], toString("{%d}", i), titleReps[i]));
}
}
else
listInfos[0] = getSpecialWord(listInfos[0], women);
}
}

@ -491,8 +491,8 @@ void CUserEntity::updateVisualPropertyBehaviour(const NLMISC::TGameCycle &/* gam
}
CCDBNodeLeaf *targetList0 = dynamic_cast<CCDBNodeLeaf *>(_DBEntry->getNode(CLFECOMMON::PROPERTY_TARGET_LIST_0));
CCDBNodeLeaf *targetList1 = dynamic_cast<CCDBNodeLeaf *>(_DBEntry->getNode(CLFECOMMON::PROPERTY_TARGET_LIST_1));
CCDBNodeLeaf *targetList2 = dynamic_cast<CCDBNodeLeaf *>(_DBEntry->getNode(CLFECOMMON::PROPERTY_TARGET_LIST_1));
CCDBNodeLeaf *targetList3 = dynamic_cast<CCDBNodeLeaf *>(_DBEntry->getNode(CLFECOMMON::PROPERTY_TARGET_LIST_1));
CCDBNodeLeaf *targetList2 = dynamic_cast<CCDBNodeLeaf *>(_DBEntry->getNode(CLFECOMMON::PROPERTY_TARGET_LIST_2));
CCDBNodeLeaf *targetList3 = dynamic_cast<CCDBNodeLeaf *>(_DBEntry->getNode(CLFECOMMON::PROPERTY_TARGET_LIST_3));
if (targetList0 && targetList1 && targetList2 && targetList3)
{
uint64 vp[4] =

@ -22,18 +22,16 @@
// ***********************************************************************
void CMultiTarget::pack(uint64 *destVP, uint numVP)
{
nlassert(numVP * 4 >= Targets.size()); // not enough room to stores visual properties!
nlassert(numVP * 2 >= Targets.size()); // not enough room to stores visual properties!
CTarget invalidTarget;
uint index = 0;
for(uint k = 0; k < numVP; ++k)
{
uint16 parts[4];
for(uint l = 0; l < 4; ++l)
{
parts[l] = index < Targets.size() ? Targets[index].getPacked() : invalidTarget.getPacked();
++ index;
}
destVP[k] = (uint64) parts[0] | ((uint64) parts[1] << 16) | ((uint64) parts[2] << 32) | ((uint64) parts[3] << 48);
destVP[k] = index < Targets.size() ? Targets[index].getPacked() : invalidTarget.getPacked();
++index;
destVP[k] |= uint64(index < Targets.size() ? Targets[index].getPacked() : invalidTarget.getPacked()) << 32;
++index;
}
}
@ -43,18 +41,15 @@ void CMultiTarget::unpack(const uint64 *srcVP, uint numVP)
Targets.clear();
for(uint k = 0; k < numVP; ++k)
{
for(uint l = 0; l < 4; ++l)
{
CTarget t;
t.setPacked((uint16) ((srcVP[k] >> (16 * l)) & 0xffff));
if (t.TargetSlot != CLFECOMMON::INVALID_SLOT)
{
Targets.push_back(t);
}
else
{
return;
}
}
CTarget t;
t.setPacked(uint32(srcVP[k]));
if(t.TargetSlot == CLFECOMMON::INVALID_SLOT)
return;
Targets.push_back(t);
t.setPacked(uint32(srcVP[k] >> 32));
if(t.TargetSlot == CLFECOMMON::INVALID_SLOT)
return;
Targets.push_back(t);
}
}

@ -39,20 +39,21 @@ public:
uint8 TargetSlot; // the slot that is targetted
uint8 Info; // Damage shield for melee 5:3 format (damage shield io : power )
// Distance for range attacks (that do not have damage shield) format is 7:1
sint16 DeltaHP; //
public:
CTarget(uint8 slot = CLFECOMMON::INVALID_SLOT, bool resist = false, uint8 dist = 0) : TargetSlot(slot)
CTarget(uint8 slot = CLFECOMMON::INVALID_SLOT, bool resist = false, uint8 dist = 0, sint16 deltaHp = 0) : TargetSlot(slot), DeltaHP(deltaHp)
{
Info = (resist == 0 ? 0 : 0x80) | (dist & 0x7f);
}
uint16 getPacked() const;
void setPacked(uint16 value);
uint32 getPacked() const;
void setPacked(uint32 value);
};
typedef std::vector<CTarget> TTargetVect;
// the list of targets
TTargetVect Targets;
public:
/** create packed version of targets (to store in visual properties)
* each VP encodes 4 targets
* each VP encodes 2 targets
* caller must provide enough room to store the result (assertion is raised otherwise)
*/
void pack(uint64 *destVP, uint numVP);
@ -65,19 +66,18 @@ public:
////////////
// *******************************************************************************************
inline uint16 CMultiTarget::CTarget::getPacked() const
inline uint32 CMultiTarget::CTarget::getPacked() const
{
//return (uint16) TargetSlot | ((uint16) (Resist ? 1 : 0) << 15) | ((uint16) Distance << 8);
return (uint16) TargetSlot | (uint16(Info) << 8);
return ((uint32) TargetSlot) | ((uint32) Info << 8) | ((uint32) DeltaHP << 16);
}
// *******************************************************************************************
inline void CMultiTarget::CTarget::setPacked(uint16 value)
inline void CMultiTarget::CTarget::setPacked(uint32 value)
{
TargetSlot = uint8(value & 0xff);
/*Distance = (uint8) ((value >> 8) & 0x7f);
Resist = (value & 0x8000) != 0;*/
Info = value >> 8;
TargetSlot = uint8(value);
Info = uint8(value >> 8);
DeltaHP = sint16(value >> 16);
}
#endif

Loading…
Cancel
Save