Fixed: Add unlearn_brick command for missions (a big thanks to Depyraken for the patch!)

This commit is contained in:
kervala 2016-02-21 17:05:54 +01:00
parent f162b13417
commit cc4eab2c86
2 changed files with 69 additions and 1 deletions

View file

@ -688,6 +688,7 @@
<DYNAMIC_CHILD CLASS_NAME="recv_named_item"/> <DYNAMIC_CHILD CLASS_NAME="recv_named_item"/>
<DYNAMIC_CHILD CLASS_NAME="recv_xp"/> <DYNAMIC_CHILD CLASS_NAME="recv_xp"/>
<DYNAMIC_CHILD CLASS_NAME="destroy_item"/> <DYNAMIC_CHILD CLASS_NAME="destroy_item"/>
<DYNAMIC_CHILD CLASS_NAME="unlearn_brick"/>
</PRIMITIVE> </PRIMITIVE>
@ -1026,7 +1027,13 @@
<PARAMETER NAME="item/quantity/quality" TYPE="string_array" VISIBLE="true"/> <PARAMETER NAME="item/quantity/quality" TYPE="string_array" VISIBLE="true"/>
<PARAMETER NAME="guild" TYPE="boolean" VISIBLE="true" /> <PARAMETER NAME="guild" TYPE="boolean" VISIBLE="true" />
</PRIMITIVE> </PRIMITIVE>
<PRIMITIVE CLASS_NAME="unlearn_brick" TYPE="node" AUTO_INIT="false" DELETABLE="true" NUMBERIZE="false">
<PARAMETER NAME="name" TYPE="string" VISIBLE="true" AUTONAME="unlearn_brick $action$"/>
<PARAMETER NAME="bricks" TYPE="string_array" VISIBLE="true"/>
<PARAMETER NAME="npc_name" TYPE="string" VISIBLE="true"/>
<PARAMETER NAME="group" TYPE="boolean" VISIBLE="true"/>
</PRIMITIVE>
<!-- Fin actions --> <!-- Fin actions -->
<!-- *************************************** --> <!-- *************************************** -->
@ -1099,6 +1106,7 @@
<DYNAMIC_CHILD CLASS_NAME="recv_named_item"/> <DYNAMIC_CHILD CLASS_NAME="recv_named_item"/>
<DYNAMIC_CHILD CLASS_NAME="recv_xp"/> <DYNAMIC_CHILD CLASS_NAME="recv_xp"/>
<DYNAMIC_CHILD CLASS_NAME="destroy_item"/> <DYNAMIC_CHILD CLASS_NAME="destroy_item"/>
<DYNAMIC_CHILD CLASS_NAME="unlearn_brick"/>
</PRIMITIVE> </PRIMITIVE>
<PRIMITIVE CLASS_NAME="kill" TYPE="node" PARENT_CLASS="objective_parent"> <PRIMITIVE CLASS_NAME="kill" TYPE="node" PARENT_CLASS="objective_parent">

View file

@ -1139,6 +1139,66 @@ public:
}; };
REGISTER_STEP_CONTENT(CActionLearnBrick, "learn_brick"); REGISTER_STEP_CONTENT(CActionLearnBrick, "learn_brick");
// ---------------------------------------------------------------------------
class CActionUnlearnBrick : public IStepContent
{
string _BotGiver;
vector<string> _Bricks;
bool _Group;
void getPredefParam(uint32 &numEntry, CPhrase::TPredefParams &predef)
{
numEntry = 0;
}
public:
void init(CMissionData &md, IPrimitive *prim)
{
_BotGiver = md.getProperty(prim, "npc_name", true, false);
vector<string> vs;
vs = md.getPropertyArray(prim, "bricks", true, false);
for (uint i=0; i<vs.size(); ++i)
{
if (!vs[i].empty())
_Bricks.push_back(vs[i]);
}
string s;
s = md.getProperty(prim, "group", true, false);
_Group = (NLMISC::toLower(s) == "true");
IStepContent::init(md, prim);
}
string genCode(CMissionData &md)
{
string ret;
// if (_Bricks.empty())
// return ret;
ret = "unlearn_brick : ";
for (uint i=0; i<_Bricks.size(); ++i)
{
ret += _Bricks[i];
if (i < _Bricks.size()-1)
ret += "; ";
}
if (!_BotGiver.empty())
ret += " : "+_BotGiver;
if (_Group)
ret += " : group";
ret += NL;
return ret;
}
};
REGISTER_STEP_CONTENT(CActionUnlearnBrick, "unlearn_brick");
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
class CActionBotChat : public IStepContent class CActionBotChat : public IStepContent
{ {