diff options
author | n0n4m3 <none@none> | 2009-12-19 18:53:27 +0100 |
---|---|---|
committer | n0n4m3 <none@none> | 2009-12-19 18:53:27 +0100 |
commit | 1f9530af217c32fbb60f2d75ef388aa8888381b5 (patch) | |
tree | d683b091979a52d8cd4f4b143208278d119362d5 /src/game/Map.cpp | |
parent | 1d79bc51ea857070c5f23782c84dca5892c9edb2 (diff) |
Implement SCRIPT_COMMAND_KILL_CREDIT (8). by NoFantasy
--HG--
branch : trunk
Diffstat (limited to 'src/game/Map.cpp')
-rw-r--r-- | src/game/Map.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 0ddbf359f40..c0556ecc5ee 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -3423,6 +3423,36 @@ void Map::ScriptsProcess() break; } + case SCRIPT_COMMAND_KILL_CREDIT: + { + // accept player in any one from target/source arg + if (!target && !source) + { + sLog.outError("SCRIPT_COMMAND_KILL_CREDIT call for NULL object."); + break; + } + + // must be only Player + if((!target || target->GetTypeId() != TYPEID_PLAYER) && (!source || source->GetTypeId() != TYPEID_PLAYER)) + { + sLog.outError("SCRIPT_COMMAND_KILL_CREDIT call for non-player (TypeIdSource: %u)(TypeIdTarget: %u), skipping.", source ? source->GetTypeId() : 0, target ? target->GetTypeId() : 0); + break; + } + + Player* pSource = target && target->GetTypeId() == TYPEID_PLAYER ? (Player*)target : (Player*)source; + + if (step.script->datalong2) + { + pSource->RewardPlayerAndGroupAtEvent(step.script->datalong, pSource); + } + else + { + pSource->KilledMonsterCredit(step.script->datalong, 0); + } + + break; + } + case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE: { if(!step.script->datalong) // creature not specified |