Added: new rp jobs

This commit is contained in:
vl 2010-07-08 16:05:15 +02:00
parent 23aa72d83b
commit 62eea412f8
5 changed files with 365 additions and 19 deletions

View file

@ -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
@ -1439,6 +1441,7 @@ 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
@ -1446,6 +1449,7 @@ function game:onNewMissionStepAdded(stepIndex)
end
local stringID = getDbProp(dbPath)
if stringID ~= 0 then
-- debugInfo(tostring(stringID))
table.insert(remainingMissionTextIDs, stringID)
setOnDraw(missionWnd, "game:ensureLastMissionStepVisibility0()")
else
@ -1453,6 +1457,7 @@ function game:onNewMissionStepAdded(stepIndex)
end
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

View file

@ -635,6 +635,16 @@
params_r=""
onclick_l=""
params_l="" />
<ctrl style="tab_button_new"
id="tab2"
posparent="tab1"
group="content:rpjobs"
hardtext="uiRpJobs"
onclick_r=""
params_r=""
onclick_l=""
params_l="" />
</group>
<view type="bitmap"
id="sep"
@ -722,8 +732,9 @@
posparent="guild_title"
posref="TR TL"
shadow="true"
color="255 255 255 255"
global_color="true"
color="255 200 55 255"
global_color="false"
x="2"
fontsize="12"
textid="SERVER:GUILD:NAME"
dynamic_string="false" />
@ -1448,7 +1459,41 @@
<view type="text" id="ring_rating_title" posparent="ring_rating" posref="TL BL" x="0" y="0" hardtext="uiR2EDRingRatingTitle" shadow="true" color="255 255 255 255" global_color="false" fontsize="12"/>
-->
</group>
<group h="0" id="rpjobs" posref="TL TL" sizeref="wh" w="0" y="0">
<group h="48" child_resize_hmargin="16" id="rpjobs_advanced" posref="TL TL" sizeref="w" w="-4" x="2" y="-5">
<instance color="255 155 255 255" template="rpjob_title" rpjob_icon="rpjob_advanced.tga" margin_x="0" id="rpjob_advanced_title" text="uiRpJobsAdvanced" posparent="rpjobs_advanced" posref="TL TL" />
<instance inherit_gc_alpha="true" posparent="rpjob_advanced_title" template="inner_thin_border"/>
</group>
<group h="48" child_resize_hmargin="16" active="false" id="rpjob_advanced_1" posparent="rpjobs_advanced" posref="BL TL" sizeref="w" y="-5">
<instance template="rpjob_infos" rpjob_icon="rpjob_advanced.tga" margin_x="20" id="rpjob_advanced_infos_1" w="-20" posparent="rpjobs_advanced_1" posref="TL TL" />
<instance inherit_gc_alpha="true" posparent="rpjob_advanced_infos_1" template="frame_widget" h="48" w="48" />
</group>
<group h="48" child_resize_hmargin="16" active="false" id="rpjob_advanced_2" posparent="rpjob_advanced_1" posref="BL TL" sizeref="w" y="-5">
<instance template="rpjob_infos" rpjob_icon="rpjob_advanced.tga" margin_x="20" id="rpjob_advanced_infos_2" w="-20" posparent="rpjobs_advanced_2" posref="TL TL" />
<instance inherit_gc_alpha="true" posparent="rpjob_advanced_infos_2" template="frame_widget" h="48" w="48" />
</group>
<group h="48" child_resize_hmargin="16" id="rpjobs_elementary" posparent="rpjob_advanced_2" posref="BL TL" sizeref="w" y="-5">
<instance color="155 255 155 255" template="rpjob_title" rpjob_icon="rpjob_elementary.tga" margin_x="0" id="rpjob_elementary_title" text="uiRpJobsElementary" posparent="rpjobs_elementary" posref="TL TL" />
<instance inherit_gc_alpha="true" posparent="rpjob_elementary_title" template="inner_thin_border"/>
</group>
<group h="48" child_resize_hmargin="16" active="false" id="rpjob_elementary_1" posparent="rpjobs_elementary" posref="BL TL" sizeref="w" y="-5">
<instance template="rpjob_infos" rpjob_icon="rpjob_elementary.tga" margin_x="20" id="rpjob_elementary_infos_1" w="-20" posparent="rpjobs_elementary_1" posref="TL TL" />
<instance inherit_gc_alpha="true" posparent="rpjob_elementary_infos_1" template="frame_widget" h="48" w="48" />
</group>
<group h="48" child_resize_hmargin="16" active="false" id="rpjob_elementary_2" posparent="rpjob_elementary_1" posref="BL TL" sizeref="w" y="-5">
<instance template="rpjob_infos" rpjob_icon="rpjob_elementary.tga" margin_x="20" id="rpjob_elementary_infos_2" w="-20" posparent="rpjobs_elementary_2" posref="TL TL" />
<instance inherit_gc_alpha="true" posparent="rpjob_elementary_infos_2" template="frame_widget" h="48" w="48" />
</group>
<group h="48" child_resize_hmargin="16" active="false" id="rpjob_elementary_3" posparent="rpjob_elementary_2" posref="BL TL" sizeref="w" y="-5">
<instance template="rpjob_infos" rpjob_icon="rpjob_elementary.tga" margin_x="20" id="rpjob_elementary_infos_3" w="-20" posparent="rpjobs_elementary_3" posref="TL TL" />
<instance inherit_gc_alpha="true" posparent="rpjob_elementary_infos_3" template="frame_widget" h="48" w="48" />
</group>
</group>
<view color="166 166 166 255" h="1" id="sep" posparent="info_player_skills_tabs" posref="BR BL" scale="true" sizeparent="parent" sizeref="w" texture="blank.tga" type="bitmap" w="0"/>
</group>
</group>
<tree node="info_player_skills" />
<!--***********-->
@ -3232,6 +3277,7 @@
action="lua:game:onMissionJournalOpened()" />
<link expr="depends(@SERVER:USER:IS_TRIAL)"
action="lua:game:onMissionJournalOpened()" />
<link expr="depends(@LOCAL:INVENTORY:BAG)" action="lua:game:getRPJobs()" />
<!--***********************-->
<!--* POPUP MESSAGES *-->
<!--***********************-->
@ -3350,7 +3396,38 @@
shadow="true"
color="255 0 0 255" />
</group>
<!--***********************-->
<!--* RPJOB TEMPLATES *-->
<!--***********************-->
</template>
<template h="48" id="" name="rpjob_title" posparent="parent" posref="TL TL" sizeref="w" suffix="" text="" tooltip="" val="" w="0" x="0" y="0">
<group h="#h" id="#id" posparent="#posparent" posref="#posref" sizeref="#sizeref" w="#w" x="#margin_x" y="#y">
<view global_color="false" id="icon" posref="TL TL" texture="#rpjob_icon" type="bitmap" x="4" y="-4"/>
<view color="#color" fontsize="16" hardtext="#text" id="t" posref="MR ML" posparent="icon" shadow="true" type="text" x="5"/>
</group>
</template>
<template h="48" id="" name="rpjob_infos" posparent="parent" posref="TL TL" sizeref="w" suffix="" text="" tooltip="" val="" w="0" x="0" y="0">
<group h="#h" id="#id" posparent="#posparent" posref="#posref" sizeref="#sizeref" w="#w" x="#margin_x" y="#y">
<view color="0 0 0 255" h="48" w="48" scale="true" global_color="false" id="bg" posref="TL TL" parent="#id" texture="blank.tga" type="bitmap"/>
<view global_color="false" id="icon" posref="TL TL" texture="#rpjob_icon" type="bitmap" x="4" y="-4"/>
<view global_color="false" color="255 255 255 255" fontsize="13" id="t" posref="TR TL" posparent="icon" shadow="true" w="#w" type="text" x="10"/>
<group h="20" id="bar3d" posref="BR BL" posparent="icon" sizeref="w" w="340" x="8" y="0">
<instance inherit_gc_alpha="true" posref="BL BL" y="1" w="370" x="5" template="frame_widget" h="18"/>
<view color="0 0 0 255" h="16" id="bar" posparent="bar3d" posref="BL BL" scale="true" texture="blank.tga" type="bitmap" w="368" x="5" y="2"/>
<view h="16" id="level" posparent="bar3d" posref="BL BL" scale="true" texture="blank.tga" type="bitmap" w="368" x="5" y="2"/>
<view global_color="false" fontsize="12" hardtext="" id="t" posref="MM MM" posparent="bar" shadow="false" w="#w" type="text" y="-2"/>
</group>
<view global_color="false" color="255 255 155 255" fontsize="11" hardtext="" id="echelon_value" posref="TR TR" posparent="bar3d" shadow="true" w="#w" type="text" x="-5" y="20"/>
<view fontsize="11" hardtext="Echelon : " id="echelon" posref="TL TR" posparent="echelon_value" shadow="true" w="#w" type="text" x="2"/>
</group>
</template>
<!--***********************-->
<!--* NPC WEB PAGE *-->
<!--***********************-->

View file

@ -1953,6 +1953,10 @@ void initStructForItemSort(vector<SSortStruct>&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;
}

View file

@ -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
//---------------------------

View file

@ -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("<BPFX>"));
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<CGroupHTML*>(pIM->getElementFromId("ui:interface:webig:content:html"));
if (groupHtml)
{
CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(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<CGroupContainer*>(pIM->getElementFromId("ui:interface:server_message_box"));
if (pGC)
{