MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | /* MorgenGrauen MudLib : Pubtool */ |
| 2 | |
| 3 | #include <defines.h> |
| 4 | #include <properties.h> |
| 5 | #include <language.h> |
| 6 | |
| 7 | inherit "/std/thing"; |
| 8 | |
| 9 | create() |
| 10 | { |
| 11 | if (!clonep(ME)) |
| 12 | return; |
| 13 | ::create(); |
| 14 | |
| 15 | SetProp(P_SHORT,"Ein Pubtool"); |
| 16 | SetProp(P_LONG, |
| 17 | "Das Pubtool berechnet die maximal zulaessige Heilung einer Kneipe.\n"+ |
| 18 | "\n"+ |
| 19 | "Syntax: pubtest <P_ALCOHOL> <P_DRINK> <P_FOOD> <P_VALUE> <Rate> <Delay>\n"+ |
| 20 | "\n"+ |
| 21 | "Wertebereich: >=0 >=0 >=0 >=0 1..20 0..\n"+ |
| 22 | "\n"); |
| 23 | SetProp(P_NAME,"Pubtool"); |
| 24 | SetProp(P_GENDER,NEUTER); |
| 25 | SetProp(P_WEIGHT,0); |
| 26 | SetProp(P_VALUE,0); |
| 27 | SetProp(P_NODROP,"Das Pubtool behaelst Du lieber bei Dir.\n"); |
| 28 | SetProp(P_NEVERDROP,1); |
| 29 | SetProp(P_AUTOLOADOBJ,1); |
| 30 | |
| 31 | AddId( "pubtool" ); |
| 32 | |
| 33 | AddCmd( "pubtest", "pubtest" ); |
| 34 | } |
| 35 | |
| 36 | int pubtest(string arg) |
| 37 | { int v,d,a,f,r,h,y; |
| 38 | |
| 39 | notify_fail( |
| 40 | "Syntax: pubtest <P_ALCOHOL> <P_DRINK> <P_FOOD> <P_VALUE> <Rate> <Delay>\n"); |
| 41 | |
| 42 | if (!arg || !stringp(arg) || |
| 43 | sscanf(arg,"%d %d %d %d %d %d",a,d,f,v,r,y)!=6) |
| 44 | return 0; |
| 45 | |
| 46 | if (v<1 || d<0 || a<0 || f<0 || r<1 || r>20 || y<0) |
| 47 | return 0; |
| 48 | |
| 49 | h=call_other("/secure/pubmaster","CalcMax", |
| 50 | ([P_VALUE:v,P_ALCOHOL:a,P_DRINK:d,P_FOOD:f, |
| 51 | "delay":y,"rate":r]),0); |
| 52 | |
| 53 | printf("Berechnete Maximalheilung fuer:\n"+ |
| 54 | "P_ALCOHOL = %3d P_DRINK = %3d P_FOOD = %3d \n"+ |
| 55 | "P_VALUE = %3d Rate = %3d Delay = %3d \n"+ |
| 56 | "Ergebnis:\n"+ |
| 57 | "Gesamt: %3d (HP+SP), aufgeteilt z.B. %3d HP und %3d SP.\n", |
| 58 | a,d,f,v,r,y,h,(h/2),(h%2?(h/2)+1:(h/2))); |
| 59 | return 1; |
| 60 | } |