Aschbourne_PRC8/_module/nss/_dmg_plant.nss

1084 lines
27 KiB
Plaintext
Raw Normal View History

2024-06-14 10:48:20 -04:00
//#include "_persist_01a"
#include "nw_i0_plot"
void main()
{
object oPC = GetLastDamager();
object oSelf = OBJECT_SELF;
string sTagSelf = GetTag(oSelf);
string sResSelf = GetResRef(oSelf);
object oTool = OBJECT_INVALID;
int iPlantType = 0;
int iTreeMode = 0;
if (GetIsPC(oPC)==FALSE) return;
if (GetDistanceBetween(oSelf,oPC)>2.5)
{
SendMessageToPC(oPC,"You were too far away from it to gather anything.");
return;
}
if (GetStringLeft(sTagSelf,6) == "PLANT_")
{
oTool = GetItemPossessedBy(oPC,"ITEM_HERBALISTKNIFE");
if (oTool == OBJECT_INVALID)
{
FloatingTextStringOnCreature("You must have an herbalist's knife in order to cut plants",oPC,FALSE);
return;
}
iPlantType = 1;
}
if (GetStringLeft(sTagSelf,5) == "TREE_")
{
iTreeMode = GetLocalInt(oPC,"iTreeGatherMode");
oTool = GetItemPossessedBy(oPC,"ITEM_ORCHARDBLADE");
//if (oTool == OBJECT_INVALID) oTool = GetItemPossessedBy(oPC,"ITEM_WOODAXE");
if (oTool == OBJECT_INVALID)
{
oTool = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
if (GetTag(oTool)!="ITEM_WOODAXE") oTool= OBJECT_INVALID;
}
if (oTool == OBJECT_INVALID)
{
FloatingTextStringOnCreature("You must have a woodsman's axe or an orchard blade in order to do that.",oPC,FALSE);
return;
}
iPlantType = 2;
if (GetTag(oTool)=="ITEM_WOODAXE") iTreeMode =0;
}
int iToolUsed = GetLocalInt(oPC,"iToolWillBreak");
iToolUsed++;
if (iToolUsed >= 100)
{
iToolUsed = 0;
if (iPlantType==1) FloatingTextStringOnCreature("Your herbalist's knife blade shatters as you use it on the plant.",oPC,FALSE);
if (iPlantType==2) FloatingTextStringOnCreature("Your "+GetName(oTool)+" breaks as you use it on the tree.",oPC,FALSE);
DestroyObject(oTool);
}
SetLocalInt(oPC,"iToolWillBreak",iToolUsed);
string sPlant = "";
string sMessageToPC = "";
string sFailMessageToPC = "You hack at the tree for a while but do not manage to get any useable wood.";
if (sTagSelf == "PLANT_CORNSTALK")
{
sPlant = "food001"; //ear of corn
sMessageToPC = "You carefully harvest an ear of corn from the cornstalk.";
}
if (sTagSelf == "PLANT_WHEAT")
{
sPlant = "wheatgrains";
sMessageToPC = "You carefully cut the wheat stalks and gather the grain.";
}
if (sTagSelf == "PLANT_RICE")
{
sPlant = "ricegrains";
sMessageToPC = "You carefully cut the rice stalks and gather the grain.";
}
if (sTagSelf == "PLANT_OATS")
{
sPlant = "oatgrains";
sMessageToPC = "You carefully cut the oat stalks and gather the grain.";
}
if (sTagSelf == "PLANT_BARLEY")
{
sPlant = "barleygrains";
sMessageToPC = "You carefully cut the barley stalks and gather the grain.";
}
if (sTagSelf == "PLANT_SORGHUM")
{
sPlant = "sorghumgrains";
sMessageToPC = "You carefully cut the rice stalks and gather the grain.";
2024-06-14 10:48:20 -04:00
}
if (sTagSelf == "PLANT_BAMBOO")
{
sPlant = "bambooshoots";
sMessageToPC = "You carefully cut the bamboo stalks.";
}
if (sTagSelf == "PLANT_SPEARMINT")
{
sPlant = "spearmint";
sMessageToPC = "You carefully cut the spearmint stalks.";
}
if (sTagSelf == "PLANT_PEPPERMINT")
{
sPlant = "peppermint";
sMessageToPC = "You carefully cut the peppermint stalks.";
}
if (sTagSelf == "PLANT_GARLIC")
{
sPlant = "cloveofgarlic";
sMessageToPC = "You carefully gather the clove of garlic.";
}
if (sTagSelf == "PLANT_ONION")
{
sPlant = "onionbulb";
sMessageToPC = "You carefully gather an onion bulb.";
}
if (sTagSelf == "PLANT_BLUEBERRY")
{
sPlant = "blueberry";
sMessageToPC = "You carefully gather the blueberries.";
}
if (sTagSelf == "PLANT_BLACKBERRY")
{
sPlant = "blackberry";
sMessageToPC = "You carefully gather the blackberries.";
}
if (sTagSelf == "PLANT_RASPBERRY")
{
sPlant = "raspberry";
sMessageToPC = "You carefully gather the raspberries.";
}
if (sTagSelf == "PLANT_CRANBERRY")
{
sPlant = "cranberry";
sMessageToPC = "You carefully gather the cranberries.";
}
if (sTagSelf == "PLANT_GRAPEVINE1")
{
sPlant = "grapepurple";
sMessageToPC = "You carefully harvest a bunch of purple grapes.";
}
if (sTagSelf == "PLANT_GRAPEVINE2")
{
sPlant = "grapered";
sMessageToPC = "You carefully harvest a bunch of red grapes.";
}
if (sTagSelf == "PLANT_GRAPEVINE3")
{
sPlant = "grapeyellow";
sMessageToPC = "You carefully harvest a bunch of yellow grapes.";
}
if (sTagSelf == "PLANT_GOOSEBERRY")
{
sPlant = "gooseberry";
sMessageToPC = "You carefully harvest a gooseberry.";
}
if (sTagSelf == "PLANT_JUNIPERBERRY")
{
sPlant = "juniperberry";
sMessageToPC = "You carefully harvest a juniper berry.";
}
if (sTagSelf == "PLANT_MARIGOLD")
{
sPlant = "marigold";
sMessageToPC = "You carefully cut a marigold bloom from the plant.";
}
if (sTagSelf == "PLANT_SNAPDRAGON")
{
sPlant = "snapdragon";
sMessageToPC = "You carefully cut a snapdragon spike from the plant.";
}
if (sTagSelf == "PLANT_NASTURTIUM")
{
sPlant = "nasturtium";
sMessageToPC = "You carefully cut a nasturtium bloom from the plant.";
}
if (sTagSelf == "PLANT_BLACKIRIS")
{
sPlant = "blackiris";
sMessageToPC = "You carefully cut a black iris blossom from the plant.";
}
if (sTagSelf == "PLANT_YELLOWIRIS")
{
sPlant = "yellowiris";
sMessageToPC = "You carefully cut a yellow iris blossom from the plant.";
}
if (sTagSelf == "PLANT_BLUEIRIS")
{
sPlant = "blueiris";
sMessageToPC = "You carefully cut a blue iris blossom from the plant.";
}
if (sTagSelf == "PLANT_REDIRIS")
{
sPlant = "rediris";
sMessageToPC = "You carefully cut a red iris blossom from the plant.";
}
if (sTagSelf == "PLANT_WHITEIRIS")
{
sPlant = "whiteiris";
sMessageToPC = "You carefully cut a white iris blossom from the plant.";
}
if (sTagSelf == "PLANT_COTTON")
{
sPlant = "headofcotton";
sMessageToPC = "You carefully cut a head of cotton from the plant.";
}
if (sTagSelf == "PLANT_GINGER")
{
sPlant = "gingerroot";
sMessageToPC = "You carefully extract a root from the ginger plant.";
}
if (sTagSelf == "PLANT_MANDRAKE")
{
sPlant = "mandrakeroot";
sMessageToPC = "You carefully extract a root from the mandrake plant.";
}
if (sTagSelf == "PLANT_SASSAFRASS")
{
sPlant = "sassafrassroot";
sMessageToPC = "You carefully extract a root from the sassafrass plant.";
}
if (sTagSelf == "PLANT_REDTULIP")
{
sPlant = "redtulip";
sMessageToPC = "You carefully cut a red flower from the plant.";
}
if (sTagSelf == "PLANT_BLACKTULIP")
{
sPlant = "blacktulip";
sMessageToPC = "You carefully cut a black flower from the plant.";
}
if (sTagSelf == "PLANT_WHITETULIP")
{
sPlant = "whitetulip";
sMessageToPC = "You carefully cut a white flower from the plant.";
}
if (sTagSelf == "PLANT_YELLOWTULIP")
{
sPlant = "yellowtulip";
sMessageToPC = "You carefully cut a yellow flower from the plant.";
}
if (sTagSelf == "PLANT_BLUETULIP")
{
sPlant = "bluetulip";
sMessageToPC = "You carefully cut a blue flower from the plant.";
}
if (sTagSelf == "PLANT_TARRAGON")
{
sPlant = "tarragon";
sMessageToPC = "You carefully cut a sprig from the plant.";
}
if (sTagSelf == "PLANT_SAGE")
{
sPlant = "sage";
sMessageToPC = "You carefully cut a sprig from the plant.";
}
if (sTagSelf == "PLANT_LAVENDER")
{
sPlant = "lavender";
sMessageToPC = "You carefully cut a spike of flowers from the plant.";
}
if (sTagSelf == "PLANT_PERIWINKLE")
{
sPlant = "periwinkle";
sMessageToPC = "You carefully cut a flower from the plant.";
}
if (sTagSelf == "PLANT_MISTLETOE")
{
sPlant = "mistletoe";
sMessageToPC = "You carefully cut a sprig from the plant.";
}
if (sTagSelf == "PLANT_ORIENTALPOPPY")
{
sPlant = "orientalpoppy";
sMessageToPC = "You carefully cut a flower from the plant.";
}
if (sTagSelf == "PLANT_LARKSPUR")
{
sPlant = "larkspur";
sMessageToPC = "You carefully cut a sprig from the plant.";
}
if (sTagSelf == "PLANT_MAYAPPLE")
{
sPlant = "mayapple";
sMessageToPC = "You carefully remove a fruit from the plant.";
}
if (sTagSelf == "PLANT_CHIVES")
{
sPlant = "chives";
sMessageToPC = "You carefully gather some chives from the plant.";
}
if (sTagSelf == "PLANT_RADISH")
{
sPlant = "radish";
sMessageToPC = "You carefully dig up some radishes.";
}
if (sTagSelf == "PLANT_LETTUCE")
{
sPlant = "lettuce";
sMessageToPC = "You carefully remove a head of lettuce.";
}
if (sTagSelf == "PLANT_TURNIP")
{
sPlant = "turnip";
sMessageToPC = "You carefully dig up a turnip.";
}
if (sTagSelf == "PLANT_PUMPKIN")
{
sPlant = "pumpkin";
sMessageToPC = "You carefully cut a large pumpkin from the vine.";
}
if (sTagSelf == "PLANT_WATERMELON")
{
sPlant = "watermelon";
sMessageToPC = "You carefully cut a ripe, juicy watermelon from the vine.";
}
if (sTagSelf == "PLANT_WINTERSQUASH")
{
sPlant = "wintersquash";
sMessageToPC = "You carefully cut a ripe winter squash from the vine.";
}
if (sTagSelf == "PLANT_ZUCCHINISQUASH")
{
sPlant = "zucchinisquash";
sMessageToPC = "You carefully cut a ripe zucchini squash from the plant.";
}
if (sTagSelf == "PLANT_CARROT")
{
sPlant = "carrot";
sMessageToPC = "You carefully dig up some carrots.";
}
if (sTagSelf == "PLANT_POTATO")
{
sPlant = "potato";
sMessageToPC = "You carefully dig up some potatoes.";
}
if (sTagSelf == "PLANT_SWEETPOTATO")
{
sPlant = "sweetpotato";
sMessageToPC = "You carefully dig up some sweet potatoes.";
}
if (sTagSelf == "PLANT_PEANUTS")
{
sPlant = "peanuts";
sMessageToPC = "You carefully dig up a bunch of peanuts.";
}
if (sTagSelf == "PLANT_INDIANCORN")
{
sPlant = "indiancorn";
sMessageToPC = "You carefully remove an ear from the plant.";
}
if (sTagSelf == "PLANT_POPCORN")
{
sPlant = "earofpopcorn";
sMessageToPC = "You carefully remove an ear from the plant.";
}
if (sTagSelf == "PLANT_CATNIP")
{
sPlant = "catnip";
sMessageToPC = "You carefully cut a sprig from the plant.";
}
if (sTagSelf == "PLANT_GREENBEANS")
{
sPlant = "greenbeans";
sMessageToPC = "You carefully gather a bunch of beans from the plant.";
}
if (sTagSelf == "PLANT_PEAS")
{
sPlant = "peas";
sMessageToPC = "You carefully gather several pods from the plant.";
}
if (sTagSelf == "PLANT_BEETS")
{
sPlant = "beets";
sMessageToPC = "You carefully dig up some beets.";
}
if (sTagSelf == "PLANT_OREGANO")
{
sPlant = "oregano";
sMessageToPC = "You carefully cut a sprig from the plant.";
}
if (sTagSelf == "PLANT_BASIL")
{
sPlant = "basil";
sMessageToPC = "You carefully cut a sprig from the plant.";
}
if (sTagSelf == "PLANT_PARSLEY")
{
sPlant = "parsley";
sMessageToPC = "You carefully cut a sprig from the plant.";
}
if (sTagSelf == "PLANT_ARTICHOKE")
{
sPlant = "artichoke";
sMessageToPC = "You carefully cut a ripe artichoke from the plant.";
}
if (sTagSelf == "PLANT_CELERY")
{
sPlant = "celery";
sMessageToPC = "You carefully cut some stalks from the plant.";
}
if (sTagSelf == "PLANT_OKRA")
{
sPlant = "okra";
sMessageToPC = "You carefully cut some pods from the plant.";
}
if (sTagSelf == "PLANT_TOMATO")
{
sPlant = "tomato";
sMessageToPC = "You carefully select some ripe tomatoes from the vine.";
}
if (sTagSelf == "PLANT_HOPS")
{
sPlant = "seed_hops_001";
sMessageToPC = "You carefully select some ripe hops from the vine.";
}
if (sTagSelf == "PLANT_SUGARCANE")
{
sPlant = "seed_cane001";
sMessageToPC = "You carefully cut some sugarcane shoots from the plant.";
}
// BEGIN TREE DEFINITIONS HERE
int iDifficulty = 0;
if (sTagSelf == "TREE_ALMOND")
{
if (iTreeMode == 99)
{
sPlant = "almond";
sMessageToPC = "You carefully harvest some ripe almonds.";
}
else
{
iDifficulty = 250;
sPlant = "wood001";
sMessageToPC = "You have chopped an almond log from the tree.";
}
}
if (sTagSelf == "TREE_BIRCH")
{
if (iTreeMode == 99)
{
sPlant = "";
sMessageToPC = "";
}
else
{
iDifficulty = 350;
sPlant = "wood002";
sMessageToPC = "You have chopped a birch log from the tree.";
}
}
if (sTagSelf == "TREE_ELM")
{
if (iTreeMode == 99)
{
sPlant = "";
sMessageToPC = "";
}
else
{
iDifficulty = 450;
sPlant = "wood003";
sMessageToPC = "You have chopped an elm log from the tree.";
}
}
if (sTagSelf == "TREE_WILLOW")
{
if (iTreeMode == 99)
{
sPlant = "";
sMessageToPC = "";
}
else
{
iDifficulty = 100;
sPlant = "wood004";
sMessageToPC = "You have chopped a willow branch from the tree.";
}
}
if (sTagSelf == "TREE_OAK")
{
if (iTreeMode == 99)
{
sPlant = "acorn";
sMessageToPC = "You carefully harvest some ripe acorns.";
}
else
{
iDifficulty = 500;
sPlant = "wood005";
sMessageToPC = "You have chopped an oak log from the tree.";
}
}
if (sTagSelf == "TREE_ORANGE")
{
if (iTreeMode == 99)
{
sPlant = "orange";
sMessageToPC = "You carefully harvest some ripe oranges.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the tree.";
}
}
if (sTagSelf == "TREE_GREENAPPLE")
{
if (iTreeMode == 99)
{
sPlant = "greenapple";
sMessageToPC = "You carefully harvest some ripe green apples.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the tree.";
}
}
if (sTagSelf == "TREE_YELLOWAPPLE")
{
if (iTreeMode == 99)
{
sPlant = "yellowapple";
sMessageToPC = "You carefully harvest some ripe yellow apples.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the tree.";
}
}
if (sTagSelf == "TREE_REDAPPLE")
{
if (iTreeMode == 99)
{
sPlant = "redapple";
sMessageToPC = "You carefully harvest some ripe red apples.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the tree.";
}
}
if (sTagSelf == "TREE_PLUM")
{
if (iTreeMode == 99)
{
sPlant = "plum";
sMessageToPC = "You carefully harvest some ripe plums.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the tree.";
}
}
if (sTagSelf == "TREE_PEAR")
{
if (iTreeMode == 99)
{
sPlant = "pear";
sMessageToPC = "You carefully harvest some ripe pears.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the tree.";
}
}
if (sTagSelf == "TREE_TANGARINE")
2024-06-14 10:48:20 -04:00
{
if (iTreeMode == 99)
{
sPlant = "tangarine";
2024-06-14 10:48:20 -04:00
sMessageToPC = "You carefully harvest some ripe tangarines.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the tree.";
}
}
if (sTagSelf == "TREE_GRAPEFRUIT")
{
if (iTreeMode == 99)
{
sPlant = "grapefruit";
sMessageToPC = "You carefully harvest some ripe grapefruit.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the tree.";
}
}
if (sTagSelf == "TREE_ELDERBERRY")
{
if (iTreeMode == 99)
{
sPlant = "elderberry";
sMessageToPC = "You carefully harvest some ripe elder berries.";
}
else
{
iDifficulty = 400;
sPlant = "wood007";
sMessageToPC = "You have chopped an elder log from the tree.";
}
}
if (sTagSelf == "TREE_CHERRY")
{
if (iTreeMode == 99)
{
sPlant = "cherry";
sMessageToPC = "You carefully harvest some ripe cherries.";
}
else
{
iDifficulty = 200;
sPlant = "wood008";
sMessageToPC = "You have chopped a cherry log from the tree.";
}
}
if (sTagSelf == "TREE_PECAN")
{
if (iTreeMode == 99)
{
sPlant = "pecan";
sMessageToPC = "You carefully harvest some ripe pecans.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the tree.";
}
}
if (sTagSelf == "TREE_FIG")
{
if (iTreeMode == 99)
{
sPlant = "fig";
sMessageToPC = "You carefully harvest some ripe figs.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the tree.";
}
}
if (sTagSelf == "TREE_LEMON")
{
if (iTreeMode == 99)
{
sPlant = "lemon";
sMessageToPC = "You carefully harvest some ripe lemons.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the tree.";
}
}
if (sTagSelf == "TREE_LIME")
{
if (iTreeMode == 99)
{
sPlant = "lime";
sMessageToPC = "You carefully harvest some ripe limes.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the tree.";
}
}
if (sTagSelf == "TREE_WALNUT")
{
if (iTreeMode == 99)
{
sPlant = "walnut";
sMessageToPC = "You carefully harvest some ripe walnuts.";
}
else
{
iDifficulty = 400;
sPlant = "wood009";
sMessageToPC = "You have chopped a walnut log from the tree.";
}
}
if (sTagSelf == "TREE_OLIVE")
{
if (iTreeMode == 99)
{
sPlant = "olive";
sMessageToPC = "You carefully harvest some ripe olives.";
}
else
{
iDifficulty = 150;
sPlant = "wood010";
sMessageToPC = "You have chopped an olive branch from the tree.";
}
}
if (sTagSelf == "TREE_YEW")
{
if (iTreeMode == 99)
{
sPlant = "";
sMessageToPC = "";
}
else
{
iDifficulty = 550;
sPlant = "wood011";
sMessageToPC = "You have chopped a yew log from the tree.";
}
}
if (sTagSelf == "TREE_MAPLE")
{
if (iTreeMode == 99)
{
sPlant = "maplesap";
sMessageToPC = "You carefully tap the tree and gather some fresh maple sap.";
}
else
{
iDifficulty = 200;
sPlant = "wood012";
sMessageToPC = "You have chopped a maple log from the tree.";
}
}
if (sTagSelf == "TREE_MANGO")
{
if (iTreeMode == 99)
{
sPlant = "mango";
sMessageToPC = "You carefully harvest some ripe mangos.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the tree.";
}
}
if (sTagSelf == "TREE_KIWI")
{
if (iTreeMode == 99)
{
sPlant = "kiwi";
sMessageToPC = "You carefully harvest some ripe kiwis.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the tree.";
}
}
if (sTagSelf == "TREE_COCONUT")
{
if (iTreeMode == 99)
{
sPlant = "coconut";
sMessageToPC = "You carefully harvest some ripe coconuts.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the palm tree.";
}
}
if (sTagSelf == "TREE_PINE")
{
if (iTreeMode == 99)
{
sPlant = "pinecone";
sMessageToPC = "You carefully gather a few pinecones.";
}
else
{
iDifficulty = 100;
sPlant = "wood013";
sMessageToPC = "You have chopped a pine log from the tree.";
}
}
if (sTagSelf == "TREE_FIR")
{
if (iTreeMode == 99)
{
sPlant = "";
sMessageToPC = "";
}
else
{
iDifficulty = 100;
sPlant = "wood014";
sMessageToPC = "You have chopped a fir log from the tree.";
}
}
if (sTagSelf == "TREE_SAUSAGE")
{
if (iTreeMode == 99)
{
sPlant = "sausagefruit";
sMessageToPC = "You carefully harvest some ripe sausage fruits.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the tree.";
}
}
if (sTagSelf == "TREE_DATE")
{
if (iTreeMode == 99)
{
sPlant = "date";
sMessageToPC = "You carefully harvest some ripe dates.";
}
else
{
sPlant = "wood006";
sMessageToPC = "You have chopped a log from the tree.";
}
}
if (sTagSelf == "TREE_MAHOGANY")
{
if (iTreeMode == 99)
{
sPlant = "";
sMessageToPC = "";
}
else
{
iDifficulty = 500;
sPlant = "wood015";
sMessageToPC = "You have chopped a mahogany log from the tree.";
}
}
if (sTagSelf == "TREE_HICKORY")
{
if (iTreeMode == 99)
{
sPlant = "";
sMessageToPC = "";
}
else
{
iDifficulty = 300;
sPlant = "wood016";
sMessageToPC = "You have chopped a hickory log from the tree.";
}
}
if (sTagSelf == "TREE_REDWOOD")
{
if (iTreeMode == 99)
{
sPlant = "";
sMessageToPC = "";
}
else
{
iDifficulty = 600;
sPlant = "wood017";
sMessageToPC = "You have chopped a redwood log from the tree.";
}
}
if (sTagSelf == "TREE_IRONWOOD")
{
if (iTreeMode == 99)
{
sPlant = "";
sMessageToPC = "";
}
else
{
iDifficulty = 700;
sPlant = "wood018";
sMessageToPC = "You have chopped an ironwood log from the tree.";
}
}
if (sTagSelf == "TREE_MANGROVE")
{
if (iTreeMode == 99)
{
sPlant = "";
sMessageToPC = "";
}
else
{
iDifficulty = 100;
sPlant = "wood019";
sMessageToPC = "You have chopped a mangrove log from the tree.";
}
}
if (sPlant == "") sMessageToPC = "There is nothing to gather from this with the tool being used.";
2024-06-14 10:48:20 -04:00
int iPlantMax = GetLocalInt(oSelf,"iMaxPlant");
int iFarmChance = 0;
int iFarmSkill = 0;
int iSuccess = 0;
int iSkillGain = 0;
if (iPlantType ==1) // herbs and growable plants
{
CreateItemOnObject(sPlant,oPC,1);
FloatingTextStringOnCreature(sMessageToPC,oPC,FALSE);
if (iPlantMax == 0)
{
//iFarmSkill = GetTokenPair(oPC,14,6);
iFarmSkill = GetCampaignInt("UOACraft","iFarmSkill",oPC);
2024-06-14 10:48:20 -04:00
iFarmChance = iFarmSkill;
if (iFarmChance <350)
{
iFarmChance = GetAbilityScore(oPC,ABILITY_WISDOM)*5;
iFarmChance = iFarmChance + (GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*3);
iFarmChance = iFarmChance+ (GetAbilityScore(oPC,ABILITY_CHARISMA)*2);
iFarmChance = iFarmChance *3;
if (iFarmChance > 350) iFarmChance = 350;
}
iPlantMax = Random(2);
iPlantMax = iPlantMax + (iFarmChance/200);
if (Random(1000)<= iFarmChance) iPlantMax++;
if (Random(1000)<= iFarmChance) iPlantMax++;
SetLocalInt(oSelf,"iMaxPlant",iPlantMax);
}
}
if (iPlantType ==2) //trees and lumberjacking
{
if (iTreeMode == 0)
{
//iFarmSkill = GetTokenPair(oPC,14,7);
iFarmSkill = GetCampaignInt("UOACraft","iLumberjackSkill",oPC);
2024-06-14 10:48:20 -04:00
iFarmChance = iFarmSkill;
if (iFarmChance <350)
{
iFarmChance = GetAbilityScore(oPC,ABILITY_STRENGTH)*5;
iFarmChance = iFarmChance + (GetAbilityScore(oPC,ABILITY_DEXTERITY)*3);
iFarmChance = iFarmChance+ (GetAbilityScore(oPC,ABILITY_CONSTITUTION)*2);
iFarmChance = iFarmChance *3;
if (iFarmChance > 350) iFarmChance = 350;
}
}
else
{
//iFarmSkill = GetTokenPair(oPC,14,6);
iFarmSkill = GetCampaignInt("UOACraft","iFarmSkill",oPC);
2024-06-14 10:48:20 -04:00
iFarmChance = iFarmSkill;
if (iFarmChance <350)
{
iFarmChance = GetAbilityScore(oPC,ABILITY_WISDOM)*5;
iFarmChance = iFarmChance + (GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*3);
iFarmChance = iFarmChance+ (GetAbilityScore(oPC,ABILITY_CHARISMA)*2);
iFarmChance = iFarmChance *3;
if (iFarmChance > 350) iFarmChance = 350;
}
}
if (iPlantMax == 0)
{
iPlantMax = Random(10);
iPlantMax = iPlantMax + (iFarmChance/200);
if (Random(1000)<= iFarmChance) iPlantMax = iPlantMax+10;
if (iFarmChance >= 500) iPlantMax = iPlantMax+5;
if (iFarmChance >= 750) iPlantMax = iPlantMax+5;
if (iFarmChance >= 950) iPlantMax = iPlantMax+10;
if (iFarmChance == 1000) iPlantMax = iPlantMax+10;
SetLocalInt(oSelf,"iMaxPlant",iPlantMax);
}
if (iTreeMode == 0)
{
int iRandom = Random(1000);
iFarmChance = iFarmChance - iDifficulty;
if (iFarmChance <1)
{
FloatingTextStringOnCreature("You have no idea how to cut this type of wood.",oPC,1);
return;
}
if (iRandom <= iFarmChance)
{
CreateItemOnObject(sPlant,oPC,1);
2024-06-14 10:48:20 -04:00
FloatingTextStringOnCreature(sMessageToPC,oPC,FALSE);
if (Random(1000)>=iFarmSkill)
{
if (d10(1)+1 >= iFarmChance/100) iSkillGain = 1;
}
}
else
{
FloatingTextStringOnCreature(sFailMessageToPC,oPC,FALSE);
return;
}
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
if (iSkillGain ==1)
{
if (GetLocalInt(oPC,"iSkillGain")!= 0)
{
iSkillGain = 0;
}
else
{
SetLocalInt(oPC,"iSkillGain",99);
AssignCommand(oPC,DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0)));
}
}
if (iSkillGain == 1)
{
string sOldSkill = "";
string sOldSkill2 = "";
iFarmSkill++;
sOldSkill2 = IntToString(iFarmSkill);
sOldSkill = "."+GetStringRight(sOldSkill2,1);
if (iFarmSkill > 9)
{
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
}
else
{
sOldSkill = "0"+sOldSkill;
}
if (iFarmSkill <= 1000)
{
//DelayCommand(5.0,SetTokenPair(oPC,14,7,iFarmSkill));
DelayCommand(6.0,SetCampaignInt("UOACraft","iLumberjackSkill",iFarmSkill,oPC));
2024-06-14 10:48:20 -04:00
DelayCommand(6.0,SendMessageToPC(oPC,"=================================="));
DelayCommand(6.0,SendMessageToPC(oPC,"Your Lumberjack skill has gone up!"));
DelayCommand(6.0,SendMessageToPC(oPC,"Current Lumberjack skill : "+ sOldSkill+"%"));
DelayCommand(6.0,SendMessageToPC(oPC,"=================================="));
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(5.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
}
}
} // end treemode = 0
if (iTreeMode != 0)
{
CreateItemOnObject(sPlant,oPC,1);
FloatingTextStringOnCreature(sMessageToPC,oPC,FALSE);
}
} // end planttype = 2
int iPlantCurrent = GetLocalInt(oSelf,"iCurrentPlant");
iPlantCurrent++;
if (iPlantCurrent >= iPlantMax)
{
ExecuteScript("_kill_plant",oSelf);
DestroyObject(oSelf);
}
SetLocalInt(oSelf,"iCurrentPlant",iPlantCurrent);
}