From 7fa8e701112a4d59e2eb87a6f807e188ebc60a96 Mon Sep 17 00:00:00 2001 From: vl Date: Thu, 8 Jul 2010 16:05:15 +0200 Subject: [PATCH] Added: new rp jobs --- .../gamedev/interfaces_v3/info_player.lua | 102 +++++++++++++++++- .../gamedev/interfaces_v3/info_player.xml | 81 +++++++++++++- .../src/interface_v3/inventory_manager.cpp | 8 ++ .../interface_v3/item_consumable_effect.cpp | 92 +++++++++++++++- code/ryzom/client/src/net_manager.cpp | 101 +++++++++++++++-- 5 files changed, 365 insertions(+), 19 deletions(-) diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/info_player.lua b/code/ryzom/client/data/gamedev/interfaces_v3/info_player.lua index 9136bf614..d9f769c78 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/info_player.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/info_player.lua @@ -1313,6 +1313,8 @@ end -------------------------------------------------------------------------------------------------------------- function game:setCurrentMission(index) + mw = getMissionWindow() + mw.active = game.InGameDbInitialized if index < self:getGroupMissionFirstIndex() then runAH(nil, "proc", "mission_proc_title|" .. tostring(index)) else @@ -1435,24 +1437,27 @@ end -------------------------------------------------------------------------------------------------------------- -- This is called when a new step is added to the current mission. If so, make sure that the step -- is visible in the listbox -function game:onNewMissionStepAdded(stepIndex) +function game:onNewMissionStepAdded(stepIndex) local missionWnd = getMissionWindow() local missionIndex = getDbProp("UI:SAVE:MISSION_SELECTED") local dbPath + -- debugInfo("New Step") if missionIndex < 15 then dbPath = "SERVER:MISSIONS:" .. tostring(missionIndex) .. ":GOALS:" .. tostring(stepIndex) .. ":TEXT" else dbPath = "SERVER:GROUP:MISSIONS:" .. tostring(missionIndex - 15) .. ":GOALS:" .. tostring(stepIndex) .. ":TEXT" end local stringID = getDbProp(dbPath) - if stringID ~= 0 then + if stringID ~= 0 then + -- debugInfo(tostring(stringID)) table.insert(remainingMissionTextIDs, stringID) setOnDraw(missionWnd, "game:ensureLastMissionStepVisibility0()") else end end -function game:ensureLastMissionStepVisibility0() +function game:ensureLastMissionStepVisibility0() + local missing = false for k, v in pairs(remainingMissionTextIDs) do if not isDynStringAvailable(v) then @@ -1492,7 +1497,7 @@ function game:ensureLastMissionStepVisibility1() topStep = currStep end end - --debugInfo("Found step : " .. topStep.hardtext) + -- debugInfo("Found step : " .. topStep.hardtext) if topStep == nil then return end @@ -1517,6 +1522,95 @@ function game:onNewMissionAdded(missionIndex) debugInfo("Mission " .. missionIndex .. " has been added") end +-------------------------------------------------------------------------------------------------------------- +-- RPJOBS + +function game:addRpJob(jobtype, id, value, rpjobs) + local base_path = "ui:interface:info_player_skills:content:rpjobs:rpjob_"..jobtype.."_"..id..":rpjob_"..jobtype.."_infos_"..id + + local group = getUI("ui:interface:info_player_skills:content:rpjobs:rpjob_"..jobtype.."_"..id) + + if (value == nil) then + group.active = false + else + local name = "rpjob_" .. string.format("%03d", value) + local sitem = name..".sitem" + if (rpjobs[sitem] == nil) then + group.active = false + else + group.active = true + + local echelon_value = rpjobs[sitem][1] + local quantity = rpjobs[sitem][2] + + local maxlevel = (echelon_value*6)-30 + + if (quantity > maxlevel) then + quantity = maxlevel + end + + local base = getUI(base_path..":t") + base.hardtext = i18n.get(name):toUtf8() + local ui = getUI(base_path..":icon") + ui.texture = name..".tga" + local bar = getUI(base_path..":bar3d:level") + bar.color = tostring(math.floor((105*quantity)/maxlevel)).." "..tostring(100+math.floor((155*quantity)/maxlevel)).." "..tostring(math.floor((105*quantity)/maxlevel)).." 255" + bar.w = tostring((368*quantity)/maxlevel) + local t = getUI(base_path..":bar3d:t") + t.hardtext = tostring(quantity).." / "..tostring(maxlevel) + t.color = tostring(255*math.floor(3*(maxlevel-quantity)/maxlevel)).." "..tostring(255*math.floor(3*(maxlevel-quantity)/maxlevel)).." "..tostring(255*math.floor(3*(maxlevel-quantity)/maxlevel)).." 255" + local echelon = getUI(base_path..":echelon_value") + echelon.hardtext = tostring(echelon_value/10) + end + end +end +function game:getRPJobs() + rpjobs_advanced = {} + rpjobs_elementary = {} + rpjobs_roleplay = {} + rpjobs = {} + + for i = 0, 499, 1 do + local sheet = getDbProp("SERVER:INVENTORY:BAG:"..tostring(i)..":SHEET") + if (sheet ~= 0) then + local name = getSheetName(sheet) + if (string.sub(name, 0, 6) == "rpjob_") then + local quality = getDbProp("SERVER:INVENTORY:BAG:"..tostring(i)..":QUALITY") + local quantity = getDbProp("SERVER:INVENTORY:BAG:"..tostring(i)..":QUANTITY") + + if (name == "rpjob_advanced.sitem") then + table.insert(rpjobs_advanced, quality) + else + if (name == "rpjob_elementary.sitem") then + table.insert(rpjobs_elementary, quality) + else + if (name == "rpjob_roleplay.sitem") then + table.insert(rpjobs_roleplay, quality) + else + if rpjobs[name] == nil then + rpjobs[name] = {quality, quantity} + else + if rpjobs[name][1] < quality then + rpjobs[name] = {quality, quantity} + end + end + end + end + end + end + end + end + + for id=1,2,1 do + game:addRpJob("advanced", id, rpjobs_advanced[id], rpjobs) + end + + for id=1,3,1 do + game:addRpJob("elementary", id, rpjobs_elementary[id], rpjobs) + end + + +end diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/info_player.xml b/code/ryzom/client/data/gamedev/interfaces_v3/info_player.xml index 67714cf93..07c1b97be 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/info_player.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/info_player.xml @@ -635,6 +635,16 @@ params_r="" onclick_l="" params_l="" /> + + @@ -1448,7 +1459,41 @@ --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3232,6 +3277,7 @@ action="lua:game:onMissionJournalOpened()" /> + @@ -3350,7 +3396,38 @@ shadow="true" color="255 0 0 255" /> + + + + + + + + + + + + diff --git a/code/ryzom/client/src/interface_v3/inventory_manager.cpp b/code/ryzom/client/src/interface_v3/inventory_manager.cpp index 0755e2247..2fe27b70a 100644 --- a/code/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/code/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -1953,6 +1953,10 @@ void initStructForItemSort(vector&vTemp, sint32 sheetId, sint32 qua vTemp[indexInList].Pos += toString("%03d", quality); + // add sort by name + vTemp[indexInList].Pos += CSheetId(sheetId).toString(); + + // add at last the index in DB. to avoid resort for items that are exaclty the same vTemp[indexInList].Pos += toString("%03d", indexInDB); } @@ -2079,6 +2083,10 @@ bool SBagOptions::canDisplay(CDBCtrlSheet *pCS) const if ((pIS->Family == ITEMFAMILY::MISSION_ITEM) || ((pIS->Family == ITEMFAMILY::RAW_MATERIAL) && !pIS->canBuildSomeItemPart())) if (!bFilterMissMP) bDisplay = false; + + // Jobs Items + if (pIS->Id.toString().substr(0, 6) == "rpjob_") + bDisplay = false; } return bDisplay; } diff --git a/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp b/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp index 0356a11a1..bbd664ad5 100644 --- a/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp +++ b/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp @@ -60,20 +60,26 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet * if( name == "SP_CHG_CHARAC" ) { - ucstring result = CI18N::get("uiItemConsumableEffectChgCharac"); - CHARACTERISTICS::TCharacteristics charac = CHARACTERISTICS::toCharacteristic(params[0]); string characUIId = "uiCaracId" + toString((uint8)charac); - strFindReplace(result, "%charac", CI18N::get(characUIId)); double param1, param2; fromString(params[1].c_str(), param1); fromString(params[2].c_str(), param2); - uint32 bonus = (uint32)(param1 * itemQuality + param2); - strFindReplace(result, "%bonus", toString(bonus)); + sint32 bonus = (uint32)(param1 * itemQuality + param2); uint32 timeInSec; fromString(params[3].c_str(), timeInSec); + + ucstring result; + + if (bonus >= 0) + result = CI18N::get("uiItemConsumableEffectUpCharac"); + else + result = CI18N::get("uiItemConsumableEffectDownCharac"); + + strFindReplace(result, "%charac", CI18N::get(characUIId)); + strFindReplace(result, "%bonus", toString(bonus)); strFindReplace(result, "%minutes", toString(timeInSec/60)); strFindReplace(result, "%secondes", toString(timeInSec%60)); @@ -81,7 +87,83 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet * effects += "\n"; } + if ( name == "SP_LIFE_AURA" ) + { + + uint16 regenMod; + fromString(params[0].c_str(), regenMod); + uint32 duration; + fromString(params[1].c_str(), duration); + uint32 radius; + fromString(params[2].c_str(), radius); + uint32 targetDisableTime; + fromString(params[3].c_str(), targetDisableTime); + uint32 userDisableTime; + fromString(params[4].c_str(), userDisableTime); + ucstring result = CI18N::get("uiItemConsumableEffectLifeAura"); + strFindReplace(result, "%modifier", toString(regenMod)); + strFindReplace(result, "%minutes", toString(duration/60)); + strFindReplace(result, "%secondes", toString(duration%60)); + strFindReplace(result, "%radius", toString(radius)); + strFindReplace(result, "%targetDisableTime", toString(targetDisableTime)); + strFindReplace(result, "%userDisableTime", toString(userDisableTime)); + + effects += result; + effects += "\n"; + } + + if ( name == "SP_STAMINA_AURA" ) + { + + uint16 regenMod; + fromString(params[0].c_str(), regenMod); + uint32 duration; + fromString(params[1].c_str(), duration); + uint32 radius; + fromString(params[2].c_str(), radius); + uint32 targetDisableTime; + fromString(params[3].c_str(), targetDisableTime); + uint32 userDisableTime; + fromString(params[4].c_str(), userDisableTime); + + ucstring result = CI18N::get("uiItemConsumableEffectStaminaAura"); + strFindReplace(result, "%modifier", toString(regenMod)); + strFindReplace(result, "%minutes", toString(duration/60)); + strFindReplace(result, "%secondes", toString(duration%60)); + strFindReplace(result, "%radius", toString(radius)); + strFindReplace(result, "%targetDisableTime", toString(targetDisableTime)); + strFindReplace(result, "%userDisableTime", toString(userDisableTime)); + + effects += result; + effects += "\n"; + } + + if ( name == "SP_SAP_AURA" ) + { + + uint16 regenMod; + fromString(params[0].c_str(), regenMod); + uint32 duration; + fromString(params[1].c_str(), duration); + uint32 radius; + fromString(params[2].c_str(), radius); + uint32 targetDisableTime; + fromString(params[3].c_str(), targetDisableTime); + uint32 userDisableTime; + fromString(params[4].c_str(), userDisableTime); + + ucstring result = CI18N::get("uiItemConsumableEffectSapAura"); + strFindReplace(result, "%modifier", toString(regenMod)); + strFindReplace(result, "%minutes", toString(duration/60)); + strFindReplace(result, "%secondes", toString(duration%60)); + strFindReplace(result, "%radius", toString(radius)); + strFindReplace(result, "%targetDisableTime", toString(targetDisableTime)); + strFindReplace(result, "%userDisableTime", toString(userDisableTime)); + + effects += result; + effects += "\n"; + } // skill modifier consumables //--------------------------- diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index a8dac1ad0..5b68eb419 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -76,6 +76,7 @@ #include "interface_v3/group_map.h" #include "sound_manager.h" #include "interface_v3/group_compas.h" +#include "interface_v3/group_html_webig.h" #include "interface_v3/bar_manager.h" #include "permanent_ban.h" #include "global.h" @@ -702,9 +703,6 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c colorizeSender(finalString, senderName, col); } - // Log - pIM->log (finalString); - // play associated fx if any if( !stringCategory.empty() ) { @@ -764,7 +762,42 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c } else { - PeopleInterraction.ChatInput.AroundMe.displayMessage(finalString, col, 2, &windowVisible); + ucstring::size_type index = finalString.find(ucstring("")); + if (index != ucstring::npos) { + bubbleWanted = false; + finalString = finalString.substr(index+6,finalString.size()); + ucstring::size_type index2 = finalString.find(ucstring(" ")); + ucstring playerName; + if (index2 < (finalString.size()-3)) { + playerName = finalString.substr(0,index2); + finalString = finalString.substr(index2+1,finalString.size()); + } + if (!senderName.empty()) + { + CEntityCL *senderEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(senderName), true, true); + if (senderEntity) { + if (senderEntity->Type != CEntityCL::Player) { + if (playerName.empty()) { + senderEntity->removeStateFx(); + senderEntity->setStateFx(finalString.toString()); + nlinfo("empty"); + } else { + CEntityCL *destEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(playerName), false, true); + if (destEntity) { + destEntity->removeStateFx(); + destEntity->setStateFx(finalString.toString()); + nlinfo("no empty"); + } + } + } + } + } + finalString = ""; + } + else + { + PeopleInterraction.ChatInput.AroundMe.displayMessage(finalString, col, 2, &windowVisible); + } } // if tell, bkup sendername if (mode == CChatGroup::tell && windowVisible && !senderName.empty()) @@ -786,6 +819,10 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c { InSceneBubbleManager.chatOpen(compressedSenderIndex, finalRawMessage, bubbleTimer); } + + // Log + pIM->log (finalString); + } @@ -3101,6 +3138,8 @@ void impulseOutpostDeclareWarAck(NLMISC::CBitMemStream &impulse) node->setValue32(timeStartAttack); } +extern void addWebIGParams (string &url); + //----------------------------------------------- //----------------------------------------------- class CServerMessageBoxOnReceiveTextId : public STRING_MANAGER::IStringWaitCallback @@ -3122,8 +3161,37 @@ private: return; // if the string start with a @{Wxxxx} code, remove it and get the wanted window size - sint w= 256; // default size to 256 !! - if(contentStr.size()>=5 && contentStr[0]=='@' && contentStr[1]=='{' && contentStr[2]=='W') + sint w = 256; // default size to 256 !! + bool is_webig = false; + + if(contentStr.size()>=6 && contentStr[0]=='W' && contentStr[1]=='E' && contentStr[2]=='B' + && contentStr[3]==' ' && contentStr[4]==':' && contentStr[5]==' ' ) + { + ucstring web_app; + uint i; + const uint digitStart= 6; + const uint digitMaxEnd= contentStr.size(); + + is_webig = true; + + for(i = digitStart; i < digitMaxEnd; i++) + { + if(contentStr[i] == ' ') + break; + } + nlinfo("%d", i); + if(i != digitMaxEnd) + web_app = contentStr.substr(digitStart, i-digitStart); + else + { + web_app = ucstring("index"); + i = digitStart; + nlinfo("no app"); + } + contentStr = ucstring("http://atys.ryzom.com/start/")+web_app+ucstring(".php?")+contentStr.substr(i+1); + nlinfo("contentStr = %s", contentStr.toString().c_str()); + } + else if(contentStr.size()>=5 && contentStr[0]=='@' && contentStr[1]=='{' && contentStr[2]=='W') { uint i; const uint digitStart= 3; @@ -3143,9 +3211,26 @@ private: } } - // open the message box window + // open the message box window or web ig + CInterfaceManager *pIM= CInterfaceManager::getInstance(); + + if (is_webig) + { + CGroupHTML *groupHtml = dynamic_cast(pIM->getElementFromId("ui:interface:webig:content:html")); + if (groupHtml) + { + + CGroupContainer *pGC = dynamic_cast(pIM->getElementFromId("ui:interface:webig")); + pGC->setActive(true); + + string url = contentStr.toString(); + addWebIGParams(url); + groupHtml->browse(url.c_str()); + pIM->setTopWindow(pGC); + } + } + else { - CInterfaceManager *pIM= CInterfaceManager::getInstance(); CGroupContainer *pGC = dynamic_cast(pIM->getElementFromId("ui:interface:server_message_box")); if (pGC) {