diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-04-15 11:19:41 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-04-15 11:19:41 -0300 |
commit | 5302bb4dd260f6813ec5a80fd9de76446078ee8e (patch) | |
tree | 9bf8b5da6a39a6c6400f4555efd59761dbf46658 /npc | |
parent | 9ecfaa4b8acedbdcf56065e1fd5f07d646899655 (diff) | |
download | serverdata-5302bb4dd260f6813ec5a80fd9de76446078ee8e.tar.gz serverdata-5302bb4dd260f6813ec5a80fd9de76446078ee8e.tar.bz2 serverdata-5302bb4dd260f6813ec5a80fd9de76446078ee8e.tar.xz serverdata-5302bb4dd260f6813ec5a80fd9de76446078ee8e.zip |
Optimize
Diffstat (limited to 'npc')
-rw-r--r-- | npc/guilds/logs.txt | 77 |
1 files changed, 47 insertions, 30 deletions
diff --git a/npc/guilds/logs.txt b/npc/guilds/logs.txt index a41a377c5..15ec90c68 100644 --- a/npc/guilds/logs.txt +++ b/npc/guilds/logs.txt @@ -55,46 +55,29 @@ guilds,47,39,0 script Guild Logs NPC_NO_SPRITE,{ break; case 3: mes ".:: " + l("Alchemy Recipes") + " ::."; - deletearray(@tmp_alcrep_id); - deletearray(@tmp_alcrep_glv); - deletearray(@tmp_alcrep_ggp); - deletearray(@tmp_alcrep_txt$); + do { + clearRecipe(); - // Setup - if (!showRecipe(CraftPiberriesInfusion, 0, 0, 0, 0, 0, true)) - calcRecipe(CraftPiberriesInfusion, 3, 10000, l("Piberries Infusion")); - if (!showRecipe(CraftSacredManaPot, 0, 0, 0, 0, 0, true)) - calcRecipe(CraftSacredManaPot, 5, 100000, l("Sacred Mana Potion")); - if (!showRecipe(CraftSacredLifePot, 0, 0, 0, 0, 0, true)) - calcRecipe(CraftSacredLifePot, 5, 100000, l("Sacred Life Potion")); + // Setup the Recipes + if (!showRecipe(CraftPiberriesInfusion, false)) + calcRecipe(CraftPiberriesInfusion, 3, 10000, l("Piberries Infusion")); + if (!showRecipe(CraftSacredManaPot, false)) + calcRecipe(CraftSacredManaPot, 5, 100000, l("Sacred Mana Potion")); + if (!showRecipe(CraftSacredLifePot, false)) + calcRecipe(CraftSacredLifePot, 5, 100000, l("Sacred Life Potion")); - // Select - select (@tmp_alcrep_txt$+":Nothing"); - if (@tmp_alcrep_glv[@menu] == 0) - break; - if (getguildlvl(.@gid) < @tmp_alcrep_glv[@menu]) { - mesc l("Insufficient Guild Level!"), 1; - break; - } - if ($GUILD_BANK[.@gid] < @tmp_alcrep_ggp[@menu]) { - mesc l("Insufficient Guild Money! (Guild has: @@ GP)", format_number($GUILD_BANK[.@gid])), 1; - break; - } - // All fine, proceed - $GUILD_BANK[.@gid] -= @tmp_alcrep_ggp[@menu]; - $RECIPES_ALCHEMY[getcharid(2)]=$RECIPES_ALCHEMY[getcharid(2)]|@tmp_alcrep_id[@menu]; - mesc l("Skill learnt!"), 2; - next; + } while (!hudRecipe()); break; } } while (@menu != 1); close; -// showRecipe (Craft, Bonus, Req1No, Req1Id, Req2No, Req2Id, DisplayText) +// showRecipe (Craft, Bonus, Req1No, Req1Id, Req2No, Req2Id) +// Bonus must NOT be zero to display text function showRecipe { if ($RECIPES_ALCHEMY[getcharid(2)] & getarg(0)) { - if (getarg(6,1)) { + if (getarg(1)) { mesn l("Craft @@", getitemlink(getarg(1))); mesc l("* @@ @@", getarg(2), getitemlink(getarg(3))); mesc l("* @@ @@", getarg(4), getitemlink(getarg(5))); @@ -114,6 +97,40 @@ function calcRecipe { return; } +// clearRecipe () +function clearRecipe { + deletearray(@tmp_alcrep_id); + deletearray(@tmp_alcrep_glv); + deletearray(@tmp_alcrep_ggp); + deletearray(@tmp_alcrep_txt$); + return; +} + +// hudRecipe () +function hudRecipe { + // Select + select (@tmp_alcrep_txt$+":Nothing"); + if (@tmp_alcrep_glv[@menu] == 0) + return 1; + + if (getguildlvl(.@gid) < @tmp_alcrep_glv[@menu]) { + mesc l("Insufficient Guild Level!"), 1; + next; + return 0; + } + if ($GUILD_BANK[.@gid] < @tmp_alcrep_ggp[@menu]) { + mesc l("Insufficient Guild Money! (Guild has: @@ GP)", format_number($GUILD_BANK[.@gid])), 1; + next; + return 0; + } + // All fine, proceed + $GUILD_BANK[.@gid] -= @tmp_alcrep_ggp[@menu]; + $RECIPES_ALCHEMY[getcharid(2)]=$RECIPES_ALCHEMY[getcharid(2)]|@tmp_alcrep_id[@menu]; + mesc l("Skill learnt!"), 2; + next; + return 0; +} + OnInit: .distance=2; end; |