instance DIA_Addon_Steal(C_Info)
{
nr = 923;
condition = DIA_Addon_Steal_Condition;
information = DIA_Addon_Steal_Info;
permanent = TRUE;
description = "(Попытаться украсть кошелек)";
};
func int DIA_Addon_Steal_Condition()
{
if((self.npcType == npctype_friend) || (self.flags == NPC_FLAG_XARADRIM) || (self.flags == NPC_FLAG_IMMORTAL) || (self.guild == GIL_DMT) || (self.aivar[90] == TRUE) || (self.aivar[AIV_MM_REAL_ID] == ID_SKELETON) || (other.aivar[AIV_MM_RestEnd] == TRUE))
{
return FALSE;
};
if((Npc_GetTalentSkill(hero,NPC_TALENT_PICKPOCKET) >= 1) && (self.aivar[AIV_PlayerHasPickedMyPocket] == FALSE) && (bNewSteal[0] == FALSE))
{
return TRUE;
};
return FALSE;
};
func void DIA_Addon_Steal_Info()
{
var int sChance;
var int sChanceProc;
var string concatText;
Info_ClearChoices(DIA_Addon_Steal);
Info_AddChoice(DIA_Addon_Steal,Dialog_Back,DIA_Addon_Steal_Back);
Info_AddChoice(DIA_Addon_Steal,concatText,DIA_Addon_Steal_DoIt);
if(other.attribute[ATR_DEXTERITY] < self.attribute[ATR_DEXTERITY])
{
sChance = self.attribute[ATR_DEXTERITY] - other.attribute[ATR_DEXTERITY];
if(sChance >= 100)
{
sChanceProc = 0;
}
else
{
sChanceProc = 100 - sChance;
};
}
else
{
sChanceProc = 100;
};
if((sChanceProc < 100) && (PickPocketBonusCount > 0))
{
sChanceProc = sChanceProc + (PickPocketBonusCount / 20);
if(sChanceProc > 100)
{
sChanceProc = 100;
};
};
concatText = ConcatStrings(DIALOG_PICKPOCKET_NEW,IntToString(sChanceProc));
concatText = ConcatStrings(concatText,"%)");
};
func void DIA_Addon_Steal_Back()
{
Info_ClearChoices(DIA_Addon_Steal);
};
func void DIA_Addon_Steal_DoIt()
{
var int sMoney;
var int sExp;
var int sChance;
var int sChanceProc;
var int daynow;
daynow = Wld_GetDay();
if(other.attribute[ATR_DEXTERITY] < self.attribute[ATR_DEXTERITY])
{
sChance = self.attribute[ATR_DEXTERITY] - other.attribute[ATR_DEXTERITY];
if(sChance >= 100)
{
sChanceProc = 0;
}
else
{
sChanceProc = 100 - sChance;
};
}
else
{
sChanceProc = 100;
};
if((sChanceProc < 100) && (PickPocketBonusCount > 0))
{
sChanceProc = sChanceProc + (PickPocketBonusCount / 20);
};
AI_PlayAni(other,"T_STEAL");
AI_Wait(other,1);
if(sChanceProc >= (1 + Hlp_Random(99)))
{
if((other.guild == GIL_PAL) || (other.guild == GIL_KDF))
{
INNOSCRIMECOUNT = INNOSCRIMECOUNT + 1;
}
else
{
GlobalThiefCount += 1;
if(GlobalThiefCount >= 3)
{
INNOSCRIMECOUNT = INNOSCRIMECOUNT + 1;
GlobalThiefCount = FALSE;
};
};
Snd_Play("Geldbeutel");
sMoney = B_CountStealMoney(self);
PickPocketBonusCount += 1;
sExp = 5 + PickPocketBonusCount;
B_GiveInvItems(self,other,ItMi_Gold,sMoney);
self.aivar[AIV_PlayerHasPickedMyPocket] = TRUE;
B_GivePlayerXP(sExp);
if(CountThiefOverallBonusDay < daynow)
{
CountThiefOverallBonus += 1;
if(CountThiefOverallBonus >= 15)
{
B_RaiseAttribute_Bonus(hero,ATR_DEXTERITY,1);
CountThiefOverallBonus = FALSE;
CountThiefOverallBonusDay = Wld_GetDay();
};
};
AI_StopProcessInfos(self);
}
else
{
THIEFCATCHER = Hlp_GetNpc(self);
HERO_CANESCAPEFROMGOTCHA = TRUE;
B_ResetThiefLevel();
AI_StopProcessInfos(self);
self.vars[0] = TRUE;
};
};
func void B_Addon_Steal(var C_Npc slf)
{
DIA_Addon_Steal.npc = Hlp_GetInstanceID(slf);