|
@@ -83,43 +83,41 @@ XPBasedLevelUpRuleFactory::XPBasedLevelUpRuleFactory()
|
|
: SubTypeFactory()
|
|
: SubTypeFactory()
|
|
{}
|
|
{}
|
|
|
|
|
|
-XPBasedLevelUpRule* XPBasedLevelUpRuleFactory::createValue(
|
|
|
|
|
|
+XPBasedLevelUpRule* XPBasedLevelUpRuleFactory::fromJson(
|
|
Framework::JSON::JSONObject* zJson) const
|
|
Framework::JSON::JSONObject* zJson) const
|
|
{
|
|
{
|
|
- return new XPBasedLevelUpRule();
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-void XPBasedLevelUpRuleFactory::fromJson(
|
|
|
|
- XPBasedLevelUpRule* zResult, Framework::JSON::JSONObject* zJson) const
|
|
|
|
-{
|
|
|
|
|
|
+ XPBasedLevelUpRule* result = new XPBasedLevelUpRule();
|
|
if (zJson->hasValue("maxLevel"))
|
|
if (zJson->hasValue("maxLevel"))
|
|
{
|
|
{
|
|
- zResult->setMaxLevel(
|
|
|
|
|
|
+ result->setMaxLevel(
|
|
(float)zJson->zValue("maxLevel")->asNumber()->getNumber());
|
|
(float)zJson->zValue("maxLevel")->asNumber()->getNumber());
|
|
}
|
|
}
|
|
- zResult->setXpIncrease(
|
|
|
|
|
|
+ result->setXpIncrease(
|
|
(float)zJson->zValue("xpIncrease")->asNumber()->getNumber());
|
|
(float)zJson->zValue("xpIncrease")->asNumber()->getNumber());
|
|
- zResult->setXpMultiplier(
|
|
|
|
|
|
+ result->setXpMultiplier(
|
|
(float)zJson->zValue("xpMultiplier")->asNumber()->getNumber());
|
|
(float)zJson->zValue("xpMultiplier")->asNumber()->getNumber());
|
|
- zResult->setLevelIncrease(
|
|
|
|
|
|
+ result->setLevelIncrease(
|
|
(float)zJson->zValue("levelIncrease")->asNumber()->getNumber());
|
|
(float)zJson->zValue("levelIncrease")->asNumber()->getNumber());
|
|
- zResult->setLevelMultiplier(
|
|
|
|
|
|
+ result->setLevelMultiplier(
|
|
(float)zJson->zValue("levelMultiplier")->asNumber()->getNumber());
|
|
(float)zJson->zValue("levelMultiplier")->asNumber()->getNumber());
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
-void XPBasedLevelUpRuleFactory::toJson(
|
|
|
|
- XPBasedLevelUpRule* zObject, Framework::JSON::JSONObject* zResult) const
|
|
|
|
|
|
+Framework::JSON::JSONObject* XPBasedLevelUpRuleFactory::toJsonObject(
|
|
|
|
+ XPBasedLevelUpRule* zObject) const
|
|
{
|
|
{
|
|
- zResult->addValue("xpIncrease",
|
|
|
|
|
|
+ Framework::JSON::JSONObject* result = new Framework::JSON::JSONObject();
|
|
|
|
+ result->addValue("xpIncrease",
|
|
new Framework::JSON::JSONNumber(zObject->getXpIncrease()));
|
|
new Framework::JSON::JSONNumber(zObject->getXpIncrease()));
|
|
- zResult->addValue("xpMultiplier",
|
|
|
|
|
|
+ result->addValue("xpMultiplier",
|
|
new Framework::JSON::JSONNumber(zObject->getXpMultiplier()));
|
|
new Framework::JSON::JSONNumber(zObject->getXpMultiplier()));
|
|
- zResult->addValue("levelIncrease",
|
|
|
|
|
|
+ result->addValue("levelIncrease",
|
|
new Framework::JSON::JSONNumber(zObject->getLevelIncrease()));
|
|
new Framework::JSON::JSONNumber(zObject->getLevelIncrease()));
|
|
- zResult->addValue("levelMultiplier",
|
|
|
|
|
|
+ result->addValue("levelMultiplier",
|
|
new Framework::JSON::JSONNumber(zObject->getLevelMultiplier()));
|
|
new Framework::JSON::JSONNumber(zObject->getLevelMultiplier()));
|
|
- zResult->addValue(
|
|
|
|
|
|
+ result->addValue(
|
|
"maxLevel", new Framework::JSON::JSONNumber(zObject->getMaxLevel()));
|
|
"maxLevel", new Framework::JSON::JSONNumber(zObject->getMaxLevel()));
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
JSONObjectValidationBuilder* XPBasedLevelUpRuleFactory::addToValidator(
|
|
JSONObjectValidationBuilder* XPBasedLevelUpRuleFactory::addToValidator(
|
|
@@ -146,7 +144,7 @@ JSONObjectValidationBuilder* XPBasedLevelUpRuleFactory::addToValidator(
|
|
->finishNumber();
|
|
->finishNumber();
|
|
}
|
|
}
|
|
|
|
|
|
-Framework::Text XPBasedLevelUpRuleFactory::getTypeToken() const
|
|
|
|
|
|
+const char* XPBasedLevelUpRuleFactory::getTypeToken() const
|
|
{
|
|
{
|
|
return "xpBased";
|
|
return "xpBased";
|
|
}
|
|
}
|
|
@@ -290,17 +288,17 @@ void BasicToolItemType::setItemAttribute(
|
|
{
|
|
{
|
|
BasicToolItem* item = dynamic_cast<BasicToolItem*>(zItem);
|
|
BasicToolItem* item = dynamic_cast<BasicToolItem*>(zItem);
|
|
if (name.istGleich("headMaterialHardness")
|
|
if (name.istGleich("headMaterialHardness")
|
|
- && zValue->getType() == Framework::JSON::JSONType::NUMBER)
|
|
|
|
|
|
+ && zValue->getType() == Framework::AbstractType::NUMBER)
|
|
{
|
|
{
|
|
item->setHeadMaterialHardness((float)zValue->asNumber()->getNumber());
|
|
item->setHeadMaterialHardness((float)zValue->asNumber()->getNumber());
|
|
}
|
|
}
|
|
else if (name.istGleich("rodMaterialHardness")
|
|
else if (name.istGleich("rodMaterialHardness")
|
|
- && zValue->getType() == Framework::JSON::JSONType::NUMBER)
|
|
|
|
|
|
+ && zValue->getType() == Framework::AbstractType::NUMBER)
|
|
{
|
|
{
|
|
item->setRodMaterialHardness((float)zValue->asNumber()->getNumber());
|
|
item->setRodMaterialHardness((float)zValue->asNumber()->getNumber());
|
|
}
|
|
}
|
|
else if (name.istGleich("handleMaterialHardness")
|
|
else if (name.istGleich("handleMaterialHardness")
|
|
- && zValue->getType() == Framework::JSON::JSONType::NUMBER)
|
|
|
|
|
|
+ && zValue->getType() == Framework::AbstractType::NUMBER)
|
|
{
|
|
{
|
|
item->setHandleMaterialHardness((float)zValue->asNumber()->getNumber());
|
|
item->setHandleMaterialHardness((float)zValue->asNumber()->getNumber());
|
|
}
|
|
}
|
|
@@ -494,90 +492,93 @@ BasicToolItemType* BasicToolItemTypeFactory::createValue(
|
|
return new BasicToolItemType();
|
|
return new BasicToolItemType();
|
|
}
|
|
}
|
|
|
|
|
|
-void BasicToolItemTypeFactory::fromJson(
|
|
|
|
- BasicToolItemType* zResult, Framework::JSON::JSONObject* zJson) const
|
|
|
|
|
|
+BasicToolItemType* BasicToolItemTypeFactory::fromJson(
|
|
|
|
+ Framework::JSON::JSONObject* zJson) const
|
|
{
|
|
{
|
|
- zResult->setHandleMaterialHardness(
|
|
|
|
|
|
+ BasicToolItemType* result = ItemTypeFactoryBase::fromJson(zJson);
|
|
|
|
+ result->setHandleMaterialHardness(
|
|
(float)zJson->zValue("headMaterialHardness")->asNumber()->getNumber());
|
|
(float)zJson->zValue("headMaterialHardness")->asNumber()->getNumber());
|
|
- zResult->setRodMaterialHardness(
|
|
|
|
|
|
+ result->setRodMaterialHardness(
|
|
(float)zJson->zValue("rodMaterialHardness")->asNumber()->getNumber());
|
|
(float)zJson->zValue("rodMaterialHardness")->asNumber()->getNumber());
|
|
- zResult->setHandleMaterialHardness(
|
|
|
|
|
|
+ result->setHandleMaterialHardness(
|
|
(float)zJson->zValue("handleMaterialHardness")
|
|
(float)zJson->zValue("handleMaterialHardness")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setBaseDurability(
|
|
|
|
|
|
+ result->setBaseDurability(
|
|
(float)zJson->zValue("baseDurability")->asNumber()->getNumber());
|
|
(float)zJson->zValue("baseDurability")->asNumber()->getNumber());
|
|
- zResult->setBaseDurabilityMultiplier(
|
|
|
|
|
|
+ result->setBaseDurabilityMultiplier(
|
|
(float)zJson->zValue("baseDurabilityMultiplier")
|
|
(float)zJson->zValue("baseDurabilityMultiplier")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setHeadMaterialDurability(
|
|
|
|
|
|
+ result->setHeadMaterialDurability(
|
|
(float)zJson->zValue("headMaterialDurability")
|
|
(float)zJson->zValue("headMaterialDurability")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setHeadMaterialDurabilityMultiplier(
|
|
|
|
|
|
+ result->setHeadMaterialDurabilityMultiplier(
|
|
(float)zJson->zValue("headMaterialDurabilityMultiplier")
|
|
(float)zJson->zValue("headMaterialDurabilityMultiplier")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setRodMaterialDurability(
|
|
|
|
|
|
+ result->setRodMaterialDurability(
|
|
(float)zJson->zValue("rodMaterialDurability")->asNumber()->getNumber());
|
|
(float)zJson->zValue("rodMaterialDurability")->asNumber()->getNumber());
|
|
- zResult->setRodMaterialDurabilityMultiplier(
|
|
|
|
|
|
+ result->setRodMaterialDurabilityMultiplier(
|
|
(float)zJson->zValue("rodMaterialDurabilityMultiplier")
|
|
(float)zJson->zValue("rodMaterialDurabilityMultiplier")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setHandleMaterialDurability(
|
|
|
|
|
|
+ result->setHandleMaterialDurability(
|
|
(float)zJson->zValue("handleMaterialDurability")
|
|
(float)zJson->zValue("handleMaterialDurability")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setHandleMaterialDurabilityMultiplier(
|
|
|
|
|
|
+ result->setHandleMaterialDurabilityMultiplier(
|
|
(float)zJson->zValue("handleMaterialDurabilityMultiplier")
|
|
(float)zJson->zValue("handleMaterialDurabilityMultiplier")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setLevelUpRule(
|
|
|
|
|
|
+ result->setLevelUpRule(
|
|
Game::INSTANCE->zTypeRegistry()->fromJson<ItemSkillLevelUpRule>(
|
|
Game::INSTANCE->zTypeRegistry()->fromJson<ItemSkillLevelUpRule>(
|
|
zJson->zValue("levelUpRule")));
|
|
zJson->zValue("levelUpRule")));
|
|
- zResult->setBrokenItemTypeName(
|
|
|
|
|
|
+ result->setBrokenItemTypeName(
|
|
zJson->zValue("brokenItemTypeName")->asString()->getString());
|
|
zJson->zValue("brokenItemTypeName")->asString()->getString());
|
|
- zResult->setItemSkillConfigJson(zJson->getValue("itemSkill")->asObject());
|
|
|
|
- ItemTypeFactoryBase::fromJson(zResult, zJson);
|
|
|
|
|
|
+ result->setItemSkillConfigJson(zJson->getValue("itemSkill")->asObject());
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
-void BasicToolItemTypeFactory::toJson(
|
|
|
|
- BasicToolItemType* zObject, Framework::JSON::JSONObject* zResult) const
|
|
|
|
|
|
+Framework::JSON::JSONObject* BasicToolItemTypeFactory::toJsonObject(
|
|
|
|
+ BasicToolItemType* zObject) const
|
|
{
|
|
{
|
|
- zResult->addValue("headMaterialHardness",
|
|
|
|
|
|
+ Framework::JSON::JSONObject* result
|
|
|
|
+ = ItemTypeFactoryBase::toJsonObject(zObject);
|
|
|
|
+ result->addValue("headMaterialHardness",
|
|
new Framework::JSON::JSONNumber(zObject->getHeadMaterialHardness()));
|
|
new Framework::JSON::JSONNumber(zObject->getHeadMaterialHardness()));
|
|
- zResult->addValue("rodMaterialHardness",
|
|
|
|
|
|
+ result->addValue("rodMaterialHardness",
|
|
new Framework::JSON::JSONNumber(zObject->getRodMaterialHardness()));
|
|
new Framework::JSON::JSONNumber(zObject->getRodMaterialHardness()));
|
|
- zResult->addValue("handleMaterialHardness",
|
|
|
|
|
|
+ result->addValue("handleMaterialHardness",
|
|
new Framework::JSON::JSONNumber(zObject->getHandleMaterialHardness()));
|
|
new Framework::JSON::JSONNumber(zObject->getHandleMaterialHardness()));
|
|
- zResult->addValue("baseDurability",
|
|
|
|
|
|
+ result->addValue("baseDurability",
|
|
new Framework::JSON::JSONNumber(zObject->getBaseDurablility()));
|
|
new Framework::JSON::JSONNumber(zObject->getBaseDurablility()));
|
|
- zResult->addValue("baseDurabilityMultiplier",
|
|
|
|
|
|
+ result->addValue("baseDurabilityMultiplier",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->getBaseDurabilityMultiplier()));
|
|
zObject->getBaseDurabilityMultiplier()));
|
|
- zResult->addValue("headMaterialDurability",
|
|
|
|
|
|
+ result->addValue("headMaterialDurability",
|
|
new Framework::JSON::JSONNumber(zObject->getHeadMaterialDurability()));
|
|
new Framework::JSON::JSONNumber(zObject->getHeadMaterialDurability()));
|
|
- zResult->addValue("headMaterialDurabilityMultiplier",
|
|
|
|
|
|
+ result->addValue("headMaterialDurabilityMultiplier",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->getHeadMaterialDurabilityMultiplier()));
|
|
zObject->getHeadMaterialDurabilityMultiplier()));
|
|
- zResult->addValue("rodMaterialDurability",
|
|
|
|
|
|
+ result->addValue("rodMaterialDurability",
|
|
new Framework::JSON::JSONNumber(zObject->getRodMaterialDurability()));
|
|
new Framework::JSON::JSONNumber(zObject->getRodMaterialDurability()));
|
|
- zResult->addValue("rodMaterialDurabilityMultiplier",
|
|
|
|
|
|
+ result->addValue("rodMaterialDurabilityMultiplier",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->getRodMaterialDurabilityMultiplier()));
|
|
zObject->getRodMaterialDurabilityMultiplier()));
|
|
- zResult->addValue("handleMaterialDurability",
|
|
|
|
|
|
+ result->addValue("handleMaterialDurability",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->getHandleMaterialDurability()));
|
|
zObject->getHandleMaterialDurability()));
|
|
- zResult->addValue("handleMaterialDurabilityMultiplier",
|
|
|
|
|
|
+ result->addValue("handleMaterialDurabilityMultiplier",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->getHandleMaterialDurabilityMultiplier()));
|
|
zObject->getHandleMaterialDurabilityMultiplier()));
|
|
- zResult->addValue("levelUpRule",
|
|
|
|
|
|
+ result->addValue("levelUpRule",
|
|
Game::INSTANCE->zTypeRegistry()->toJson(zObject->zLevelUpRule()));
|
|
Game::INSTANCE->zTypeRegistry()->toJson(zObject->zLevelUpRule()));
|
|
- zResult->addValue("brokenItemTypeName",
|
|
|
|
|
|
+ result->addValue("brokenItemTypeName",
|
|
new Framework::JSON::JSONString(zObject->zBrokenItemType()->getName()));
|
|
new Framework::JSON::JSONString(zObject->zBrokenItemType()->getName()));
|
|
- zResult->addValue("itemSkill", zObject->getItemSkillConfigJson());
|
|
|
|
- ItemTypeFactoryBase::toJson(zObject, zResult);
|
|
|
|
|
|
+ result->addValue("itemSkill", zObject->getItemSkillConfigJson());
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
JSONObjectValidationBuilder* BasicToolItemTypeFactory::addToValidator(
|
|
JSONObjectValidationBuilder* BasicToolItemTypeFactory::addToValidator(
|
|
@@ -637,7 +638,7 @@ JSONObjectValidationBuilder* BasicToolItemTypeFactory::addToValidator(
|
|
Game::INSTANCE->zTypeRegistry()->getValidator<ItemSkill>()));
|
|
Game::INSTANCE->zTypeRegistry()->getValidator<ItemSkill>()));
|
|
}
|
|
}
|
|
|
|
|
|
-Framework::Text BasicToolItemTypeFactory::getTypeToken() const
|
|
|
|
|
|
+const char* BasicToolItemTypeFactory::getTypeToken() const
|
|
{
|
|
{
|
|
return "tool";
|
|
return "tool";
|
|
}
|
|
}
|
|
@@ -772,93 +773,89 @@ float BlockReplaceItemSkillConfig::getXpGain() const
|
|
}
|
|
}
|
|
|
|
|
|
BlockReplaceItemSkillConfigFactory::BlockReplaceItemSkillConfigFactory()
|
|
BlockReplaceItemSkillConfigFactory::BlockReplaceItemSkillConfigFactory()
|
|
- : TypeFactory()
|
|
|
|
|
|
+ : ObjectTypeFactory()
|
|
{}
|
|
{}
|
|
|
|
|
|
-BlockReplaceItemSkillConfig* BlockReplaceItemSkillConfigFactory::createValue(
|
|
|
|
- Framework::JSON::JSONObject* zJson) const
|
|
|
|
-{
|
|
|
|
- return new BlockReplaceItemSkillConfig();
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-void BlockReplaceItemSkillConfigFactory::fromJson(
|
|
|
|
- BlockReplaceItemSkillConfig* zResult,
|
|
|
|
|
|
+BlockReplaceItemSkillConfig* BlockReplaceItemSkillConfigFactory::fromJson(
|
|
Framework::JSON::JSONObject* zJson) const
|
|
Framework::JSON::JSONObject* zJson) const
|
|
{
|
|
{
|
|
- zResult->setTargetBlockFilter(
|
|
|
|
|
|
+ BlockReplaceItemSkillConfig* result = new BlockReplaceItemSkillConfig();
|
|
|
|
+ result->setTargetBlockFilter(
|
|
Game::INSTANCE->zTypeRegistry()->fromJson<BlockFilter>(
|
|
Game::INSTANCE->zTypeRegistry()->fromJson<BlockFilter>(
|
|
zJson->asObject()->zValue("targetFilter")));
|
|
zJson->asObject()->zValue("targetFilter")));
|
|
- zResult->setCooldownTicks((int)zJson->asObject()
|
|
|
|
- ->zValue("cooldownTicks")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
- zResult->setReplacementBlockTypeId(
|
|
|
|
|
|
+ result->setCooldownTicks((int)zJson->asObject()
|
|
|
|
+ ->zValue("cooldownTicks")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ result->setReplacementBlockTypeId(
|
|
Game::INSTANCE->getBlockTypeId(zJson->asObject()
|
|
Game::INSTANCE->getBlockTypeId(zJson->asObject()
|
|
->zValue("replacementBlockType")
|
|
->zValue("replacementBlockType")
|
|
->asString()
|
|
->asString()
|
|
->getString()));
|
|
->getString()));
|
|
- zResult->setCooldownTicks((int)zJson->asObject()
|
|
|
|
- ->zValue("cooldownTicks")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
- zResult->setStaminaCost((float)zJson->asObject()
|
|
|
|
- ->zValue("staminaCost")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
- zResult->setStaminaCostDevider((float)zJson->asObject()
|
|
|
|
- ->zValue("staminaCostDevider")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
- zResult->setAdditionalStaminaCostDeviderPerLevel(
|
|
|
|
|
|
+ result->setCooldownTicks((int)zJson->asObject()
|
|
|
|
+ ->zValue("cooldownTicks")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ result->setStaminaCost((float)zJson->asObject()
|
|
|
|
+ ->zValue("staminaCost")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ result->setStaminaCostDevider((float)zJson->asObject()
|
|
|
|
+ ->zValue("staminaCostDevider")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ result->setAdditionalStaminaCostDeviderPerLevel(
|
|
(float)zJson->asObject()
|
|
(float)zJson->asObject()
|
|
->zValue("additionalStaminaCostDeviderPerLevel")
|
|
->zValue("additionalStaminaCostDeviderPerLevel")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setDurabilityCost((float)zJson->asObject()
|
|
|
|
- ->zValue("durabilityCost")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
- zResult->setDurabilityCostDevider((float)zJson->asObject()
|
|
|
|
- ->zValue("durabilityCostDevider")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
- zResult->setAdditionalDurabilityCostDeviderPerLevel(
|
|
|
|
|
|
+ result->setDurabilityCost((float)zJson->asObject()
|
|
|
|
+ ->zValue("durabilityCost")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ result->setDurabilityCostDevider((float)zJson->asObject()
|
|
|
|
+ ->zValue("durabilityCostDevider")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ result->setAdditionalDurabilityCostDeviderPerLevel(
|
|
(float)zJson->asObject()
|
|
(float)zJson->asObject()
|
|
->zValue("additionalDurabilityCostDeviderPerLevel")
|
|
->zValue("additionalDurabilityCostDeviderPerLevel")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setXpGain(
|
|
|
|
|
|
+ result->setXpGain(
|
|
(float)zJson->asObject()->zValue("xpGain")->asNumber()->getNumber());
|
|
(float)zJson->asObject()->zValue("xpGain")->asNumber()->getNumber());
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
-void BlockReplaceItemSkillConfigFactory::toJson(
|
|
|
|
- BlockReplaceItemSkillConfig* zObject,
|
|
|
|
- Framework::JSON::JSONObject* zResult) const
|
|
|
|
|
|
+Framework::JSON::JSONObject* BlockReplaceItemSkillConfigFactory::toJsonObject(
|
|
|
|
+ BlockReplaceItemSkillConfig* zObject) const
|
|
{
|
|
{
|
|
- zResult->addValue("targetFilter",
|
|
|
|
|
|
+ Framework::JSON::JSONObject* result = new Framework::JSON::JSONObject();
|
|
|
|
+ result->addValue("targetFilter",
|
|
Game::INSTANCE->zTypeRegistry()->toJson(zObject->zTargetBlockFilter()));
|
|
Game::INSTANCE->zTypeRegistry()->toJson(zObject->zTargetBlockFilter()));
|
|
- zResult->addValue("replacementBlockType",
|
|
|
|
|
|
+ result->addValue("replacementBlockType",
|
|
new Framework::JSON::JSONString(
|
|
new Framework::JSON::JSONString(
|
|
Game::INSTANCE->zBlockType(zObject->getReplacementBlockTypeId())
|
|
Game::INSTANCE->zBlockType(zObject->getReplacementBlockTypeId())
|
|
->getName()));
|
|
->getName()));
|
|
- zResult->addValue("cooldownTicks",
|
|
|
|
|
|
+ result->addValue("cooldownTicks",
|
|
new Framework::JSON::JSONNumber(zObject->getCooldownTicks()));
|
|
new Framework::JSON::JSONNumber(zObject->getCooldownTicks()));
|
|
- zResult->addValue("staminaCost",
|
|
|
|
|
|
+ result->addValue("staminaCost",
|
|
new Framework::JSON::JSONNumber(zObject->getStaminaCost()));
|
|
new Framework::JSON::JSONNumber(zObject->getStaminaCost()));
|
|
- zResult->addValue("staminaCostDevider",
|
|
|
|
|
|
+ result->addValue("staminaCostDevider",
|
|
new Framework::JSON::JSONNumber(zObject->getStaminaCostDevider()));
|
|
new Framework::JSON::JSONNumber(zObject->getStaminaCostDevider()));
|
|
- zResult->addValue("additionalStaminaCostDeviderPerLevel",
|
|
|
|
|
|
+ result->addValue("additionalStaminaCostDeviderPerLevel",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->getAdditionalStaminaCostDeviderPerLevel()));
|
|
zObject->getAdditionalStaminaCostDeviderPerLevel()));
|
|
- zResult->addValue("durabilityCost",
|
|
|
|
|
|
+ result->addValue("durabilityCost",
|
|
new Framework::JSON::JSONNumber(zObject->getDurabilityCost()));
|
|
new Framework::JSON::JSONNumber(zObject->getDurabilityCost()));
|
|
- zResult->addValue("durabilityCostDevider",
|
|
|
|
|
|
+ result->addValue("durabilityCostDevider",
|
|
new Framework::JSON::JSONNumber(zObject->getDurabilityCostDevider()));
|
|
new Framework::JSON::JSONNumber(zObject->getDurabilityCostDevider()));
|
|
- zResult->addValue("additionalDurabilityCostDeviderPerLevel",
|
|
|
|
|
|
+ result->addValue("additionalDurabilityCostDeviderPerLevel",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->getAdditionalDurabilityCostDeviderPerLevel()));
|
|
zObject->getAdditionalDurabilityCostDeviderPerLevel()));
|
|
- zResult->addValue(
|
|
|
|
|
|
+ result->addValue(
|
|
"xpGain", new Framework::JSON::JSONNumber(zObject->getXpGain()));
|
|
"xpGain", new Framework::JSON::JSONNumber(zObject->getXpGain()));
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
JSONObjectValidationBuilder* BlockReplaceItemSkillConfigFactory::addToValidator(
|
|
JSONObjectValidationBuilder* BlockReplaceItemSkillConfigFactory::addToValidator(
|
|
@@ -1034,9 +1031,10 @@ BlockReplaceItemSkill* BlockReplaceItemSkillFactory::createValue(
|
|
return new BlockReplaceItemSkill();
|
|
return new BlockReplaceItemSkill();
|
|
}
|
|
}
|
|
|
|
|
|
-void BlockReplaceItemSkillFactory::fromJson(
|
|
|
|
- BlockReplaceItemSkill* zResult, Framework::JSON::JSONObject* zJson) const
|
|
|
|
|
|
+BlockReplaceItemSkill* BlockReplaceItemSkillFactory::fromJson(
|
|
|
|
+ Framework::JSON::JSONObject* zJson) const
|
|
{
|
|
{
|
|
|
|
+ BlockReplaceItemSkill* result = ItemSkillFactoryBase::fromJson(zJson);
|
|
BlockReplaceItemSkillConfig* invalidUseConfig
|
|
BlockReplaceItemSkillConfig* invalidUseConfig
|
|
= new BlockReplaceItemSkillConfig();
|
|
= new BlockReplaceItemSkillConfig();
|
|
invalidUseConfig->setStaminaCost(
|
|
invalidUseConfig->setStaminaCost(
|
|
@@ -1062,41 +1060,43 @@ void BlockReplaceItemSkillFactory::fromJson(
|
|
invalidUseConfig->setCooldownTicks(
|
|
invalidUseConfig->setCooldownTicks(
|
|
(int)zJson->zValue("invalidCooldownTicks")->asNumber()->getNumber());
|
|
(int)zJson->zValue("invalidCooldownTicks")->asNumber()->getNumber());
|
|
invalidUseConfig->setXpGain(0.f);
|
|
invalidUseConfig->setXpGain(0.f);
|
|
- zResult->setInvalidUseConfig(invalidUseConfig);
|
|
|
|
|
|
+ result->setInvalidUseConfig(invalidUseConfig);
|
|
Framework::RCArray<BlockReplaceItemSkillConfig> configs;
|
|
Framework::RCArray<BlockReplaceItemSkillConfig> configs;
|
|
for (Framework::JSON::JSONValue* value :
|
|
for (Framework::JSON::JSONValue* value :
|
|
*zJson->zValue("configs")->asArray())
|
|
*zJson->zValue("configs")->asArray())
|
|
{
|
|
{
|
|
- zResult->addConfig(Game::INSTANCE->zTypeRegistry()
|
|
|
|
- ->fromJson<BlockReplaceItemSkillConfig>(value));
|
|
|
|
|
|
+ result->addConfig(Game::INSTANCE->zTypeRegistry()
|
|
|
|
+ ->fromJson<BlockReplaceItemSkillConfig>(value));
|
|
}
|
|
}
|
|
- ItemSkillFactoryBase::fromJson(zResult, zJson);
|
|
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
-void BlockReplaceItemSkillFactory::toJson(
|
|
|
|
- BlockReplaceItemSkill* zObject, Framework::JSON::JSONObject* zResult) const
|
|
|
|
|
|
+Framework::JSON::JSONObject* BlockReplaceItemSkillFactory::toJsonObject(
|
|
|
|
+ BlockReplaceItemSkill* zObject) const
|
|
{
|
|
{
|
|
- zResult->addValue("invalidStaminaCost",
|
|
|
|
|
|
+ Framework::JSON::JSONObject* result
|
|
|
|
+ = ItemSkillFactoryBase::toJsonObject(zObject);
|
|
|
|
+ result->addValue("invalidStaminaCost",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->zInvalidUseConfig()->getStaminaCost()));
|
|
zObject->zInvalidUseConfig()->getStaminaCost()));
|
|
- zResult->addValue("invalidStaminaCostDevider",
|
|
|
|
|
|
+ result->addValue("invalidStaminaCostDevider",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->zInvalidUseConfig()->getStaminaCostDevider()));
|
|
zObject->zInvalidUseConfig()->getStaminaCostDevider()));
|
|
- zResult->addValue("invalidAdditionalStaminaCostDeviderPerLevel",
|
|
|
|
|
|
+ result->addValue("invalidAdditionalStaminaCostDeviderPerLevel",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->zInvalidUseConfig()
|
|
zObject->zInvalidUseConfig()
|
|
->getAdditionalStaminaCostDeviderPerLevel()));
|
|
->getAdditionalStaminaCostDeviderPerLevel()));
|
|
- zResult->addValue("invalidDurabilityCost",
|
|
|
|
|
|
+ result->addValue("invalidDurabilityCost",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->zInvalidUseConfig()->getDurabilityCost()));
|
|
zObject->zInvalidUseConfig()->getDurabilityCost()));
|
|
- zResult->addValue("invalidDurabilityCostDevider",
|
|
|
|
|
|
+ result->addValue("invalidDurabilityCostDevider",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->zInvalidUseConfig()->getDurabilityCostDevider()));
|
|
zObject->zInvalidUseConfig()->getDurabilityCostDevider()));
|
|
- zResult->addValue("invalidAdditionalDurabilityCostDeviderPerLevel",
|
|
|
|
|
|
+ result->addValue("invalidAdditionalDurabilityCostDeviderPerLevel",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->zInvalidUseConfig()
|
|
zObject->zInvalidUseConfig()
|
|
->getAdditionalDurabilityCostDeviderPerLevel()));
|
|
->getAdditionalDurabilityCostDeviderPerLevel()));
|
|
- zResult->addValue("invalidCooldownTicks",
|
|
|
|
|
|
+ result->addValue("invalidCooldownTicks",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->zInvalidUseConfig()->getCooldownTicks()));
|
|
zObject->zInvalidUseConfig()->getCooldownTicks()));
|
|
Framework::JSON::JSONArray* configs = new Framework::JSON::JSONArray();
|
|
Framework::JSON::JSONArray* configs = new Framework::JSON::JSONArray();
|
|
@@ -1104,8 +1104,8 @@ void BlockReplaceItemSkillFactory::toJson(
|
|
{
|
|
{
|
|
configs->addValue(Game::INSTANCE->zTypeRegistry()->toJson(config));
|
|
configs->addValue(Game::INSTANCE->zTypeRegistry()->toJson(config));
|
|
}
|
|
}
|
|
- zResult->addValue("configs", configs);
|
|
|
|
- ItemSkillFactoryBase::toJson(zObject, zResult);
|
|
|
|
|
|
+ result->addValue("configs", configs);
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
JSONObjectValidationBuilder* BlockReplaceItemSkillFactory::addToValidator(
|
|
JSONObjectValidationBuilder* BlockReplaceItemSkillFactory::addToValidator(
|
|
@@ -1147,7 +1147,7 @@ JSONObjectValidationBuilder* BlockReplaceItemSkillFactory::addToValidator(
|
|
->finishArray());
|
|
->finishArray());
|
|
}
|
|
}
|
|
|
|
|
|
-Framework::Text BlockReplaceItemSkillFactory::getTypeToken() const
|
|
|
|
|
|
+const char* BlockReplaceItemSkillFactory::getTypeToken() const
|
|
{
|
|
{
|
|
return "replaceBlock";
|
|
return "replaceBlock";
|
|
}
|
|
}
|
|
@@ -1398,152 +1398,148 @@ float DamagingItemSkillConfig::getXpGainPerDamage() const
|
|
}
|
|
}
|
|
|
|
|
|
DamagingItemSkillConfigFactory::DamagingItemSkillConfigFactory()
|
|
DamagingItemSkillConfigFactory::DamagingItemSkillConfigFactory()
|
|
- : TypeFactory()
|
|
|
|
|
|
+ : ObjectTypeFactory()
|
|
{}
|
|
{}
|
|
|
|
|
|
-DamagingItemSkillConfig* DamagingItemSkillConfigFactory::createValue(
|
|
|
|
|
|
+DamagingItemSkillConfig* DamagingItemSkillConfigFactory::fromJson(
|
|
Framework::JSON::JSONObject* zJson) const
|
|
Framework::JSON::JSONObject* zJson) const
|
|
{
|
|
{
|
|
- return new DamagingItemSkillConfig();
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-void DamagingItemSkillConfigFactory::fromJson(
|
|
|
|
- DamagingItemSkillConfig* zResult, Framework::JSON::JSONObject* zJson) const
|
|
|
|
-{
|
|
|
|
- zResult->setTargetBlockFilter(
|
|
|
|
|
|
+ DamagingItemSkillConfig* result = new DamagingItemSkillConfig();
|
|
|
|
+ result->setTargetBlockFilter(
|
|
Game::INSTANCE->zTypeRegistry()->fromJson<BlockFilter>(
|
|
Game::INSTANCE->zTypeRegistry()->fromJson<BlockFilter>(
|
|
zJson->zValue("targetFilter")));
|
|
zJson->zValue("targetFilter")));
|
|
- zResult->setDamage(
|
|
|
|
|
|
+ result->setDamage(
|
|
(float)zJson->asObject()->zValue("damage")->asNumber()->getNumber());
|
|
(float)zJson->asObject()->zValue("damage")->asNumber()->getNumber());
|
|
- zResult->setDamagePerHeadHardness((float)zJson->asObject()
|
|
|
|
- ->zValue("damagePerHeadHardness")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
- zResult->setBaseDamageMultiplier((float)zJson->asObject()
|
|
|
|
- ->zValue("baseDamageMultiplier")
|
|
|
|
|
|
+ result->setDamagePerHeadHardness((float)zJson->asObject()
|
|
|
|
+ ->zValue("damagePerHeadHardness")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setDamageMultiplierPerHeadHardness(
|
|
|
|
|
|
+ result->setBaseDamageMultiplier((float)zJson->asObject()
|
|
|
|
+ ->zValue("baseDamageMultiplier")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ result->setDamageMultiplierPerHeadHardness(
|
|
(float)zJson->asObject()
|
|
(float)zJson->asObject()
|
|
->zValue("damageMultiplierPerHeadHardness")
|
|
->zValue("damageMultiplierPerHeadHardness")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setDamagePerLevel((float)zJson->asObject()
|
|
|
|
- ->zValue("damagePerLevel")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
- zResult->setDamageMultiplierPerLevel(
|
|
|
|
- (float)zJson->asObject()
|
|
|
|
- ->zValue("damageMultiplierPerLevel")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
- zResult->setDamageDevider((float)zJson->asObject()
|
|
|
|
- ->zValue("damageDevider")
|
|
|
|
|
|
+ result->setDamagePerLevel((float)zJson->asObject()
|
|
|
|
+ ->zValue("damagePerLevel")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setDamageDeviderPerHardness(
|
|
|
|
|
|
+ result->setDamageMultiplierPerLevel((float)zJson->asObject()
|
|
|
|
+ ->zValue("damageMultiplierPerLevel")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ result->setDamageDevider((float)zJson->asObject()
|
|
|
|
+ ->zValue("damageDevider")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ result->setDamageDeviderPerHardness((float)zJson->asObject()
|
|
|
|
+ ->zValue("damageDeviderPerHardness")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ result->setStaminaCost((float)zJson->asObject()
|
|
|
|
+ ->zValue("staminaCost")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ result->setStaminaCostPerDamage((float)zJson->asObject()
|
|
|
|
+ ->zValue("staminaCostPerDamage")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ result->setStaminaCostPerHardness((float)zJson->asObject()
|
|
|
|
+ ->zValue("staminaCostPerHardness")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ result->setStaminaCostDevider((float)zJson->asObject()
|
|
|
|
+ ->zValue("staminaCostDevider")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ result->setStaminaCostDeviderPerLevel(
|
|
(float)zJson->asObject()
|
|
(float)zJson->asObject()
|
|
- ->zValue("damageDeviderPerHardness")
|
|
|
|
|
|
+ ->zValue("staminaCostDeviderPerLevel")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setStaminaCost((float)zJson->asObject()
|
|
|
|
- ->zValue("staminaCost")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
- zResult->setStaminaCostPerDamage((float)zJson->asObject()
|
|
|
|
- ->zValue("staminaCostPerDamage")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
- zResult->setStaminaCostPerHardness((float)zJson->asObject()
|
|
|
|
- ->zValue("staminaCostPerHardness")
|
|
|
|
|
|
+ result->setDurabilityCost((float)zJson->asObject()
|
|
|
|
+ ->zValue("durabilityCost")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ result->setDurabilityCostPerDamage((float)zJson->asObject()
|
|
|
|
+ ->zValue("durabilityCostPerDamage")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setStaminaCostDevider((float)zJson->asObject()
|
|
|
|
- ->zValue("staminaCostDevider")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
- zResult->setStaminaCostDeviderPerLevel(
|
|
|
|
- (float)zJson->asObject()
|
|
|
|
- ->zValue("staminaCostDeviderPerLevel")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
- zResult->setDurabilityCost((float)zJson->asObject()
|
|
|
|
- ->zValue("durabilityCost")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
- zResult->setDurabilityCostPerDamage((float)zJson->asObject()
|
|
|
|
- ->zValue("durabilityCostPerDamage")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
- zResult->setDurabilityCostPerHardness(
|
|
|
|
|
|
+ result->setDurabilityCostPerHardness(
|
|
(float)zJson->asObject()
|
|
(float)zJson->asObject()
|
|
->zValue("durabilityCostPerHardness")
|
|
->zValue("durabilityCostPerHardness")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setDurabilityCostDevider((float)zJson->asObject()
|
|
|
|
- ->zValue("durabilityCostDevider")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
- zResult->setAdditionalDurabilityCostDeviderPerLevel(
|
|
|
|
|
|
+ result->setDurabilityCostDevider((float)zJson->asObject()
|
|
|
|
+ ->zValue("durabilityCostDevider")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ result->setAdditionalDurabilityCostDeviderPerLevel(
|
|
(float)zJson->asObject()
|
|
(float)zJson->asObject()
|
|
->zValue("additionalDurabilityCostDeviderPerLevel")
|
|
->zValue("additionalDurabilityCostDeviderPerLevel")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setXpGainPerDamage((float)zJson->asObject()
|
|
|
|
- ->zValue("xpGainPerDamage")
|
|
|
|
- ->asNumber()
|
|
|
|
- ->getNumber());
|
|
|
|
|
|
+ result->setXpGainPerDamage((float)zJson->asObject()
|
|
|
|
+ ->zValue("xpGainPerDamage")
|
|
|
|
+ ->asNumber()
|
|
|
|
+ ->getNumber());
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
-void DamagingItemSkillConfigFactory::toJson(DamagingItemSkillConfig* zObject,
|
|
|
|
- Framework::JSON::JSONObject* zResult) const
|
|
|
|
|
|
+Framework::JSON::JSONObject* DamagingItemSkillConfigFactory::toJsonObject(
|
|
|
|
+ DamagingItemSkillConfig* zObject) const
|
|
{
|
|
{
|
|
- zResult->addValue("targetFilter",
|
|
|
|
|
|
+ Framework::JSON::JSONObject* result = new Framework::JSON::JSONObject();
|
|
|
|
+ result->addValue("targetFilter",
|
|
Game::INSTANCE->zTypeRegistry()->toJson(zObject->zTargetBlockFilter()));
|
|
Game::INSTANCE->zTypeRegistry()->toJson(zObject->zTargetBlockFilter()));
|
|
- zResult->addValue(
|
|
|
|
|
|
+ result->addValue(
|
|
"damage", new Framework::JSON::JSONNumber(zObject->getDamage()));
|
|
"damage", new Framework::JSON::JSONNumber(zObject->getDamage()));
|
|
- zResult->addValue("damagePerHeadHardness",
|
|
|
|
|
|
+ result->addValue("damagePerHeadHardness",
|
|
new Framework::JSON::JSONNumber(zObject->getDamagePerHeadHardness()));
|
|
new Framework::JSON::JSONNumber(zObject->getDamagePerHeadHardness()));
|
|
- zResult->addValue("baseDamageMultiplier",
|
|
|
|
|
|
+ result->addValue("baseDamageMultiplier",
|
|
new Framework::JSON::JSONNumber(zObject->getBaseDamageMultiplier()));
|
|
new Framework::JSON::JSONNumber(zObject->getBaseDamageMultiplier()));
|
|
- zResult->addValue("damageMultiplierPerHeadHardness",
|
|
|
|
|
|
+ result->addValue("damageMultiplierPerHeadHardness",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->getDamageMultiplierPerHeadHardness()));
|
|
zObject->getDamageMultiplierPerHeadHardness()));
|
|
- zResult->addValue("damagePerLevel",
|
|
|
|
|
|
+ result->addValue("damagePerLevel",
|
|
new Framework::JSON::JSONNumber(zObject->getDamagePerLevel()));
|
|
new Framework::JSON::JSONNumber(zObject->getDamagePerLevel()));
|
|
- zResult->addValue("damageMultiplierPerLevel",
|
|
|
|
|
|
+ result->addValue("damageMultiplierPerLevel",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->getDamageMultiplierPerLevel()));
|
|
zObject->getDamageMultiplierPerLevel()));
|
|
- zResult->addValue("damageDevider",
|
|
|
|
|
|
+ result->addValue("damageDevider",
|
|
new Framework::JSON::JSONNumber(zObject->getDamageDevider()));
|
|
new Framework::JSON::JSONNumber(zObject->getDamageDevider()));
|
|
- zResult->addValue("damageDeviderPerHardness",
|
|
|
|
|
|
+ result->addValue("damageDeviderPerHardness",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->getDamageDeviderPerHardness()));
|
|
zObject->getDamageDeviderPerHardness()));
|
|
- zResult->addValue("staminaCost",
|
|
|
|
|
|
+ result->addValue("staminaCost",
|
|
new Framework::JSON::JSONNumber(zObject->getStaminaCost()));
|
|
new Framework::JSON::JSONNumber(zObject->getStaminaCost()));
|
|
- zResult->addValue("staminaCostPerDamage",
|
|
|
|
|
|
+ result->addValue("staminaCostPerDamage",
|
|
new Framework::JSON::JSONNumber(zObject->getStaminaCostPerDamage()));
|
|
new Framework::JSON::JSONNumber(zObject->getStaminaCostPerDamage()));
|
|
- zResult->addValue("staminaCostPerHardness",
|
|
|
|
|
|
+ result->addValue("staminaCostPerHardness",
|
|
new Framework::JSON::JSONNumber(zObject->getStaminaCostPerHardness()));
|
|
new Framework::JSON::JSONNumber(zObject->getStaminaCostPerHardness()));
|
|
- zResult->addValue("staminaCostDevider",
|
|
|
|
|
|
+ result->addValue("staminaCostDevider",
|
|
new Framework::JSON::JSONNumber(zObject->getStaminaCostDevider()));
|
|
new Framework::JSON::JSONNumber(zObject->getStaminaCostDevider()));
|
|
- zResult->addValue("staminaCostDeviderPerLevel",
|
|
|
|
|
|
+ result->addValue("staminaCostDeviderPerLevel",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->getStaminaCostDeviderPerLevel()));
|
|
zObject->getStaminaCostDeviderPerLevel()));
|
|
- zResult->addValue("durabilityCost",
|
|
|
|
|
|
+ result->addValue("durabilityCost",
|
|
new Framework::JSON::JSONNumber(zObject->getDurabilityCost()));
|
|
new Framework::JSON::JSONNumber(zObject->getDurabilityCost()));
|
|
- zResult->addValue("durabilityCostPerDamage",
|
|
|
|
|
|
+ result->addValue("durabilityCostPerDamage",
|
|
new Framework::JSON::JSONNumber(zObject->getDurabilityCostPerDamage()));
|
|
new Framework::JSON::JSONNumber(zObject->getDurabilityCostPerDamage()));
|
|
- zResult->addValue("durabilityCostPerHardness",
|
|
|
|
|
|
+ result->addValue("durabilityCostPerHardness",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->getDurabilityCostPerHardness()));
|
|
zObject->getDurabilityCostPerHardness()));
|
|
- zResult->addValue("durabilityCostDevider",
|
|
|
|
|
|
+ result->addValue("durabilityCostDevider",
|
|
new Framework::JSON::JSONNumber(zObject->getDurabilityCostDevider()));
|
|
new Framework::JSON::JSONNumber(zObject->getDurabilityCostDevider()));
|
|
- zResult->addValue("additionalDurabilityCostDeviderPerLevel",
|
|
|
|
|
|
+ result->addValue("additionalDurabilityCostDeviderPerLevel",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->getAdditionalDurabilityCostDeviderPerLevel()));
|
|
zObject->getAdditionalDurabilityCostDeviderPerLevel()));
|
|
- zResult->addValue("xpGainPerDamage",
|
|
|
|
|
|
+ result->addValue("xpGainPerDamage",
|
|
new Framework::JSON::JSONNumber(zObject->getXpGainPerDamage()));
|
|
new Framework::JSON::JSONNumber(zObject->getXpGainPerDamage()));
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
JSONObjectValidationBuilder* DamagingItemSkillConfigFactory::addToValidator(
|
|
JSONObjectValidationBuilder* DamagingItemSkillConfigFactory::addToValidator(
|
|
@@ -1704,7 +1700,10 @@ bool DamagingItemSkill::use(Entity* zActor, Item* zUsedItem, Block* zTarget)
|
|
{
|
|
{
|
|
durabilityCost /= durabilityDevider;
|
|
durabilityCost /= durabilityDevider;
|
|
}
|
|
}
|
|
- zUsedItem->setDurability(zUsedItem->getDurability() - durabilityCost);
|
|
|
|
|
|
+ if (zUsedItem)
|
|
|
|
+ {
|
|
|
|
+ zUsedItem->setDurability(zUsedItem->getDurability() - durabilityCost);
|
|
|
|
+ }
|
|
zActor->setStamina(zActor->getStamina() - staminaCost);
|
|
zActor->setStamina(zActor->getStamina() - staminaCost);
|
|
setXp(getXp() + usedConfig->getXpGainPerDamage() * damage);
|
|
setXp(getXp() + usedConfig->getXpGainPerDamage() * damage);
|
|
zTarget->setHP(zTarget->getHP() - damage);
|
|
zTarget->setHP(zTarget->getHP() - damage);
|
|
@@ -1748,13 +1747,14 @@ DamagingItemSkill* DamagingItemSkillFactory::createValue(
|
|
return new DamagingItemSkill();
|
|
return new DamagingItemSkill();
|
|
}
|
|
}
|
|
|
|
|
|
-void DamagingItemSkillFactory::fromJson(
|
|
|
|
- DamagingItemSkill* zResult, Framework::JSON::JSONObject* zJson) const
|
|
|
|
|
|
+DamagingItemSkill* DamagingItemSkillFactory::fromJson(
|
|
|
|
+ Framework::JSON::JSONObject* zJson) const
|
|
{
|
|
{
|
|
|
|
+ DamagingItemSkill* result = ItemSkillFactoryBase::fromJson(zJson);
|
|
for (Framework::JSON::JSONValue* configValue :
|
|
for (Framework::JSON::JSONValue* configValue :
|
|
*zJson->zValue("configs")->asArray())
|
|
*zJson->zValue("configs")->asArray())
|
|
{
|
|
{
|
|
- zResult->addConfig(
|
|
|
|
|
|
+ result->addConfig(
|
|
Game::INSTANCE->zTypeRegistry()->fromJson<DamagingItemSkillConfig>(
|
|
Game::INSTANCE->zTypeRegistry()->fromJson<DamagingItemSkillConfig>(
|
|
configValue));
|
|
configValue));
|
|
}
|
|
}
|
|
@@ -1796,37 +1796,39 @@ void DamagingItemSkillFactory::fromJson(
|
|
(float)zJson->zValue("invalidDurabilityCostDeviderPerLevel")
|
|
(float)zJson->zValue("invalidDurabilityCostDeviderPerLevel")
|
|
->asNumber()
|
|
->asNumber()
|
|
->getNumber());
|
|
->getNumber());
|
|
- zResult->setInvalidUseConfig(invalidUseConfig);
|
|
|
|
- ItemSkillFactoryBase::fromJson(zResult, zJson);
|
|
|
|
|
|
+ result->setInvalidUseConfig(invalidUseConfig);
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
-void DamagingItemSkillFactory::toJson(
|
|
|
|
- DamagingItemSkill* zObject, Framework::JSON::JSONObject* zResult) const
|
|
|
|
|
|
+Framework::JSON::JSONObject* DamagingItemSkillFactory::toJsonObject(
|
|
|
|
+ DamagingItemSkill* zObject) const
|
|
{
|
|
{
|
|
- zResult->addValue(
|
|
|
|
|
|
+ Framework::JSON::JSONObject* result
|
|
|
|
+ = ItemSkillFactoryBase::toJsonObject(zObject);
|
|
|
|
+ result->addValue(
|
|
"maxXp", new Framework::JSON::JSONNumber(zObject->getMaxXp()));
|
|
"maxXp", new Framework::JSON::JSONNumber(zObject->getMaxXp()));
|
|
- zResult->addValue("invalidStaminaCost",
|
|
|
|
|
|
+ result->addValue("invalidStaminaCost",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->zInvalidUseConfig()->getStaminaCost()));
|
|
zObject->zInvalidUseConfig()->getStaminaCost()));
|
|
- zResult->addValue("invalidStaminaCostPerHardness",
|
|
|
|
|
|
+ result->addValue("invalidStaminaCostPerHardness",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->zInvalidUseConfig()->getStaminaCostPerHardness()));
|
|
zObject->zInvalidUseConfig()->getStaminaCostPerHardness()));
|
|
- zResult->addValue("invalidStaminaCostDevider",
|
|
|
|
|
|
+ result->addValue("invalidStaminaCostDevider",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->zInvalidUseConfig()->getStaminaCostDevider()));
|
|
zObject->zInvalidUseConfig()->getStaminaCostDevider()));
|
|
- zResult->addValue("invalidStaminaCostDeviderPerLevel",
|
|
|
|
|
|
+ result->addValue("invalidStaminaCostDeviderPerLevel",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->zInvalidUseConfig()->getStaminaCostDeviderPerLevel()));
|
|
zObject->zInvalidUseConfig()->getStaminaCostDeviderPerLevel()));
|
|
- zResult->addValue("invalidDurabilityCost",
|
|
|
|
|
|
+ result->addValue("invalidDurabilityCost",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->zInvalidUseConfig()->getDurabilityCost()));
|
|
zObject->zInvalidUseConfig()->getDurabilityCost()));
|
|
- zResult->addValue("invalidDurabilityCostPerHardness",
|
|
|
|
|
|
+ result->addValue("invalidDurabilityCostPerHardness",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->zInvalidUseConfig()->getDurabilityCostPerHardness()));
|
|
zObject->zInvalidUseConfig()->getDurabilityCostPerHardness()));
|
|
- zResult->addValue("invalidDurabilityCostDevider",
|
|
|
|
|
|
+ result->addValue("invalidDurabilityCostDevider",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->zInvalidUseConfig()->getDurabilityCostDevider()));
|
|
zObject->zInvalidUseConfig()->getDurabilityCostDevider()));
|
|
- zResult->addValue("invalidDurabilityCostDeviderPerLevel",
|
|
|
|
|
|
+ result->addValue("invalidDurabilityCostDeviderPerLevel",
|
|
new Framework::JSON::JSONNumber(
|
|
new Framework::JSON::JSONNumber(
|
|
zObject->zInvalidUseConfig()
|
|
zObject->zInvalidUseConfig()
|
|
->getAdditionalDurabilityCostDeviderPerLevel()));
|
|
->getAdditionalDurabilityCostDeviderPerLevel()));
|
|
@@ -1835,8 +1837,8 @@ void DamagingItemSkillFactory::toJson(
|
|
{
|
|
{
|
|
configs->addValue(Game::INSTANCE->zTypeRegistry()->toJson(config));
|
|
configs->addValue(Game::INSTANCE->zTypeRegistry()->toJson(config));
|
|
}
|
|
}
|
|
- zResult->addValue("configs", configs);
|
|
|
|
- ItemSkillFactoryBase::toJson(zObject, zResult);
|
|
|
|
|
|
+ result->addValue("configs", configs);
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
JSONObjectValidationBuilder* DamagingItemSkillFactory::addToValidator(
|
|
JSONObjectValidationBuilder* DamagingItemSkillFactory::addToValidator(
|
|
@@ -1883,7 +1885,7 @@ JSONObjectValidationBuilder* DamagingItemSkillFactory::addToValidator(
|
|
->finishArray());
|
|
->finishArray());
|
|
}
|
|
}
|
|
|
|
|
|
-Framework::Text DamagingItemSkillFactory::getTypeToken() const
|
|
|
|
|
|
+const char* DamagingItemSkillFactory::getTypeToken() const
|
|
{
|
|
{
|
|
return "damaging";
|
|
return "damaging";
|
|
}
|
|
}
|