diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-04-15 13:37:29 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-04-15 13:37:29 -0300 |
commit | 1bb7efd20540844d55d364306a5c1259745988e6 (patch) | |
tree | be1182e833d2000210ffd9c322e17030a3a37dd6 /npc | |
parent | 9a488498e0462b92512266d8bff9a973bfca85a7 (diff) | |
download | serverdata-1bb7efd20540844d55d364306a5c1259745988e6.tar.gz serverdata-1bb7efd20540844d55d364306a5c1259745988e6.tar.bz2 serverdata-1bb7efd20540844d55d364306a5c1259745988e6.tar.xz serverdata-1bb7efd20540844d55d364306a5c1259745988e6.zip |
Rewrite the Guild Alchemy System in a way which works (but is MESSY)
Diffstat (limited to 'npc')
-rw-r--r-- | npc/functions/craft/alchemy.txt | 6 | ||||
-rw-r--r-- | npc/functions/guild.txt | 2 | ||||
-rw-r--r-- | npc/guilds/bank.txt | 2 | ||||
-rw-r--r-- | npc/guilds/logs.txt | 45 |
4 files changed, 42 insertions, 13 deletions
diff --git a/npc/functions/craft/alchemy.txt b/npc/functions/craft/alchemy.txt index b76db43fd..e23416596 100644 --- a/npc/functions/craft/alchemy.txt +++ b/npc/functions/craft/alchemy.txt @@ -14,9 +14,13 @@ function script AlchemySystem { // Set .scope, .knowledge and .success .scope=getarg(0, CRAFT_PLAYER); if (.scope == CRAFT_PLAYER) + { copyarray(.knowledge,RECIPES_ALCHEMY,getarraysize(RECIPES_ALCHEMY)); + } else if (.scope == CRAFT_GUILD) - copyarray(.knowledge,$RECIPES_ALCHEMY[getcharid(2)],getarraysize($RECIPES_ALCHEMY[getcharid(2)])); + { + copyarray( .knowledge,getd("$RECIPES_ALCHEMY_"+getcharid(2)),getarraysize(getd("$RECIPES_ALCHEMY_"+getcharid(2))) ); + } .success=false; setskin "craft2"; diff --git a/npc/functions/guild.txt b/npc/functions/guild.txt index 09422946d..6b9d95299 100644 --- a/npc/functions/guild.txt +++ b/npc/functions/guild.txt @@ -14,7 +14,7 @@ function script getguildrole { .@pos=-1; getguildmember(.@gid, 2); for (.@i=0; .@i < $@guildmembercount; .@i++) { - debugmes "Found AID %d - Position %d", $@guildmemberaid[.@i], $@guildmemberpos[.@i]; + //debugmes "Found AID %d - Position %d", $@guildmemberaid[.@i], $@guildmemberpos[.@i]; if (.@aid == $@guildmemberaid[.@i]) { .@pos=$@guildmemberpos[.@i]; break; diff --git a/npc/guilds/bank.txt b/npc/guilds/bank.txt index a25f853b8..dadd5277d 100644 --- a/npc/guilds/bank.txt +++ b/npc/guilds/bank.txt @@ -10,7 +10,7 @@ guilds,35,35,0 script Guild Vault NPC_NO_SPRITE,{ do { mesn; - mesc l("This vault currently have @@ GP inside.", $GUILD_BANK[.@gid]); + mesc l("This vault currently have @@ GP inside.", format_number($GUILD_BANK[.@gid])); select l("Okay, laters"), l("Donate GP"), diff --git a/npc/guilds/logs.txt b/npc/guilds/logs.txt index 29bb8b84b..c81789fb5 100644 --- a/npc/guilds/logs.txt +++ b/npc/guilds/logs.txt @@ -14,11 +14,11 @@ guilds,47,39,0 script Guild Logs NPC_NO_SPRITE,{ mes ".:: " + l("Alchemy Recipes") + " ::."; showRecipe(CraftPiberriesInfusion, PiberriesInfusion, 5, Piberries, 1, Curshroom); - showRecipe(CraftSacredManaPot, SacredManaPot, + showRecipe(CraftSacredManaPot, SacredManaPotion, 1, GoldenApple, 15, CelestiaTea); - showRecipe(CraftSacredLifePot, SacredLifePot, + showRecipe(CraftSacredLifePot, SacredLifePotion, 1, GoldenApple, 1, ElixirOfLife); - + debugmes "Okay"; if (getguildrole(.@gid, getcharid(3)) > GPOS_VICELEADER) close; @@ -26,7 +26,7 @@ guilds,47,39,0 script Guild Logs NPC_NO_SPRITE,{ { select l("Do nothing"), - rif(strcharinfo(0) == getguildmaster(.@gid), l("Raise max members")); + rif(strcharinfo(0) == getguildmaster(.@gid), l("Raise max members")), l("Learn Alchemy Recipes"); mes ""; @@ -78,15 +78,22 @@ guilds,47,39,0 script Guild Logs NPC_NO_SPRITE,{ // showRecipe (Craft, Bonus, Req1No, Req1Id, Req2No, Req2Id) // Bonus must NOT be zero to display text function showRecipe { - if ($RECIPES_ALCHEMY[getcharid(2)] & getarg(0)) { + /* + debugmes "Exist: %d", getd("$RECIPES_ALCHEMY_"+getcharid(2)+"["+getarg(0)+"]"); + debugmes "Seeking for slot %d on guild %d", getarg(0), getcharid(2); + */ + if (getd("$RECIPES_ALCHEMY_"+getcharid(2)+"["+getarg(0)+"]")) { + debugmes "Hooray! It exists! We have %d defined", getarg(1); if (getarg(1)) { mesn l("Craft @@", getitemlink(getarg(1))); mesc l("* @@ @@", getarg(2), getitemlink(getarg(3))); mesc l("* @@ @@", getarg(4), getitemlink(getarg(5))); mes ""; } + //debugmes "You got it: %d (global: %d)", getarg(0), $RECIPES_ALCHEMY[getcharid(2)]; return 1; } + //debugmes "Nope, nothing here"; return 0; } @@ -95,7 +102,7 @@ function calcRecipe { array_push(@tmp_alcrep_id, getarg(0)); array_push(@tmp_alcrep_glv, getarg(1)); array_push(@tmp_alcrep_ggp, getarg(2)); - array_push(@tmp_alcrep_txt$, getarg(3) + " - GLV "+getarg(1)+", "+getarg(2)+" GP"); + array_push(@tmp_alcrep_txt$, getarg(3) + " - GLV "+getarg(1)+", "+format_number(getarg(2))+" GP"); return; } @@ -105,18 +112,36 @@ function clearRecipe { deletearray(@tmp_alcrep_glv); deletearray(@tmp_alcrep_ggp); deletearray(@tmp_alcrep_txt$); + @tmp_alcrep_id[0]=-1; + @tmp_alcrep_glv[0]=-1; + @tmp_alcrep_ggp[0]=-1; + @tmp_alcrep_txt$[0]=l("Learn Nothing"); return; } // hudRecipe () function hudRecipe { + .@gid=getcharid(2); // Select - select (implode(@tmp_alcrep_txt$, ":")+":Nothing"); - if (@tmp_alcrep_glv[@menu] == 0) + select (implode(@tmp_alcrep_txt$, ":")); + @menu=@menu-1; + + /* DEBUG prints + debugmes "You choose: %d", @menu; + debugmes getd("$RECIPES_ALCHEMY_"+.@gid); + copyarray(.@v, getd("$RECIPES_ALCHEMY_"+.@gid), getarraysize(getd("$RECIPES_ALCHEMY_"+.@gid)) ); + debugmes "Width: %d (out of %d)", getarraysize(.@v), getarraysize(getd("$RECIPES_ALCHEMY_"+.@gid)); + debugmes "Slot 44: %d", .@v[44]; + debugmes "Slot 43: %d", .@v[43]; + debugmes "Slot 42: %d", .@v[42]; + debugmes "GLVL Options: %d-%d-%d-%d", @tmp_alcrep_glv[0], @tmp_alcrep_glv[1], @tmp_alcrep_glv[2], @tmp_alcrep_glv[3]; + */ + + if (@tmp_alcrep_glv[@menu] <= 0) return 1; if (getguildlvl(.@gid) < @tmp_alcrep_glv[@menu]) { - mesc l("Insufficient Guild Level!"), 1; + mesc l("Insufficient Guild Level! (@@/@@)", getguildlvl(.@gid), @tmp_alcrep_glv[@menu]), 1; next; return 0; } @@ -127,7 +152,7 @@ function hudRecipe { } // All fine, proceed $GUILD_BANK[.@gid] -= @tmp_alcrep_ggp[@menu]; - $RECIPES_ALCHEMY[getcharid(2)]=$RECIPES_ALCHEMY[getcharid(2)]|@tmp_alcrep_id[@menu]; + setd("$RECIPES_ALCHEMY_"+getcharid(2)+"["+@tmp_alcrep_id[@menu]+"]", true); mesc l("Skill learnt!"), 2; next; return 0; |