HoS_PRC8/_mod/_module/nss/cg_smoothrep.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

60 lines
1.9 KiB
Plaintext

// Smooth reputation
void main()
{
object oChest=GetObjectByTag("CG_CHEST");
object oPC=GetPCSpeaker();
object oItem;
int nCost=GetLocalInt(oPC,"nCGCost");
int nType=GetLocalInt(oPC,"nCGSmooth");
object oTarget;
int nC;
int nSpawnTemp=FALSE;
TakeGoldFromCreature(nCost,oPC,TRUE);
if (oChest!=OBJECT_INVALID)
{ // put 50 gold in crime guild chest
oItem=CreateItemOnObject("nw_it_gold001",oChest,50);
} // put 50 gold in crime guild chest
if (nType==3)
{ // merchants
oTarget=GetObjectByTag("Wizard");
if(oTarget==OBJECT_INVALID)
oTarget=GetObjectByTag("Abjin");
if (oTarget==OBJECT_INVALID)
oTarget=GetObjectByTag("Murin");
if (oTarget==OBJECT_INVALID)
oTarget=GetObjectByTag("InnKeeper");
} // merchants
else if (nType==2)
{ // mages
oTarget=GetObjectByTag("EXPELLER");
if (oTarget==OBJECT_INVALID)
oTarget=GetObjectByTag("Lamar");
if (oTarget==OBJECT_INVALID)
oTarget=GetObjectByTag("MGS1");
if (oTarget==OBJECT_INVALID)
oTarget=GetObjectByTag("MGS2");
if (oTarget==OBJECT_INVALID)
oTarget=GetObjectByTag("MGS3");
} // mages
else if (nType==1)
{ // city guards
nC=0;
oTarget=GetObjectByTag("CityGuard",nC);
while(oTarget!=OBJECT_INVALID)
{ // adjust
nC++;
ClearPersonalReputation(oPC,oTarget);
oTarget=GetObjectByTag("CityGuard",nC);
} // adjust
oTarget=GetObjectByTag("CityGuard");
if (oTarget==OBJECT_INVALID)
{ // spawn temporary to set target
oChest=GetWaypointByTag("POST_CityGuard");
oTarget=CreateObject(OBJECT_TYPE_CREATURE,"cityguard",GetLocation(oChest));
nSpawnTemp=TRUE;
} // spawn temporary to set target
} // city guards
AdjustReputation(oPC,oTarget,50);
if (nSpawnTemp==TRUE) DestroyObject(oTarget);
}