2025/07/21 Update

Added PEPS AI
Full compile.
This commit is contained in:
Jaysyn904
2025-07-21 12:33:56 -04:00
parent 2d0a7a8a89
commit 87608ac499
2806 changed files with 44346 additions and 557 deletions

View File

@@ -1,5 +1,11 @@
//Dependencies: ats_inc_common, ats_const_mat, ats_const_common, ats_inc_material, ats_inc_cr_get
#include "ats_inc_common"
#include "ats_const_mat"
#include "ats_const_common"
#include "ats_inc_material"
#include "ats_inc_cr_get"
/* ATS_FindComponents function written to combine the redundant
ATS_CheckCraftComponentsOnPlayer and ATS_RemoveCraftMaterials
functions simply adding a flag to indicate whether or not to
@@ -34,7 +40,8 @@
Written by: Keith Westrate <helimar@earthlink.net> using Mojo's
original code for the redundant functions.
*/
int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int Remove)
int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int nRemove)
{
string sDyeTagNeeded = ATS_GetComponentTagFromRecipe(sCraftTag, CINT_COMPONENT_ID_DYES, iMaterialType);
int iDyeAmountNeeded = ATS_GetComponentAmountFromRecipe(sCraftTag, CINT_COMPONENT_ID_DYES, iMaterialType);
@@ -82,8 +89,8 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
int i, count;
if(Remove == 2)
{ // if remove is 2, only remove components based on consumption risk
if(nRemove == 2)
{ // if nRemove is 2, only nRemove components based on consumption risk
iConsumptionRisk = ATS_GetConsumptionRiskFromRecipe(sCraftTag, CINT_COMPONENT_ID_DYES, iMaterialType);
for(i = 1; i <= iDyeAmountNeeded; ++i)
{
@@ -93,7 +100,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iDyeAmountNeeded = iConsumptionCount;
if(iConsumptionCount > 0)
{ // since we knew the PC had enough components to attempt the
// craft, assume we'll find them and remove them
// craft, assume we'll find them and nRemove them
sMessage = "You have lost " + IntToString(iConsumptionCount)
+ " " + ATS_GetMaterialName(iMaterialType) + " dye";
if(iConsumptionCount > 1) sMessage += "s";
@@ -111,7 +118,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iFlowerAmountNeeded = iConsumptionCount;
if(iConsumptionCount > 0)
{ // since we knew the PC had enough components to attempt the
// craft, assume we'll find them and remove them
// craft, assume we'll find them and nRemove them
sMessage = "You have lost " + IntToString(iConsumptionCount)
+ " " + ATS_GetMaterialName(iMaterialType) + " flower";
if(iConsumptionCount > 1) sMessage += "s";
@@ -129,7 +136,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iClothSAmountNeeded = iConsumptionCount;
if(iConsumptionCount > 0)
{ // since we knew the PC had enough components to attempt the
// craft, assume we'll find them and remove them
// craft, assume we'll find them and nRemove them
sMessage = "You have lost " + IntToString(iConsumptionCount)
+ " " + ATS_GetMaterialName(iMaterialType) + " small cloth";
if(iConsumptionCount > 1) sMessage += "s";
@@ -147,7 +154,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iClothMAmountNeeded = iConsumptionCount;
if(iConsumptionCount > 0)
{ // since we knew the PC had enough components to attempt the
// craft, assume we'll find them and remove them
// craft, assume we'll find them and nRemove them
sMessage = "You have lost " + IntToString(iConsumptionCount)
+ " " + ATS_GetMaterialName(iMaterialType) + " medium cloth";
if(iConsumptionCount > 1) sMessage += "s";
@@ -165,7 +172,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iClothLAmountNeeded = iConsumptionCount;
if(iConsumptionCount > 0)
{ // since we knew the PC had enough components to attempt the
// craft, assume we'll find them and remove them
// craft, assume we'll find them and nRemove them
sMessage = "You have lost " + IntToString(iConsumptionCount)
+ " " + ATS_GetMaterialName(iMaterialType) + " large cloth";
if(iConsumptionCount > 1) sMessage += "s";
@@ -183,7 +190,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iIngotAmountNeeded = iConsumptionCount;
if(iConsumptionCount > 0)
{ // since we knew the PC had enough components to attempt the
// craft, assume we'll find them and remove them
// craft, assume we'll find them and nRemove them
sMessage = "You have lost " + IntToString(iConsumptionCount)
+ " " + ATS_GetMaterialName(iMaterialType) + " ingot";
if(iConsumptionCount > 1) sMessage += "s";
@@ -201,7 +208,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iGemAmountNeeded = iConsumptionCount;
if(iConsumptionCount > 0)
{ // since we knew the PC had enough components to attempt the
// craft, assume we'll find them and remove them
// craft, assume we'll find them and nRemove them
sMessage = "You have lost " + IntToString(iConsumptionCount)
+ " " + GetName(GetObjectByTag(sGemTagNeeded));
if(iConsumptionCount > 1) sMessage += "s";
@@ -219,7 +226,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iIdealGemAmountNeeded = iConsumptionCount;
if(iConsumptionCount > 0)
{ // since we knew the PC had enough components to attempt the
// craft, assume we'll find them and remove them
// craft, assume we'll find them and nRemove them
sMessage = "You have lost " + IntToString(iConsumptionCount)
+ " " + GetName(GetObjectByTag(sIdealGemTagNeeded));
if(iConsumptionCount > 1) sMessage += "s";
@@ -233,8 +240,8 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
{
sCustomTagNeeded = ATS_GetComponentTagFromRecipe(sCraftTag, CINT_COMPONENT_ID_CUSTOM, i);
iCustomAmountNeeded = ATS_GetComponentAmountFromRecipe(sCraftTag, CINT_COMPONENT_ID_CUSTOM, i);
if(Remove == 2)
{ // remove only percentage of components based on risk%
if(nRemove == 2)
{ // nRemove only percentage of components based on risk%
iConsumptionRisk = ATS_GetConsumptionRiskFromRecipe(sCraftTag, CINT_COMPONENT_ID_CUSTOM, i);
iConsumptionCount = 0;
for(count = 1; count <= iCustomAmountNeeded; ++count)
@@ -245,7 +252,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iCustomAmountNeeded = iConsumptionCount;
if(iConsumptionCount > 0)
{ // since we knew the PC had enough components to attempt
// the craft, assume we'll find them and remove them
// the craft, assume we'll find them and nRemove them
sMessage = "You have lost " + IntToString(iConsumptionCount)
+ " " + GetName(GetObjectByTag(sCustomTagNeeded));
if(iConsumptionCount > 1) sMessage += "s";
@@ -279,7 +286,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iRemainingQuantity = iStackedQuantity - iDyeAmountNeeded;
iDyeAmountNeeded -= iStackedQuantity;
if(Remove)
if(nRemove)
{
DestroyObject(oItemOnPlayer);
if(iRemainingQuantity > 0)
@@ -303,7 +310,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iRemainingQuantity = iStackedQuantity - iFlowerAmountNeeded;
iFlowerAmountNeeded -= iStackedQuantity;
if(Remove)
if(nRemove)
{
DestroyObject(oItemOnPlayer);
if(iRemainingQuantity > 0)
@@ -327,7 +334,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iRemainingQuantity = iStackedQuantity - iClothSAmountNeeded;
iClothSAmountNeeded -= iStackedQuantity;
if(Remove)
if(nRemove)
{
DestroyObject(oItemOnPlayer);
if(iRemainingQuantity > 0)
@@ -351,7 +358,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iRemainingQuantity = iStackedQuantity - iClothMAmountNeeded;
iClothMAmountNeeded -= iStackedQuantity;
if(Remove)
if(nRemove)
{
DestroyObject(oItemOnPlayer);
if(iRemainingQuantity > 0)
@@ -375,7 +382,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iRemainingQuantity = iStackedQuantity - iClothLAmountNeeded;
iClothLAmountNeeded -= iStackedQuantity;
if(Remove)
if(nRemove)
{
DestroyObject(oItemOnPlayer);
if(iRemainingQuantity > 0)
@@ -399,7 +406,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iRemainingQuantity = iStackedQuantity - iIngotAmountNeeded;
iIngotAmountNeeded -= iStackedQuantity;
if(Remove)
if(nRemove)
{
DestroyObject(oItemOnPlayer);
if(iRemainingQuantity > 0)
@@ -423,7 +430,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iRemainingQuantity = iStackedQuantity - iGemAmountNeeded;
iGemAmountNeeded -= iStackedQuantity;
if(Remove)
if(nRemove)
{
DestroyObject(oItemOnPlayer);
if(iRemainingQuantity > 0)
@@ -446,7 +453,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iRemainingQuantity = iStackedQuantity - iIdealGemAmountNeeded;
iIdealGemAmountNeeded -= iStackedQuantity;
if(Remove)
if(nRemove)
{
DestroyObject(oItemOnPlayer);
if(iRemainingQuantity > 0)
@@ -482,7 +489,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iCustomAmountNeeded = 0;
SetLocalInt(oPlayer, "ats_customneeded_" + IntToString(i) + "_amount", iCustomAmountNeeded);
if(Remove)
if(nRemove)
{
DestroyObject(oItemOnPlayer);
for( i = 0; i < iRemainingQuantity; ++i)
@@ -504,7 +511,7 @@ int ATS_FindComponents(object oPlayer, string sCraftTag, int iMaterialType, int
iCustomAmountNeeded = 0;
SetLocalInt(oPlayer, "ats_customneeded_" + IntToString(i) + "_amount", iCustomAmountNeeded);
if(Remove)
if(nRemove)
{
DestroyObject(oItemOnPlayer);
if(iRemainingQuantity > 0)
@@ -572,3 +579,4 @@ int ATS_RemoveCraftMaterials(object oPlayer, string sCraftTag, int iMaterialType
return ATS_FindComponents(oPlayer, sCraftTag, iMaterialType, TRUE);
}
//:: void main() {}