Difference between revisions of "Script: Statfix"
From Ultima Online: The Second Age
(4 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
{ | { | ||
<span style="color:#0000FF">int</span> num = 0x00; | <span style="color:#0000FF">int</span> num = 0x00; | ||
− | <span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](Q68S, <span style="color:#800000">" | + | <span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](Q68S, <span style="color:#800000">"fixStats"</span>)) |
{ | { | ||
− | num = [[Engine Function:_getObjVar|<span style="color:#FF0000;font-weight:bold">getObjVar</span>]](Q68S, <span style="color:#800000">" | + | num = [[Engine Function:_getObjVar|<span style="color:#FF0000;font-weight:bold">getObjVar</span>]](Q68S, <span style="color:#800000">"fixStats"</span>); |
} | } | ||
num++; | num++; | ||
− | [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](Q68S, <span style="color:#800000">" | + | [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](Q68S, <span style="color:#800000">"fixStats"</span>, num); |
<span style="color:#0000FF">return</span> (); | <span style="color:#0000FF">return</span> (); | ||
} | } | ||
Line 53: | Line 53: | ||
<span style="color:#0000FF">if</span> (item != [[Engine Function:_NULL|<span style="color:#FF0000;font-weight:bold">NULL</span>]]()) | <span style="color:#0000FF">if</span> (item != [[Engine Function:_NULL|<span style="color:#FF0000;font-weight:bold">NULL</span>]]()) | ||
{ | { | ||
− | Q5NC = [[ | + | Q5NC = [[Engine Function:_teleport|<span style="color:#FF0000;font-weight:bold">teleport</span>]](item, Q5AH); |
} | } | ||
} | } | ||
Line 72: | Line 72: | ||
<span style="color:#0000FF">function</span> <span style="color:#0000FF">void</span> Q4PM(<span style="color:#0000FF">obj</span> it) | <span style="color:#0000FF">function</span> <span style="color:#0000FF">void</span> Q4PM(<span style="color:#0000FF">obj</span> it) | ||
{ | { | ||
− | <span style="color:#0000FF">if</span> ([[ | + | <span style="color:#0000FF">if</span> ([[Script_Function:_fixStats|<span style="color:#2B91AF">fixStats</span>]](it)) |
{ | { | ||
[[Engine Function:_bark|<span style="color:#FF0000;font-weight:bold">bark</span>]](it, <span style="color:#800000">"Stat(s) fixed"</span>); | [[Engine Function:_bark|<span style="color:#FF0000;font-weight:bold">bark</span>]](it, <span style="color:#800000">"Stat(s) fixed"</span>); | ||
[[Script_Function:_Q5LY|<span style="color:#2B91AF">Q5LY</span>]](it); | [[Script_Function:_Q5LY|<span style="color:#2B91AF">Q5LY</span>]](it); | ||
} | } | ||
− | [[Engine Function:_detachScript|<span style="color:#FF0000;font-weight:bold">detachScript</span>]](it, <span style="color:#800000">" | + | [[Engine Function:_detachScript|<span style="color:#FF0000;font-weight:bold">detachScript</span>]](it, <span style="color:#800000">"statfix"</span>); |
<span style="color:#0000FF">return</span> (); | <span style="color:#0000FF">return</span> (); | ||
} | } | ||
Line 91: | Line 91: | ||
<span style="color:#0000FF">return</span> (0x01); | <span style="color:#0000FF">return</span> (0x01); | ||
} | } | ||
− | <span style="color:#0000FF">if</span> (Q5OQ == <span style="color:#800000">" | + | <span style="color:#0000FF">if</span> (Q5OQ == <span style="color:#800000">"statfix"</span>) |
{ | { | ||
<span style="color:#0000FF">return</span> (0x01); | <span style="color:#0000FF">return</span> (0x01); | ||
Line 159: | Line 159: | ||
<span style="color:#0000FF">return</span> (0x01); | <span style="color:#0000FF">return</span> (0x01); | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 07:15, 19 October 2018
inherits globals;
function void Q5LY(obj Q68S) { int num = 0x00; if (hasObjVar(Q68S, "fixStats")) { num = getObjVar(Q68S, "fixStats"); } num++; setObjVar(Q68S, "fixStats", num); return (); }
function int Q5ML(obj Q68S) { int Q5W5; int Q5LU; int Q5W0; int Q5NC; int Q5NG = 0x00; for(int i = 0x00; i < 0x03; i++) { Q5W5 = getStatMod(Q68S, i); if (Q5W5 != 0x00) { Q5NC = setStatMod(Q68S, i, 0x00); Q5NG = 0x01; } Q5LU = getRealStat(Q68S, i); Q5W0 = getStatAttributeMax(Q68S, i); if (Q5LU != Q5W0) { Q5NC = setStatAttributeMax(Q68S, i, Q5LU); Q5NG = 0x01; } } return (Q5NG); }
function int fixStats(obj Q68S) { list Q4O3; loc Q5AH = getLocation(Q68S); int Q5TS; obj item; int Q5NC; int Q5NG; for(Q5TS = 0x01; Q5TS < 0x1A; Q5TS++) { item = getItemAtSlot(Q68S, Q5TS); append(Q4O3, item); if (item != NULL()) { Q5NC = teleport(item, Q5AH); } } Q5NG = Q5ML(Q68S); int Q52R = numInList(Q4O3) + 0x01; for(Q5TS = 0x01; Q5TS < Q52R; Q5TS++) { item = Q4O3[Q5TS - 0x01]; if (item != NULL()) { Q5NC = equipObj(item, Q68S, Q5TS); } } setNaturalAC(Q68S, 0x00); return (Q5NG); }
function void Q4PM(obj it) { if (fixStats(it)) { bark(it, "Stat(s) fixed"); Q5LY(it); } detachScript(it, "statfix"); return (); }
function int Q5ON(string Q5OQ) { if (Q5OQ == "bounty") { return (0x01); } if (Q5OQ == "giftbag") { return (0x01); } if (Q5OQ == "statfix") { return (0x01); } if (Q5OQ == "amnesty3") { return (0x01); } if (Q5OQ == "amnesty4") { return (0x01); } if (Q5OQ == "guarded") { return (0x01); } if (Q5OQ == "counokay") { return (0x01); } if (Q5OQ == "info") { return (0x01); } return (0x00); }
function int Q5OP(obj it) { list Q5OO; getScripts(Q5OO, it); int num = numInList(Q5OO); string Q5OQ; for(int i = 0x00; i < num; i++) { Q5OQ = Q5OO[i]; if (!Q5ON(Q5OQ)) { return (0x00); } } return (0x01); }
function void Q4C9(obj it) { if (Q5OP(it)) { Q4PM(it); } else { callback(it, random(0x1E, 0x3C), 0x77); } return (); }
trigger creation { Q4C9(this); return (0x01); }
trigger callback(0x77) { Q4C9(this); return (0x01); }