#include <thing/properties.h>#include <new_skills.h>#include <wizlevels.h>
gehe zum Quellcode dieser Datei
Makrodefinitionen | |
| #define | NEED_PROTOTYPES |
Funktionen | |
| static mixed | execute_anything (mixed fun, object pl, mixed args) |
| mapping | race_modifier (object pl, mapping map_ldfied) |
| string | check_restrictions (object pl, mapping restr) |
| varargs mixed | GetData (string dname, mapping map_ldfied, object pl) |
| varargs int | GetValue (string vname, mapping map_ldfied, object pl) |
| varargs int | GetFactor (string fname, mapping map_ldfied, object pl) |
| varargs int | GetOffset (string oname, mapping map_ldfied, object pl) |
| varargs int | GetFValue (string vname, mapping map_ldfied, object pl) |
| varargs int | GetValueO (string vname, mapping map_ldfied, object pl) |
| varargs int | GetFValueO (string vname, mapping map_ldfied, object pl) |
| varargs int | GetRandFValueO (string vname, mapping map_ldfied, object pl) |
| mapping | AddSkillMappings (mapping oldmap, mapping newmap) |
| #define NEED_PROTOTYPES |
Definiert in Zeile 13 der Datei restriction_checker.c.
| mapping AddSkillMappings | ( | mapping | oldmap, | |
| mapping | newmap | |||
| ) |
Definiert in Zeile 258 der Datei restriction_checker.c.
Benutzt i, SI_SKILLRESTR_LEARN, SI_SKILLRESTR_USE und SM_RACE.
Wird benutzt von AddSkill(), AddSpell(), QuerySpell() und UseSpell().
00258 { 00259 mapping res,t1,t2; 00260 mixed *inx,ind; 00261 int i; 00262 00263 if (!mappingp(oldmap)) return newmap; 00264 if (!mappingp(newmap)) return oldmap; 00265 inx=({SI_SKILLRESTR_LEARN,SI_SKILLRESTR_USE,SM_RACE}); 00266 res=oldmap+newmap; 00267 for (i=sizeof(inx);i--;) { 00268 ind=inx[i]; 00269 t1=oldmap[ind]; 00270 t2=newmap[ind]; 00271 if (t1) { 00272 if (t2) 00273 res[ind]=t1+t2; 00274 else 00275 res[ind]=t1; 00276 } else { 00277 if (t2) 00278 res[ind]=t2; 00279 } 00280 } 00281 return res; 00282 }

| string check_restrictions | ( | object | pl, | |
| mapping | restr | |||
| ) |
Definiert in Zeile 48 der Datei restriction_checker.c.
Benutzt A_CON, A_DEX, A_INT, A_STR, cl, execute_anything(), guild, i, IS_LEARNER, IS_SEER, P_ALCOHOL, P_ALIGN, P_BLIND, P_DEAF, P_DRINK, P_FOOD, P_FROG, P_GUILD, P_GUILD_LEVEL, P_LEVEL, P_MAX_HANDS, P_QP, P_RACE, P_REAL_RACE, P_SIZE, P_USED_HANDS, P_XP, race, race_modifier(), SR_BAD, SR_EXCLUDE_GUILD, SR_EXCLUDE_RACE, SR_FREE_HANDS, SR_FUN, SR_GOOD, SR_INCLUDE_GUILD, SR_INCLUDE_RACE, SR_MAX_SIZE, SR_MIN_SIZE und SR_SEER.
Wird benutzt von _check_wear_restrictions(), beitreten(), CanTrySpell(), check_cond(), LearnSkill() und LearnSpell().
00048 { 00049 /* Folgende Einschraenkungen koennen geprueft werden: 00050 * - Mindestwerte bei allen Attributen und Properties Level, QP, XP 00051 * - bestimmte Rassen koennen ausgeschlossen werden bzw. erlaubt werden 00052 * (SR_EXCLUDE_RACE ist ein Array von ausgeschlossenen Rassen, 00053 * SR_INCLUDE_RACE eines mit eingeschlossenen) 00054 * - SR_RACE kann ein Mapping sein, dass Rassen ein eigenes 00055 * Restriction-mapping zuordnet. "*" steht fuer alle anderen Rassen. 00056 */ 00057 int i; 00058 closure cl,cl2; 00059 string race, guild, *ind; 00060 00061 if (!mappingp(restr) || !sizeof(restr)) return 0; // Keine Einschraenkungen 00062 if (!objectp(pl)) return ""; 00063 if (pl->QueryDisguise()) 00064 return "Zieh erst mal den Tarnhelm aus.\n"; 00065 00066 restr=race_modifier(&pl,&restr); 00067 00068 i=sizeof(ind=m_indices(restr)); 00069 cl=symbol_function("QueryProp",pl); 00070 cl2=symbol_function("QueryAttribute",pl); 00071 00072 while(i--) 00073 switch(ind[i]) { 00074 case P_LEVEL: 00075 if (funcall(cl,P_LEVEL) < restr[P_LEVEL]) 00076 return "Deine Stufe reicht dafuer nicht aus.\n"; 00077 break; 00078 case P_GUILD_LEVEL: 00079 if (funcall(cl,P_GUILD_LEVEL) < restr[P_GUILD_LEVEL]) 00080 return "Deine Gildenstufe reicht dafuer nicht aus.\n"; 00081 break; 00082 case SR_SEER: // das macht nun wahrlich nur bei interactives sinn!!! 00083 if (restr[SR_SEER] && query_once_interactive(pl) && !IS_SEER(pl)) 00084 return "Du musst dazu erst Seher werden.\n"; 00085 break; 00086 case P_XP: 00087 if (funcall(cl,P_XP) < restr[P_XP]) 00088 return "Du hast nicht genuegend Erfahrung dafuer.\n"; 00089 break; 00090 case P_QP: 00091 if (funcall(cl,P_QP) < restr[P_QP]) 00092 return "Du hast nicht genuegend Aufgaben geloest.\n"; 00093 break; 00094 case P_ALCOHOL: 00095 if (funcall(cl,P_ALCOHOL) >= restr[P_ALCOHOL]) 00096 return "Du bist zu besoffen.\n"; 00097 break; 00098 case P_DRINK: 00099 if (funcall(cl,P_DRINK) >= restr[P_DRINK]) 00100 return "Du hast zuviel getrunken.\n"; 00101 break; 00102 case P_FOOD: 00103 if (funcall(cl,P_FOOD) >= restr[P_FOOD]) 00104 return "Du hast zuviel gegessen.\n"; 00105 break; 00106 case P_DEAF: 00107 if (funcall(cl,P_DEAF)) 00108 return "Du kannst nichts hoeren.\n"; 00109 break; 00110 case P_BLIND: 00111 if (funcall(cl,P_BLIND)) 00112 return "Du kannst nichts sehen.\n"; 00113 break; 00114 case P_FROG: 00115 if (funcall(cl,P_FROG)) 00116 return "Als Frosch kannst Du das leider nicht.\n"; 00117 break; 00118 case A_INT: 00119 if (funcall(cl2,A_INT) < restr[A_INT]) 00120 return "Deine Intelligenz reicht dafuer nicht aus.\n"; 00121 break; 00122 case A_DEX: 00123 if (funcall(cl2,A_DEX) < restr[A_DEX]) 00124 return "Deine Geschicklichkeit reicht dafuer nicht aus.\n"; 00125 break; 00126 case A_CON: 00127 if (funcall(cl2,A_CON) < restr[A_CON]) 00128 return "Deine Ausdauer reicht dafuer nicht aus.\n"; 00129 break; 00130 case A_STR: 00131 if (funcall(cl2,A_STR) < restr[A_STR]) 00132 return "Deine Staerke reicht dafuer nicht aus.\n"; 00133 break; 00134 case SR_BAD: 00135 if (funcall(cl,P_ALIGN)<restr[SR_BAD]) 00136 return "Du bist zu boese.\n"; 00137 break; 00138 case SR_GOOD: 00139 if (funcall(cl,P_ALIGN)>restr[SR_GOOD]) 00140 return "Du bist nicht boese genug.\n"; 00141 break; 00142 case SR_MIN_SIZE: 00143 if (funcall(cl,P_SIZE)<restr[SR_MIN_SIZE]) 00144 return "Du bist dafuer zu klein.\n"; 00145 break; 00146 case SR_MAX_SIZE: 00147 if (funcall(cl,P_SIZE)>restr[SR_MAX_SIZE]) 00148 return "Du bist dafuer zu gross.\n"; 00149 break; 00150 case SR_FREE_HANDS: 00151 if (restr[SR_FREE_HANDS] > 00152 (funcall(cl,P_MAX_HANDS)-funcall(cl,P_USED_HANDS))) 00153 return "Du hast nicht genug freie Haende dafuer.\n"; 00154 break; 00155 case SR_EXCLUDE_RACE: 00156 if (IS_LEARNER(pl)) race=funcall(cl,P_RACE); else race=funcall(cl,P_REAL_RACE); //race=pl->_query_real_race(); 00157 if (pointerp(restr[SR_EXCLUDE_RACE]) && 00158 member(restr[SR_EXCLUDE_RACE],race)>=0) 00159 return ("Als "+race+" kannst Du das nicht.\n"); 00160 break; 00161 case SR_INCLUDE_RACE: 00162 if (IS_LEARNER(pl)) race=funcall(cl,P_RACE); else race=funcall(cl,P_REAL_RACE); //race=pl->_query_real_race(); 00163 if (pointerp(restr[SR_INCLUDE_RACE]) && 00164 member(restr[SR_INCLUDE_RACE],race)<0) 00165 return ("Als "+race+" kannst Du das nicht.\n"); 00166 break; 00167 case SR_EXCLUDE_GUILD: 00168 guild=funcall(cl,P_GUILD); 00169 if (pointerp(restr[SR_EXCLUDE_GUILD]) && 00170 member(restr[SR_EXCLUDE_GUILD],guild)>=0) 00171 return ("Mit Deiner Gildenzugehoerigkeit kannst Du das nicht.\n"); 00172 break; 00173 case SR_INCLUDE_GUILD: 00174 guild=funcall(cl,P_GUILD); 00175 if (pointerp(restr[SR_INCLUDE_GUILD]) && 00176 member(restr[SR_INCLUDE_GUILD],guild)<0) 00177 return ("Mit Deiner Gildenzugehoerigkeit kannst Du das nicht.\n"); 00178 break; 00179 } 00180 00181 if(member(restr,SR_FUN)) 00182 return execute_anything(restr[SR_FUN],pl,0); 00183 00184 return 0; 00185 }


| static mixed execute_anything | ( | mixed | fun, | |
| object | pl, | |||
| mixed | args | |||
| ) | [static] |
Definiert in Zeile 20 der Datei restriction_checker.c.
Benutzt query_closure_object().
Wird benutzt von check_restrictions() und GetValue().
00020 { 00021 if (!fun) return 0; 00022 if (closurep(fun) 00023 && objectp(query_closure_object(fun))) 00024 return funcall(fun,pl,args); 00025 if (stringp(fun)) 00026 return call_other(this_object(),fun,pl,args); 00027 if (pointerp(fun) 00028 && sizeof(fun)>=2 00029 && stringp(fun[1]) 00030 && (stringp(fun[0]) || objectp(fun[0]))) 00031 return call_other(fun[0],fun[1],pl,fun[2..],args); 00032 return 0; 00033 }


| varargs mixed GetData | ( | string | dname, | |
| mapping | map_ldfied, | |||
| object | pl | |||
| ) |
Definiert in Zeile 188 der Datei restriction_checker.c.
Wird benutzt von TryDefaultAttackSpell() und TryGlobalAttackSpell().
00188 { 00189 mixed dat,res; 00190 00191 if (!dname || !mappingp(map_ldfied)) return 0; 00192 if (closurep(dat=map_ldfied[dname]) && (res=funcall(dat,pl,map_ldfied))) 00193 return res; 00194 return dat; 00195 00196 }

| varargs int GetFactor | ( | string | fname, | |
| mapping | map_ldfied, | |||
| object | pl | |||
| ) |
Definiert in Zeile 211 der Datei restriction_checker.c.
Benutzt FACTOR und GetValue().
Wird benutzt von GetFValue(), GetFValueO(), GetRandFValueO() und InitialSkillAbility().
00211 { 00212 mixed res; 00213 00214 // printf("GetFactor(%O):\n",fname); 00215 if (!fname || !(res=GetValue(FACTOR(fname),map_ldfied,pl))) 00216 return 100; 00217 if (res<10) res=10; 00218 else if (res>1000) res=1000; 00219 // printf("Factor: %O\n",res); 00220 return res; 00221 }


| varargs int GetFValue | ( | string | vname, | |
| mapping | map_ldfied, | |||
| object | pl | |||
| ) |
Definiert in Zeile 237 der Datei restriction_checker.c.
Benutzt GetFactor() und GetValue().
Wird benutzt von Learn().
00237 { 00238 return (GetValue(vname,map_ldfied,pl)*GetFactor(vname,map_ldfied,pl))/100; 00239 }


| varargs int GetFValueO | ( | string | vname, | |
| mapping | map_ldfied, | |||
| object | pl | |||
| ) |
Definiert in Zeile 247 der Datei restriction_checker.c.
Benutzt GetFactor(), GetOffset() und GetValue().
Wird benutzt von Learn(), LearnSkill(), LearnSpell() und UseSpell().
00247 { 00248 return ((GetValue(vname,map_ldfied,pl)*GetFactor(vname,map_ldfied,pl))/100 00249 + GetOffset(vname,map_ldfied,pl)); 00250 }


| varargs int GetOffset | ( | string | oname, | |
| mapping | map_ldfied, | |||
| object | pl | |||
| ) |
Definiert in Zeile 224 der Datei restriction_checker.c.
Benutzt GetValue() und OFFSET.
Wird benutzt von GetFValueO(), GetRandFValueO(), GetValueO(), InitialSkillAbility() und Learn().
00224 { 00225 mixed res; 00226 00227 // printf("GetOffset(%O):\n",oname); 00228 if (!oname || !(res=GetValue(OFFSET(oname),map_ldfied,pl))) 00229 return 0; 00230 if (res<-10000) res=-10000; 00231 else if (res>10000) res=10000; 00232 // printf("Offset: %O\n",res); 00233 return res; 00234 }


| varargs int GetRandFValueO | ( | string | vname, | |
| mapping | map_ldfied, | |||
| object | pl | |||
| ) |
Definiert in Zeile 253 der Datei restriction_checker.c.
Benutzt GetFactor(), GetOffset() und GetValue().
Wird benutzt von TryDefaultAttackSpell() und TryGlobalAttackSpell().
00253 { 00254 return (random(GetValue(vname,map_ldfied,pl)*GetFactor(vname,map_ldfied,pl))/100 00255 + GetOffset(vname,map_ldfied,pl)); 00256 }


| varargs int GetValue | ( | string | vname, | |
| mapping | map_ldfied, | |||
| object | pl | |||
| ) |
Definiert in Zeile 199 der Datei restriction_checker.c.
Benutzt execute_anything().
Wird benutzt von GetFactor(), GetFValue(), GetFValueO(), GetOffset(), GetRandFValueO(), GetValueO() und UseSpell().
00199 { 00200 mixed dat,res; 00201 00202 // printf("GetValue(%O): %O\n",vname,map_ldfied); 00203 if (!vname || !map_ldfied) return 0; 00204 if ((dat=map_ldfied[vname]) && (res=execute_anything(dat,pl,map_ldfied))) 00205 return res; 00206 // printf("Value: %O\n",dat); 00207 return intp(dat) ? dat : 0; 00208 }


| varargs int GetValueO | ( | string | vname, | |
| mapping | map_ldfied, | |||
| object | pl | |||
| ) |
Definiert in Zeile 242 der Datei restriction_checker.c.
Benutzt GetOffset() und GetValue().
00242 { 00243 return GetValue(vname,map_ldfied,pl)+GetOffset(vname,map_ldfied,pl); 00244 }

| mapping race_modifier | ( | object | pl, | |
| mapping | map_ldfied | |||
| ) |
Definiert in Zeile 35 der Datei restriction_checker.c.
Benutzt help, P_REAL_RACE und SM_RACE.
Wird benutzt von check_restrictions() und UseSpell().
00035 { 00036 mapping rmap,help; 00037 00038 if (mappingp(map_ldfied) && member(map_ldfied,SM_RACE) && objectp(pl) && mappingp(rmap=map_ldfied[SM_RACE])) 00039 // if (mappingp(help=rmap[pl->_query_real_race()])) 00040 if (mappingp(help=rmap[pl->QueryProp(P_REAL_RACE)])) 00041 return map_ldfied+help; 00042 else if(member(rmap,"*") && mappingp(help=rmap["*"])) 00043 return map_ldfied+help; 00044 return map_ldfied; 00045 }

1.6.3