736
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
registerOutputEvent(gameConnection, "addSkillEXP", "string 50 80 int 1 999999 1 bool false", false);
registerOutputEvent(fxDtsBrick, "checkSkillMoreThan", "string 50 80 int 1 999999 1", true);
registerInputEvent(fxDtsBrick, "onHasSufficientSkill", "Self fxDtsBrick bot bot Player player Client gameConnection Minigame minigame");
registerInputEvent(fxDtsBrick, "onHasInsufficientSkill", "Self fxDtsBrick bot bot Player player Client gameConnection Minigame minigame");
function getLevelEXP(%level)
{
%answer = 0;
for(%i = 1; %i < %level; %i++)
{
%answer += mFloor(%i + 300 * mpow(2, (%i / 7)));
}
return mFloor(%answer / 4);
}
function gameConnection::addSkillEXP(%this, %skillName, %exp, %announce)
{
%this.currentSkill = %skillName;
if(%this.skillEXP[%skillName] $= "")
{
%this.skills = %this.skills TAB %skillName;
%this.skillLevel[%skillName] = 1;
}
%this.skillEXP[%skillName] += %exp;
if(%announce)
%this.chatMessage("\c6You have gained\c4" SPC %exp SPC "\c6experience in the\c4" SPC %skillName SPC "\c6skill.");
while(%this.skillEXP[%skillName] >= getLevelEXP(%this.skillLevel[%skillName] + 1))
{
%this.skillLevel[%skillName]++;
%this.onLevelUp(%skillName, %this.skillLevel[%skillName]);
%this.chatMessage("\c6You've gained a level in the\c4" SPC %skillName SPC "\c6skill! You're now level\c4" SPC %this.skillLevel[%skillName] @ "\c6.");
}
showHud(%this);
}
function fxDtsBrick::checkSkillMoreThan(%this, %skillName, %level, %client, %obj)
{
$InputTarget_["Self"] = %this;
$InputTarget_["Player"] = %client.player;
$InputTarget_["Client"] = %client;
$InputTarget_["bot"] = %obj;
if($Server::LAN)
{
$InputTarget_["MiniGame"] = getMiniGameFromObject(%client);
}
else
{
if(getMiniGameFromObject(%this) == getMiniGameFromObject(%client))
$InputTarget_["MiniGame"] = getMiniGameFromObject(%this);
else
$InputTarget_["MiniGame"] = 0;
}
if(%client.skillLevel[%skillName] >= %level)
%this.processInputEvent("onHasSufficientSkill", %client, %obj);
else
%this.processInputEvent("onHasInsufficientSkill", %client, %obj);
}
function gameConnection::onLevelUp(%this, %skill, %level)
{
// This function exists just for packaging.
// Probably handy if you want to implement more exquisite features of certain skills; like a combat skill.
}
function serverCmdSkills(%client)
{
%max = getFieldCount(%client.skills);
for(%i = 0; %i < %max; %i++)
{
%skill = getField(%client.skills, %i);
if(%skill $= "")
continue;
%client.chatMessage("\c6" @ %skill SPC "Level\c4" SPC %client.skillLevel[%skill] SPC "\c6(\c4" @ %client.skillEXP[%skill] SPC "\c6/\c4" SPC getLevelEXP(%client.skillLevel[%skill] + 1) @ "\c6) EXP");
}
}
function showHUD(%client)
{
if(%client.disableHUDUntil > $sim::time || $pref::server::TotalRPG::disableHUD)
return;
if(!isObject(%client.player) || %client.player.getDamageState() $= "Disabled")
{
%client.bottomPrint($pref::server::TotalRPG::deathMessage);
return;
}
%health = mFloor(%client.player.getDatablock().maxDamage - %client.player.getDamageLevel());
%mana = %client.player.mana;
%Coins = %client.score;
if(%Coins $= "")
%Coins = 0;
if(%client.currentSkill !$= "")
{
%skillHUD = %client.currentSkill SPC "Level" SPC %client.skillLevel[%client.currentSkill] SPC "(" @ %client.skillEXP[%client.currentSkill] SPC "/" SPC getLevelEXP(%client.skillLevel[%client.currentSkill] + 1) @ ") EXP";
}
if($totalRPGHUDExtensions > 0)
{
for(%i = 1; %i <= $totalRPGHUDExtensions; %i++)
{
%extension = $totalRPGHUDExtension[%i];
%method = getField(%extension, 0);
%target = getField(%extension, 1);
%value = getField(%extension, 2);
%name = getField(%extension, 3);
%args = getField(%extension, 4);
switch$(%target)
{
case "player":
%target = %client.player;
case "client":
%target = %client;
case "minigame":
%target = %client.minigame;
}
if(!isObject(%target))
continue;
if(%method == 1)
{
%retrieveValue = %target.getAttribute(%value);
}
else if(%method == 2)
{
$temp = "";
$tempC = %target;
// Someone let me know if there is a better way to do this :/
eval("$temp = $tempC." @ %value @ "(" @ %args @ ");");
%retrieveValue = $temp;
}
%extensionStats = %extensionStats SPC "\c4" @ %name @ ":" SPC %retrieveValue;
}
}
commandToClient(%client, 'bottomPrint', "\c2<bitmap:Add-Ons/server_totalrpg/CI_dinner>:" SPC %health @ (%mana $= "" ? "" : " \c1Mana:" SPC %mana) SPC "\c3" @ $pref::server::TotalRPG::currencyName @ ":" SPC %coins SPC "\c6" @ %skillHUD SPC %extensionStats, false);
}
//downloadable hud
AddDamageType("dinner", '<bitmap:Add-Ons/server_totalRPG/CI_dinner> %1', '%2 <bitmap:add-ons/server_totalRPG/CI_dinner> %1',0.5,1);