Added CCOH and missing areas Changed some areas to be craftable, Fixed some on death issues, Fixed the Gaurd
365 lines
8.2 KiB
Plaintext
365 lines
8.2 KiB
Plaintext
//#include "_persist_01a"
|
|
|
|
void main()
|
|
{
|
|
object oPC = GetLastAttacker(OBJECT_SELF);
|
|
if (oPC==OBJECT_INVALID) oPC = GetLastDamager();
|
|
if (oPC==OBJECT_INVALID) return;
|
|
object oWeapon = OBJECT_INVALID;
|
|
|
|
|
|
string sMyTag = GetTag(OBJECT_SELF);
|
|
string sItemResRef = "";
|
|
string sOreType = "";
|
|
int iRandom = Random(1000);
|
|
int iSkillGain = 0;
|
|
string sOldSkill = "";
|
|
string sOldSkill2 = "";
|
|
int iTemp = 0;
|
|
int iSuccess = 0;
|
|
|
|
|
|
oWeapon = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC);
|
|
if (GetTag(oWeapon)!= "MINERS_PICK")
|
|
{
|
|
oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
|
|
if (GetTag(oWeapon)!= "MINERS_PICK")
|
|
{
|
|
FloatingTextStringOnCreature("You must have a pickaxe or a miner's pick equipped in order to mine!",oPC);
|
|
return;
|
|
}
|
|
}
|
|
int iTotalPickUsed = GetLocalInt(oWeapon,"iPickUsed");
|
|
//int iMineChance = GetTokenPair(oPC,14,1);
|
|
int iMineChance = GetCampaignInt("UOACraft","iMiningSkill",oPC);
|
|
|
|
if (iMineChance < 350)
|
|
{
|
|
iTemp = GetAbilityScore(oPC,ABILITY_STRENGTH)*5;
|
|
iTemp = iTemp + (GetAbilityScore(oPC, ABILITY_INTELLIGENCE)*2);
|
|
iTemp = iTemp + (GetAbilityScore(oPC,ABILITY_DEXTERITY)*3);
|
|
iTemp = iTemp*3;
|
|
if (iTemp >350) iTemp = 350;
|
|
}
|
|
|
|
if (iMineChance > iTemp)
|
|
{
|
|
if (iRandom <= iMineChance) iSuccess = 1;
|
|
}
|
|
else
|
|
{
|
|
if (iRandom <= iTemp) iSuccess = 1;
|
|
}
|
|
|
|
if (iSuccess == 0)
|
|
{
|
|
if (d12(1) == 1)
|
|
{
|
|
switch (d8(1))
|
|
{
|
|
case 1:{FloatingTextStringOnCreature("You dig and find nothing.",oPC,FALSE);break;}
|
|
case 2:{FloatingTextStringOnCreature("Your back aches...",oPC,FALSE);break;}
|
|
case 3:{FloatingTextStringOnCreature("You know there has to be ore here somewhere..",oPC,FALSE);break;}
|
|
case 4:{FloatingTextStringOnCreature("Your arms are tired...",oPC,FALSE);break;}
|
|
case 5:{FloatingTextStringOnCreature("You dig and dig and dig...",oPC,FALSE);break;}
|
|
case 6:{FloatingTextStringOnCreature("Fragments of stone and earth pile up at your feet...",oPC,FALSE);break;}
|
|
case 7:{FloatingTextStringOnCreature("You pause to sharpen your digging tool...",oPC,FALSE);break;}
|
|
default:{FloatingTextStringOnCreature("You dig and dig some more...",oPC,FALSE);break;}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
int iRemaining = GetLocalInt(OBJECT_SELF,"iRemaining");
|
|
if (iRemaining==0)
|
|
{
|
|
iRemaining = d4(3)+11;
|
|
SetLocalInt(OBJECT_SELF,"iRemaining",iRemaining);
|
|
}
|
|
if (iRemaining==1) return;
|
|
|
|
iRandom = Random(1000);
|
|
if (iRandom >= iMineChance)
|
|
{
|
|
if (d10(1)+1 >= iMineChance/100) iSkillGain = 1;
|
|
}
|
|
|
|
//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)
|
|
{
|
|
iMineChance++;
|
|
sOldSkill2 = IntToString(iMineChance);
|
|
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
|
if (iMineChance > 9)
|
|
{
|
|
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
|
}
|
|
else
|
|
{
|
|
sOldSkill = "0"+sOldSkill;
|
|
}
|
|
if (iMineChance <= 1000)
|
|
{
|
|
//SetTokenPair(oPC,14,1,iMineChance);
|
|
SetCampaignInt("UOACraft","iMiningSkill",iMineChance,oPC);
|
|
SendMessageToPC(oPC,"=================================");
|
|
SendMessageToPC(oPC,"Your skill in mining has gone up!");
|
|
SendMessageToPC(oPC,"Current mining skill : "+ sOldSkill+"%");
|
|
SendMessageToPC(oPC,"=================================");
|
|
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP"));
|
|
}
|
|
}
|
|
|
|
if (sMyTag == "MINE_IRON")
|
|
{
|
|
sItemResRef = "ore001";
|
|
sOreType = "Iron";
|
|
}
|
|
|
|
if (sMyTag == "MINE_DULL")
|
|
{
|
|
sItemResRef = "ore001";
|
|
sOreType = "Iron";
|
|
if (iMineChance >=650)
|
|
{
|
|
if (d10(1)>4)
|
|
{
|
|
sItemResRef = "ore002";
|
|
sOreType = "Dull Copper";
|
|
}
|
|
}
|
|
}
|
|
|
|
if (sMyTag == "MINE_SHADOW")
|
|
{
|
|
sItemResRef = "ore001";
|
|
sOreType = "Iron";
|
|
if (iMineChance >=700)
|
|
{
|
|
if (d10(1)>4)
|
|
{
|
|
sItemResRef = "ore003";
|
|
sOreType = "Shadow Iron";
|
|
}
|
|
}
|
|
}
|
|
|
|
if (sMyTag == "MINE_COPPER")
|
|
{
|
|
sItemResRef = "ore001";
|
|
sOreType = "Iron";
|
|
if (iMineChance >=750)
|
|
{
|
|
if (d10(1)>4)
|
|
{
|
|
sItemResRef = "ore004";
|
|
sOreType = "Copper";
|
|
}
|
|
}
|
|
}
|
|
|
|
if (sMyTag == "MINE_BRONZE")
|
|
{
|
|
sItemResRef = "ore001";
|
|
sOreType = "Iron";
|
|
if (iMineChance >=800)
|
|
{
|
|
if (d10(1)>4)
|
|
{
|
|
sItemResRef = "ore005";
|
|
sOreType = "Bronze";
|
|
}
|
|
}
|
|
}
|
|
|
|
if (sMyTag == "MINE_GOLD")
|
|
{
|
|
sItemResRef = "ore001";
|
|
sOreType = "Iron";
|
|
if (iMineChance >=850)
|
|
{
|
|
if (d10(1)>4)
|
|
{
|
|
sItemResRef = "ore006";
|
|
sOreType = "Gold";
|
|
}
|
|
}
|
|
}
|
|
|
|
if (sMyTag == "MINE_AGAPITE")
|
|
{
|
|
sItemResRef = "ore001";
|
|
sOreType = "Iron";
|
|
if (iMineChance >=900)
|
|
{
|
|
if (d10(1)>4)
|
|
{
|
|
sItemResRef = "ore007";
|
|
sOreType = "Agapite";
|
|
}
|
|
}
|
|
}
|
|
|
|
if (sMyTag == "MINE_VERITE")
|
|
{
|
|
sItemResRef = "ore001";
|
|
sOreType = "Iron";
|
|
if (iMineChance >=950)
|
|
{
|
|
if (d10(1)>4)
|
|
{
|
|
sItemResRef = "ore008";
|
|
sOreType = "Verite";
|
|
}
|
|
}
|
|
}
|
|
|
|
if (sMyTag == "MINE_VALORITE")
|
|
{
|
|
sItemResRef = "ore001";
|
|
sOreType = "Iron";
|
|
if (iMineChance >=990)
|
|
{
|
|
if (d10(1)>4)
|
|
{
|
|
sItemResRef = "ore009";
|
|
sOreType = "Valorite";
|
|
}
|
|
}
|
|
}
|
|
|
|
if (sMyTag == "MINE_SILVER")
|
|
{
|
|
sItemResRef = "ore001";
|
|
sOreType = "Iron";
|
|
if (iMineChance >=770)
|
|
{
|
|
if (d10(1)>4)
|
|
{
|
|
sItemResRef = "ore010";
|
|
sOreType = "Silver";
|
|
}
|
|
}
|
|
}
|
|
|
|
if (sMyTag == "MINE_MITHRIL")
|
|
{
|
|
sItemResRef = "ore001";
|
|
sOreType = "Iron";
|
|
if (iMineChance >=950)
|
|
{
|
|
if (d10(1)>4)
|
|
{
|
|
sItemResRef = "ore011";
|
|
sOreType = "Mithril";
|
|
}
|
|
}
|
|
}
|
|
|
|
if (sMyTag == "MINE_ADAMANTITE")
|
|
{
|
|
sItemResRef = "ore001";
|
|
sOreType = "Iron";
|
|
if (iMineChance >=990)
|
|
{
|
|
if (d10(1)>4)
|
|
{
|
|
sItemResRef = "ore012";
|
|
sOreType = "Adamantite";
|
|
}
|
|
}
|
|
}
|
|
|
|
if (sMyTag == "MINE_PLATINUM")
|
|
{
|
|
sItemResRef = "ore001";
|
|
sOreType = "Iron";
|
|
if (iMineChance >=900)
|
|
{
|
|
if (d10(1)>4)
|
|
{
|
|
sItemResRef = "ore013";
|
|
sOreType = "Platinum";
|
|
}
|
|
}
|
|
}
|
|
|
|
if (sMyTag == "_UOA_DepositofCoal")
|
|
{
|
|
sItemResRef = "item_coal";
|
|
sOreType = "Lump of Coal";
|
|
//if (iMineChance >=900)
|
|
// {
|
|
// if (d10(1)>4)
|
|
// {
|
|
// sItemResRef = "ore013";
|
|
// sOreType = "Platinum";
|
|
// }
|
|
// }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CreateItemOnObject(sItemResRef,oPC,1);
|
|
iRemaining=iRemaining-1;
|
|
SetLocalInt(OBJECT_SELF,"iRemaining",iRemaining);
|
|
if (iRemaining==1)
|
|
{
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(1000,DAMAGE_TYPE_MAGICAL,DAMAGE_POWER_NORMAL),OBJECT_SELF);
|
|
}
|
|
|
|
if (sOreType!="Lump of Coal")
|
|
{
|
|
FloatingTextStringOnCreature("You dig up some "+sOreType+" ore.",oPC,FALSE);
|
|
}
|
|
else
|
|
{
|
|
FloatingTextStringOnCreature("You dig up a "+sOreType+".",oPC,FALSE);
|
|
}
|
|
if (Random(1000)<=50)
|
|
{
|
|
int iGemType = 1;
|
|
int iCount = 5;
|
|
for (iCount; iCount>0; iCount--)
|
|
{
|
|
if (Random(1000)>200) break;
|
|
iGemType++;
|
|
}
|
|
CreateItemOnObject("gemstone00"+IntToString(iGemType),oPC,1);
|
|
AssignCommand(oPC,DelayCommand(1.0,FloatingTextStringOnCreature("... and an unknown gemstone.",oPC,FALSE)));
|
|
}
|
|
//AssignCommand(oPC,DelayCommand(1.5,ClearAllActions()));
|
|
|
|
// ensure "iSkillGain" oPC variable is not perma-set to 99 thus preventing all skill gains
|
|
if (GetLocalInt(oPC,"iSkillGain")!=0) AssignCommand(oPC,DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0)));
|
|
|
|
iTotalPickUsed++;
|
|
if (iTotalPickUsed >100)
|
|
{
|
|
FloatingTextStringOnCreature("Your pick has broken while digging..",oPC,FALSE);
|
|
DestroyObject(oWeapon);
|
|
iTotalPickUsed = 0;
|
|
}
|
|
else
|
|
{
|
|
SetLocalInt(oWeapon,"iPickUsed",iTotalPickUsed);
|
|
}
|
|
}
|