I'd like to know what is the excact repair formula
// Author: cvet#include "_macros.fos"#include "_msgstr.fos"bool TryRepairItem(Critter& cr, Item& item) // Export{ if(not item.IsDeteriorable()) return true; if(cr.Timeout[TO_BATTLE]>0) { cr.SayMsg(SAY_NETMSG,TEXTMSG_GAME,STR_TIMEOUT_BATTLE_WAIT); return true; } if(cr.Timeout[TO_SK_REPAIR]>0) { cr.SayMsg(SAY_NETMSG,TEXTMSG_GAME,STR_SKILL_WEARINESS); return true; } if(FLAG(item.BrokenFlags,BI_ETERNAL) || FLAG(item.BrokenFlags,BI_NOTRESC)) { cr.SayMsg(SAY_NETMSG,TEXTMSG_GAME,STR_DETERIORATION_NO_RESC); return true; } // Repair int repair=cr.Skill[SK_REPAIR]; uint8 mode=0; uint16 activePid=cr.GetSlotProto(SLOT_HAND1,mode).ProtoId; if(activePid==PID_MULTI_TOOL) { repair+=25; if(Random(0,30)==0) cr.DeleteItem(PID_MULTI_TOOL,1); } else if(activePid==PID_SUPER_TOOL_KIT) { repair+=50; if(Random(0,30)==0) cr.DeleteItem(PID_SUPER_TOOL_KIT,1); } // Repair if(FLAG(item.BrokenFlags,BI_BROKEN)) { if(FLAG(item.BrokenFlags,BI_HIGHBROKEN)) repair-=100; //áûëî 150 else if(FLAG(item.BrokenFlags,BI_NORMBROKEN)) repair-=75; //áûëî 100 else if(FLAG(item.BrokenFlags,BI_LOWBROKEN)) repair-=25; // áûëî 50 repair-=item.BrokenCount*50/MAX_BROKENS; //áûëî 100 repair=CLAMP(repair,6,95); if(repair>=Random(1,100)) { item.Deterioration=0; UNSETFLAG(item.BrokenFlags,BI_BROKEN); cr.SayMsg(SAY_NETMSG,TEXTMSG_GAME,STR_DETERIORATION_REPAIR_SUCC); cr.StatBase[ST_EXPERIENCE]+=40; } else { item.BrokenCount++; if(item.BrokenCount>=MAX_BROKENS) SETFLAG(item.BrokenFlags,BI_NOTRESC); cr.SayMsg(SAY_NETMSG,TEXTMSG_GAME,STR_DETERIORATION_REPAIR_FAIL); } } // Service else { if(FLAG(item.BrokenFlags,BI_SERVICE)) repair-=25; repair-=item.BrokenCount*50/MAX_BROKENS; repair=CLAMP(repair,6,95); if(repair>=Random(1,100)) { SETFLAG(item.BrokenFlags,BI_SERVICE); if(activePid==PID_OIL_CAN) { item.Deterioration=0; cr.DeleteItem(PID_OIL_CAN,1); } else { int cnt=repair*MAX_DETERIORATION/100; if(cnt>item.Deterioration) item.Deterioration=0; else item.Deterioration-=cnt; } cr.SayMsg(SAY_NETMSG,TEXTMSG_GAME,STR_DETERIORATION_SERVICE_SUCC); cr.StatBase[ST_EXPERIENCE]+=20; } else { DeteriorateItem(cr,item,MAX_DETERIORATION/5); cr.SayMsg(SAY_NETMSG,TEXTMSG_GAME,STR_DETERIORATION_SERVICE_FAIL); } } item.Update(); cr.TimeoutBase[TO_SK_REPAIR]=REPAIR_TIMEOUT(cr); return true;}void DeteriorateItem(Critter& cr, Item& item, int deteriorationCount) // Export{ if(deteriorationCount<=0 || not item.IsDeteriorable() || FLAG(item.BrokenFlags,BI_ETERNAL) || FLAG(item.BrokenFlags,BI_BROKEN)) return; item.Deterioration+=deteriorationCount; if(item.Deterioration>=MAX_DETERIORATION) { item.Deterioration=MAX_DETERIORATION; item.BrokenCount++; int brokenLvl=Random(0,item.BrokenCount/(MAX_BROKENS/4)); if(item.BrokenCount>=MAX_BROKENS || brokenLvl>=3) SETFLAG(item.BrokenFlags,BI_NOTRESC); else if(brokenLvl==2) SETFLAG(item.BrokenFlags,BI_HIGHBROKEN); else if(brokenLvl==1) SETFLAG(item.BrokenFlags,BI_NORMBROKEN); else SETFLAG(item.BrokenFlags,BI_LOWBROKEN); cr.SayMsg(SAY_NETMSG,TEXTMSG_GAME,STR_DETERIORATION_WEAPON_BROKEN); } item.Update();}void SetDeterioration(Item& item, int deteriorationProcent) // Export{ if(not item.IsDeteriorable()) return; UNSETFLAG(item.BrokenFlags,BI_BROKEN); deteriorationProcent=CLAMP(deteriorationProcent,0,100); item.Deterioration=MAX_DETERIORATION*deteriorationProcent/100; item.BrokenCount=MAX_BROKENS*deteriorationProcent/100; if(deteriorationProcent==100) SETFLAG(item.BrokenFlags,BI_BROKEN); item.Update();}int GetDeteriorationProcent(Item& item) // Export{ if(not item.IsDeteriorable()) return 0; if(FLAG(item.BrokenFlags,BI_BROKEN)) return 100; int value=item.Deterioration*100/MAX_DETERIORATION; return CLAMP(value,0,100);}
10th break count = Beyond Repair