Fixed CCOH, Fixed starting GP, Fixed DMFI languages, Fix cep weapon appearances, Fixed new player start up system. Added PC deleter. Added ACP 4.1. Full compile. Updated release archive.
406 lines
13 KiB
Plaintext
406 lines
13 KiB
Plaintext
//#include "_persist_01a"
|
|
|
|
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
|
void SpinNextItemPossessedBy(object oSelf, object oPC, string sItemTag);
|
|
|
|
void main()
|
|
{
|
|
object oPC = GetLastDisturbed();
|
|
object oSelf = OBJECT_SELF;
|
|
object oItem = GetInventoryDisturbItem();
|
|
string sItemTag = GetTag(oItem);
|
|
int iSpinMode = GetLocalInt(oPC,"iSpinMode");
|
|
int iType = 0;
|
|
|
|
if (GetInventoryDisturbType()!= INVENTORY_DISTURB_TYPE_ADDED)
|
|
{
|
|
if (GetTag(oItem)=="SWITCH_SPIN_ALL") //switch to automatic spin cycle
|
|
{
|
|
SetLocalInt(oPC,"iSpinMode",99);
|
|
FloatingTextStringOnCreature("Switching to automatic mode. Insert cotton, silk, or wool to begin.",oPC,FALSE);
|
|
CreateItemOnObject("flagswitch057",OBJECT_SELF,1);
|
|
}
|
|
if (GetTag(oItem)=="SWITCH_SPIN_ONE") //Switch to manual spin cycle mode
|
|
{
|
|
SetLocalInt(oPC,"iSpinMode",0);
|
|
FloatingTextStringOnCreature("Switching to manual spin mode. Drag and Drop one at a time.",oPC,FALSE);
|
|
CreateItemOnObject("flagswitch056",OBJECT_SELF,1);
|
|
}
|
|
DestroyObject(oItem);
|
|
return;
|
|
}
|
|
|
|
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
|
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
|
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
|
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
|
return;
|
|
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
|
{
|
|
DestroyObject(oItem);
|
|
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
|
return;
|
|
}
|
|
// End of compatability portion.
|
|
|
|
if (GetLocalInt(OBJECT_SELF,"iAmInUse") != 0)
|
|
{
|
|
CopyItem(oItem,oPC,TRUE);
|
|
SendMessageToPC(oPC,"You must wait until the spinning is complete before starting to spin a new one.");
|
|
DestroyObject(oItem);
|
|
return;
|
|
}
|
|
|
|
string sItemResRef = "";
|
|
string sSuccess = "";
|
|
string sSuccess2 = "";
|
|
string sComponent = "";
|
|
|
|
// Determine what we are making based on what was dropped into the spinning wheel
|
|
if (sItemTag=="ITEM_COTTON")
|
|
{
|
|
iType = 1;
|
|
sItemResRef = "thread001";
|
|
sSuccess2 = "cotton thread.";
|
|
sComponent = "cotton";
|
|
}
|
|
if (sItemTag=="ITEM_WOOL")
|
|
{
|
|
iType = 2;
|
|
sItemResRef = "thread002";
|
|
sSuccess2 = "wool yarn.";
|
|
sComponent = "wool";
|
|
}
|
|
if (sItemTag=="ITEM_SPIDERSILK")
|
|
{
|
|
iType = 3;
|
|
sItemResRef = "thread003";
|
|
sSuccess2 = "silk thread.";
|
|
sComponent = "spider silk";
|
|
}
|
|
|
|
if (iType==0)
|
|
{
|
|
FloatingTextStringOnCreature("You cannot make anything out of that with a spinning wheel!",oPC,FALSE);
|
|
CopyItem(oItem,oPC,TRUE);
|
|
DestroyObject(oItem);
|
|
return;
|
|
}
|
|
|
|
DestroyObject(oItem);
|
|
|
|
|
|
//int iSpindleSkill = GetTokenPair(oPC,13,10);
|
|
int iSpindleSkill = GetCampaignInt("UOACraft","iSpindleSkill",oPC);
|
|
int iSpindleChance = iSpindleSkill;
|
|
int iSuccess = 0;
|
|
int iSuccess2 = 0;
|
|
int iSkillGain = 0;
|
|
|
|
if (iSpindleChance <350)
|
|
{
|
|
iSpindleChance = GetAbilityScore(oPC,ABILITY_DEXTERITY)*5;
|
|
iSpindleChance = iSpindleChance +(GetAbilityScore(oPC,ABILITY_CONSTITUTION)*3);
|
|
iSpindleChance = iSpindleChance +(GetAbilityScore(oPC,ABILITY_WISDOM)*2);
|
|
iSpindleChance = iSpindleChance * 3;
|
|
if (iSpindleChance >350) iSpindleChance = 350;
|
|
if (iSpindleSkill > iSpindleChance) iSpindleChance = iSpindleSkill;
|
|
}
|
|
|
|
iSpindleChance = iSpindleChance - (iType*20);
|
|
|
|
if (iSpindleChance <1)
|
|
{
|
|
FloatingTextStringOnCreature("You do not have enough skill to spin that into anything!",oPC,FALSE);
|
|
CopyItem(oItem,oPC,TRUE);
|
|
DestroyObject(oItem);
|
|
return;
|
|
}
|
|
|
|
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
|
DelayCommand(10.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
|
//AssignCommand(oPC,PlaySound("as_na_splash2"));
|
|
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,10.0));
|
|
|
|
if (Random(1000) <= iSpindleChance)
|
|
{
|
|
iSuccess = 1;
|
|
iSuccess2 = 1;
|
|
iSpindleChance = iSpindleChance - 50;
|
|
if (Random(1000) <= iSpindleChance) iSuccess2 = iSuccess2+2;
|
|
iSpindleChance = iSpindleChance-100;
|
|
if (Random(1000) <= iSpindleChance) iSuccess2 = iSuccess2+2;
|
|
iSpindleChance = iSpindleChance + 150;
|
|
}
|
|
|
|
if (iSuccess <1)
|
|
{
|
|
iSuccess=1;
|
|
iSuccess2=1; // Player will *always* get a minimum of 1 product. This is a lossless skill.
|
|
}
|
|
if (iSuccess2>1) iSuccess2 = Random(iSuccess2)+1; // Random number of end product. (Maximum number is defined by iSuccess2)
|
|
|
|
sSuccess = "You carefully spin the "+sComponent+" into "+IntToString(iSuccess2);
|
|
if (iType==2)
|
|
{
|
|
sSuccess = sSuccess+" ball";
|
|
}
|
|
else
|
|
{
|
|
sSuccess = sSuccess+" spindle";
|
|
}
|
|
if (iSuccess2>1) sSuccess = sSuccess+"s";
|
|
sSuccess = sSuccess + " of "+sSuccess2;
|
|
|
|
float fDelay = 1.0;
|
|
|
|
// Do visual and sound effects
|
|
int iLoop = 9;
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_IMP_HEAD_HEAL,FALSE),oSelf,1.0);
|
|
for (iLoop; iLoop>0; iLoop--)
|
|
{
|
|
DelayCommand(fDelay,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_IMP_HEAD_HEAL,FALSE),oSelf,1.0));
|
|
DelayCommand(fDelay+0.5,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_IMP_HEAD_NATURE,FALSE),oSelf,1.0));
|
|
AssignCommand(oPC,DelayCommand(fDelay,PlaySound("as_cv_shopmetal2")));
|
|
fDelay = fDelay+1.0;
|
|
}
|
|
PlaySound("as_cv_millwheel1");
|
|
PlaySound("al_cv_pump");
|
|
DelayCommand(3.0,PlaySound("al_cv_pump"));
|
|
DelayCommand(6.0,PlaySound("al_cv_pump"));
|
|
DelayCommand(3.0,PlaySound("as_cv_millwheel1"));
|
|
DelayCommand(fDelay,FloatingTextStringOnCreature(sSuccess,oPC,FALSE));
|
|
for (iSuccess2; iSuccess2>0; iSuccess2--)
|
|
{
|
|
fDelay = fDelay+0.1;
|
|
DelayCommand(fDelay,CreateAnObject(sItemResRef,oPC,1));
|
|
}
|
|
|
|
if (Random(1000) >= iSpindleSkill)
|
|
{
|
|
if (d10(1)+1 >= iSpindleChance/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);
|
|
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
|
}
|
|
}
|
|
|
|
if (iSpinMode==99) DelayCommand(11.0,SpinNextItemPossessedBy(oSelf,oPC,sItemTag));
|
|
|
|
if (iSkillGain ==1)
|
|
{
|
|
string sOldSkill = "";
|
|
string sOldSkill2 = "";
|
|
iSpindleSkill++;
|
|
sOldSkill2 = IntToString(iSpindleSkill);
|
|
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
|
if (iSpindleSkill > 9)
|
|
{
|
|
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
|
}
|
|
else
|
|
{
|
|
sOldSkill = "0"+sOldSkill;
|
|
}
|
|
if (iSpindleSkill <= 1000)
|
|
{
|
|
//DelayCommand(10.0,SetTokenPair(oPC,13,10,iSpindleSkill));
|
|
DelayCommand(10.0,SetCampaignInt("UOACraft","iSpindleSkill",iSpindleSkill,oPC));
|
|
DelayCommand(10.0,SendMessageToPC(oPC,"==================================="));
|
|
DelayCommand(10.0,SendMessageToPC(oPC,"Your skill in spindling has gone up!"));
|
|
DelayCommand(10.0,SendMessageToPC(oPC,"Current spindling skill : "+ sOldSkill+"%"));
|
|
DelayCommand(10.0,SendMessageToPC(oPC,"==================================="));
|
|
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(9.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
|
{
|
|
CreateItemOnObject(sResource,oPC,iStackSize);
|
|
return;
|
|
}
|
|
|
|
void SpinNextItemPossessedBy(object oSelf, object oPC, string sItemTag)
|
|
{
|
|
object oItem = GetItemPossessedBy(oPC,sItemTag);
|
|
if (oItem==OBJECT_INVALID) return;
|
|
if (GetDistanceBetween(oPC,oSelf)>3.0) return; //PC moved away -- prevents multiple skill craft utilization
|
|
int iType = 0;
|
|
string sItemResRef = "";
|
|
string sSuccess = "";
|
|
string sSuccess2 = "";
|
|
string sComponent = "";
|
|
|
|
// Determine what we are making based on what was dropped into the spinning wheel
|
|
if (sItemTag=="ITEM_COTTON")
|
|
{
|
|
iType = 1;
|
|
sItemResRef = "thread001";
|
|
sSuccess2 = "cotton thread.";
|
|
sComponent = "cotton";
|
|
}
|
|
if (sItemTag=="ITEM_WOOL")
|
|
{
|
|
iType = 2;
|
|
sItemResRef = "thread002";
|
|
sSuccess2 = "wool yarn.";
|
|
sComponent = "wool";
|
|
}
|
|
if (sItemTag=="ITEM_SPIDERSILK")
|
|
{
|
|
iType = 3;
|
|
sItemResRef = "thread003";
|
|
sSuccess2 = "silk thread.";
|
|
sComponent = "spider silk";
|
|
}
|
|
|
|
DestroyObject(oItem);
|
|
|
|
|
|
//int iSpindleSkill = GetTokenPair(oPC,13,10);
|
|
int iSpindleSkill = GetCampaignInt("UOACraft","iSpindleSkill",oPC);
|
|
int iSpindleChance = iSpindleSkill;
|
|
int iSuccess = 0;
|
|
int iSuccess2 = 0;
|
|
int iSkillGain = 0;
|
|
|
|
if (iSpindleChance <350)
|
|
{
|
|
iSpindleChance = GetAbilityScore(oPC,ABILITY_DEXTERITY)*5;
|
|
iSpindleChance = iSpindleChance +(GetAbilityScore(oPC,ABILITY_CONSTITUTION)*3);
|
|
iSpindleChance = iSpindleChance +(GetAbilityScore(oPC,ABILITY_WISDOM)*2);
|
|
iSpindleChance = iSpindleChance * 3;
|
|
if (iSpindleChance >350) iSpindleChance = 350;
|
|
if (iSpindleSkill > iSpindleChance) iSpindleChance = iSpindleSkill;
|
|
}
|
|
|
|
iSpindleChance = iSpindleChance - (iType*20);
|
|
|
|
if (iSpindleChance <1)
|
|
{
|
|
FloatingTextStringOnCreature("You do not have enough skill to spin that into anything!",oPC,FALSE);
|
|
CopyItem(oItem,oPC,TRUE);
|
|
DestroyObject(oItem);
|
|
return;
|
|
}
|
|
|
|
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
|
DelayCommand(10.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
|
//AssignCommand(oPC,PlaySound("as_na_splash2"));
|
|
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,10.0));
|
|
|
|
if (Random(1000) <= iSpindleChance)
|
|
{
|
|
iSuccess = 1;
|
|
iSuccess2 = 1;
|
|
iSpindleChance = iSpindleChance - 50;
|
|
if (Random(1000) <= iSpindleChance) iSuccess2 = iSuccess2+2;
|
|
iSpindleChance = iSpindleChance-100;
|
|
if (Random(1000) <= iSpindleChance) iSuccess2 = iSuccess2+2;
|
|
iSpindleChance = iSpindleChance + 150;
|
|
}
|
|
|
|
if (iSuccess <1)
|
|
{
|
|
iSuccess=1;
|
|
iSuccess2=1; // Player will *always* get a minimum of 1 product. This is a lossless skill.
|
|
}
|
|
if (iSuccess2>1) iSuccess2 = Random(iSuccess2)+1; // Random number of end product. (Maximum number is defined by iSuccess2)
|
|
|
|
sSuccess = "You carefully spin the "+sComponent+" into "+IntToString(iSuccess2);
|
|
if (iType==2)
|
|
{
|
|
sSuccess = sSuccess+" ball";
|
|
}
|
|
else
|
|
{
|
|
sSuccess = sSuccess+" spindle";
|
|
}
|
|
if (iSuccess2>1) sSuccess = sSuccess+"s";
|
|
sSuccess = sSuccess + " of "+sSuccess2;
|
|
|
|
float fDelay = 1.0;
|
|
|
|
// Do visual and sound effects
|
|
int iLoop = 9;
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_IMP_HEAD_HEAL,FALSE),oSelf,1.0);
|
|
for (iLoop; iLoop>0; iLoop--)
|
|
{
|
|
DelayCommand(fDelay,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_IMP_HEAD_HEAL,FALSE),oSelf,1.0));
|
|
DelayCommand(fDelay+0.5,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_IMP_HEAD_NATURE,FALSE),oSelf,1.0));
|
|
AssignCommand(oPC,DelayCommand(fDelay,PlaySound("as_cv_shopmetal2")));
|
|
fDelay = fDelay+1.0;
|
|
}
|
|
PlaySound("as_cv_millwheel1");
|
|
PlaySound("al_cv_pump");
|
|
DelayCommand(3.0,PlaySound("al_cv_pump"));
|
|
DelayCommand(6.0,PlaySound("al_cv_pump"));
|
|
DelayCommand(3.0,PlaySound("as_cv_millwheel1"));
|
|
DelayCommand(fDelay,FloatingTextStringOnCreature(sSuccess,oPC,FALSE));
|
|
for (iSuccess2; iSuccess2>0; iSuccess2--)
|
|
{
|
|
fDelay = fDelay+0.1;
|
|
DelayCommand(fDelay,CreateAnObject(sItemResRef,oPC,1));
|
|
}
|
|
|
|
if (Random(1000) > iSpindleSkill)
|
|
{
|
|
if (d10(1)+1 >= iSpindleChance/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);
|
|
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
|
}
|
|
}
|
|
|
|
DelayCommand(11.0,SpinNextItemPossessedBy(oSelf,oPC,sItemTag));
|
|
|
|
if (iSkillGain ==1)
|
|
{
|
|
string sOldSkill = "";
|
|
string sOldSkill2 = "";
|
|
iSpindleSkill++;
|
|
sOldSkill2 = IntToString(iSpindleSkill);
|
|
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
|
if (iSpindleSkill > 9)
|
|
{
|
|
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
|
}
|
|
else
|
|
{
|
|
sOldSkill = "0"+sOldSkill;
|
|
}
|
|
if (iSpindleSkill <= 1000)
|
|
{
|
|
//DelayCommand(10.0,SetTokenPair(oPC,13,10,iSpindleSkill));
|
|
DelayCommand(10.0,SetCampaignInt("UOACraft","iSpindleSkill",iSpindleSkill,oPC));
|
|
DelayCommand(10.0,SendMessageToPC(oPC,"==================================="));
|
|
DelayCommand(10.0,SendMessageToPC(oPC,"Your skill in spindling has gone up!"));
|
|
DelayCommand(10.0,SendMessageToPC(oPC,"Current spindling skill : "+ sOldSkill+"%"));
|
|
DelayCommand(10.0,SendMessageToPC(oPC,"==================================="));
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
|