diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-03-06 13:16:03 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-03-06 13:16:03 -0300 |
commit | 29b3f0f75932c58e7f670e8be99edcc9815bf1e5 (patch) | |
tree | 9bb1689e04400a6d2673f1b5ad3d688e02f01194 | |
parent | 8885ac72ad393f428b25c4b0e4c1f12825eee9ad (diff) | |
download | serverdata-29b3f0f75932c58e7f670e8be99edcc9815bf1e5.tar.gz serverdata-29b3f0f75932c58e7f670e8be99edcc9815bf1e5.tar.bz2 serverdata-29b3f0f75932c58e7f670e8be99edcc9815bf1e5.tar.xz serverdata-29b3f0f75932c58e7f670e8be99edcc9815bf1e5.zip |
Update Alige script file for better user experience.
Code-style-wise, this is what gumi calls "legacy" and needs "total rewrite".
I'm not willing to totally rewrite it, only to improve user experience.
Total rewrite can be done by real coders.
-rw-r--r-- | npc/000-2-1/alige.txt | 68 | ||||
-rw-r--r-- | npc/001-2-22/alige.txt | 70 |
2 files changed, 73 insertions, 65 deletions
diff --git a/npc/000-2-1/alige.txt b/npc/000-2-1/alige.txt index 27f9b6d5..24c19d68 100644 --- a/npc/000-2-1/alige.txt +++ b/npc/000-2-1/alige.txt @@ -168,38 +168,20 @@ L_Accepted: L_GiveFood: mes ""; menuint - rif(countitem(Acorn), l(getitemname(Acorn))), 0, - rif(countitem(Bread), l(getitemname(Bread))), 502, - rif(countitem(Fungus), l(getitemname(Fungus))), 503, - rif(countitem(Cheese), l(getitemname(Cheese))), 504, - rif(countitem(PiouLegs), l(getitemname(PiouLegs))), 505, - rif(countitem(LettuceLeaf), l(getitemname(LettuceLeaf))), 0, - rif(countitem(Piberries), l(getitemname(Piberries))), 2, - rif(countitem(SeaDrops), l(getitemname(SeaDrops))), 1, - rif(countitem(Aquada), l(getitemname(Aquada))), 509, - rif(countitem(PinkBlobime), l(getitemname(PinkBlobime))), 1, - rif(countitem(HalfCroconut), l(getitemname(HalfCroconut))), 512, - rif(countitem(Croconut), l(getitemname(Croconut))), 0, - rif(countitem(Plushroom), l(getitemname(Plushroom))), 515, - rif(countitem(PumpkinSeeds), l(getitemname(PumpkinSeeds))), 1, - rif(countitem(UrchinMeat), l(getitemname(UrchinMeat))), 1, - rif(countitem(EasterEgg), l(getitemname(EasterEgg))), 1, - rif(countitem(PumpkinJuice), l(getitemname(PumpkinJuice))), 527, - rif(countitem(Manana), l(getitemname(Manana))), 528, - rif(countitem(Curshroom), l(getitemname(Curshroom))), 529, - rif(countitem(Carrot), l(getitemname(Carrot))), 530, - rif(countitem(RedPlushWine), l(getitemname(RedPlushWine))), 3, - l("I don't have anything good for you today."), -1; - - .@id = @menuret; - if (.@id == -1) goto L_Quit; // Quit message. - if (.@id == 0) goto L_NoReward; // In case of wrong food. - if (.@id == 1) goto L_Poison; // In case of poisoned food. - if (.@id == 2) goto L_NoMore; // In case of Piberries. - if (.@id == 3) goto L_Drunk; // In case of Alcohol. - if (countitem(.@id) == 0) goto L_Quit; -// if (.@id == item's ID) then food is correct. -// Do not put any other number than -1, 0, 1, 2 or the item's ID, that'll avoid confusion. + l("I don't have anything good for you today."), -1; + + mes "##B" + l("Drag and drop an item from your inventory.") + "##b"; + .@id = requestitem(); + if (.@id <= 0) goto L_Quit; // Quit message. + if (countitem(.@id) == 0) goto L_Quit; // If don't have the food + + if (array_find(.vegetables, .@id)) goto L_NoReward; // In case of wrong food. + if (array_find(.poisonable, .@id)) goto L_Poison; // In case of poisoned food (or food with effects). + if (.@id == Piberries) goto L_NoMore; // In case of Piberries. + if (.@id == RedPlushWine) goto L_Drunk; // In case of Alcohol. + + // Default message for non food + if (!array_find(.commonfood, .@id)) goto L_NoFood; inventoryplace Piberries, 3; delitem .@id, 1; @@ -233,6 +215,23 @@ L_Drunk: goto L_GiveFood; +L_NoFood: + setcamnpc; + // We must first determine if it is at least edible (IT_HEALING) + if (getiteminfo(.@id, ITEMINFO_TYPE) == IT_HEALING) + { + speech S_FIRST_BLANK_LINE | S_LAST_NEXT, + l("That looks too exotic for me to eat!"); + } + else + { + speech S_FIRST_BLANK_LINE | S_LAST_NEXT, + l("That doesn't looks edible to me!"); + } + restorecam; + + goto L_GiveFood; + L_ReturnMenu: setcamnpc; mesq l("Do you have anything else for me?"); @@ -316,5 +315,10 @@ L_Quit: OnInit: .sex = G_MALE; .distance = 2; + + // Array of foods (remember to update in 001-2-22 as well) + setarray .commonfood, Bread, Fungus, Cheese, PiouLegs, Aquada, HalfCroconut, Plushroom, PumpkinJuice, Manana, Curshroom, Carrot, CarpSandwich, PioulegsSandwich; + setarray .vegatables, Acorn, LettuceLeaf, Croconut, MananaSandwich; + setarray .poisonable, SeaDrops, PinkBlobime, PumpkinSeeds, UrchinMeat, EasterEgg; end; } diff --git a/npc/001-2-22/alige.txt b/npc/001-2-22/alige.txt index 12ec0d9a..4ceccf70 100644 --- a/npc/001-2-22/alige.txt +++ b/npc/001-2-22/alige.txt @@ -172,38 +172,20 @@ L_Accepted: L_GiveFood: mes ""; menuint - rif(countitem(Acorn), l(getitemname(Acorn))), 0, - rif(countitem(Bread), l(getitemname(Bread))), 502, - rif(countitem(Fungus), l(getitemname(Fungus))), 503, - rif(countitem(Cheese), l(getitemname(Cheese))), 504, - rif(countitem(PiouLegs), l(getitemname(PiouLegs))), 505, - rif(countitem(LettuceLeaf), l(getitemname(LettuceLeaf))), 0, - rif(countitem(Piberries), l(getitemname(Piberries))), 2, - rif(countitem(SeaDrops), l(getitemname(SeaDrops))), 1, - rif(countitem(Aquada), l(getitemname(Aquada))), 509, - rif(countitem(PinkBlobime), l(getitemname(PinkBlobime))), 1, - rif(countitem(HalfCroconut), l(getitemname(HalfCroconut))), 512, - rif(countitem(Croconut), l(getitemname(Croconut))), 0, - rif(countitem(Plushroom), l(getitemname(Plushroom))), 515, - rif(countitem(PumpkinSeeds), l(getitemname(PumpkinSeeds))), 1, - rif(countitem(UrchinMeat), l(getitemname(UrchinMeat))), 1, - rif(countitem(EasterEgg), l(getitemname(EasterEgg))), 1, - rif(countitem(PumpkinJuice), l(getitemname(PumpkinJuice))), 527, - rif(countitem(Manana), l(getitemname(Manana))), 528, - rif(countitem(Curshroom), l(getitemname(Curshroom))), 529, - rif(countitem(Carrot), l(getitemname(Carrot))), 530, - rif(countitem(RedPlushWine), l(getitemname(RedPlushWine))), 3, - l("I don't have anything good for you today."), -1; - - .@id = @menuret; - if (.@id == -1) goto L_Quit; // Quit message. - if (.@id == 0) goto L_NoReward; // In case of wrong food. - if (.@id == 1) goto L_Poison; // In case of poisoned food. - if (.@id == 2) goto L_NoMore; // In case of Piberries. - if (.@id == 3) goto L_Drunk; // In case of Alcohol. - if (countitem(.@id) == 0) goto L_Quit; -// if (.@id == item's ID) then food is correct. -// Do not put any other number than -1, 0, 1, 2 or the item's ID, that'll avoid confusion. + l("I don't have anything good for you today."), -1; + + mes "##B" + l("Drag and drop an item from your inventory.") + "##b"; + .@id = requestitem(); + if (.@id <= 0) goto L_Quit; // Quit message. + if (countitem(.@id) == 0) goto L_Quit; // If don't have the food + + if (array_find(.vegetables, .@id)) goto L_NoReward; // In case of wrong food. + if (array_find(.poisonable, .@id)) goto L_Poison; // In case of poisoned food (or food with effects). + if (.@id == Piberries) goto L_NoMore; // In case of Piberries. + if (.@id == RedPlushWine) goto L_Drunk; // In case of Alcohol. + + // Default message for non food + if (!array_find(.commonfood, .@id)) goto L_NoFood; inventoryplace Piberries, 3; delitem .@id, 1; @@ -232,7 +214,24 @@ L_NoReward: L_Drunk: setcamnpc; speech S_FIRST_BLANK_LINE | S_LAST_NEXT, - l("I asked for food but... *hips* Ah, that'll do nicely!"); + l("I asked for food but... *hips* Ah, that'll do!"); + restorecam; + + goto L_GiveFood; + +L_NoFood: + setcamnpc; + // We must first determine if it is at least edible (IT_HEALING) + if (getiteminfo(.@id, ITEMINFO_TYPE) == IT_HEALING) + { + speech S_FIRST_BLANK_LINE | S_LAST_NEXT, + l("That looks too exotic for me to eat!"); + } + else + { + speech S_FIRST_BLANK_LINE | S_LAST_NEXT, + l("That doesn't looks edible to me!"); + } restorecam; goto L_GiveFood; @@ -320,5 +319,10 @@ L_Quit: OnInit: .sex = G_MALE; .distance = 2; + + // Array of foods (remember to update in 000-2-1 as well) + setarray .commonfood, Bread, Fungus, Cheese, PiouLegs, Aquada, HalfCroconut, Plushroom, PumpkinJuice, Manana, Curshroom, Carrot, CarpSandwich, PioulegsSandwich; + setarray .vegatables, Acorn, LettuceLeaf, Croconut, MananaSandwich; + setarray .poisonable, SeaDrops, PinkBlobime, PumpkinSeeds, UrchinMeat, EasterEgg; end; } |