#include "mech.h"
#include "muxevent.h"
#include "mech.events.h"
#include "mech.tech.h"
#include "p.mech.utils.h"
#include "p.btechstats.h"
#include "p.mech.build.h"
#include "p.mech.partnames.h"
Include dependency graph for mech.tech.c:
Go to the source code of this file.
Functions | |
int | game_lag (void) |
int | game_lag_time (int i) |
int | tech_roll (dbref player, MECH *mech, int diff) |
int | tech_weapon_roll (dbref player, MECH *mech, int diff) |
void | tech_status (dbref player, time_t dat) |
int | tech_addtechtime (dbref player, int time) |
int | tech_parsepart_advanced (MECH *mech, char *buffer, int *loc, int *pos, int *extra, int allowrear) |
int | tech_parsepart (MECH *mech, char *buffer, int *loc, int *pos, int *extra) |
int | tech_parsegun (MECH *mech, char *buffer, int *loc, int *pos, int *brand) |
static void | cheat_find_last (MUXEVENT *e) |
int | figure_latest_tech_event (MECH *mech) |
Variables | |
int | cheated_last = 0 |
static void cheat_find_last | ( | MUXEVENT * | e | ) | [static] |
Definition at line 222 of file mech.tech.c.
References cheated_last, my_event_type::data2, EVENT_REPAIR_FIX, EVENT_REPAIR_FIXI, FIXARMOR_TIME, FIXINTERNAL_TIME, muxevent_tick, ofs, PLAYERPOS, TECH_TICK, my_event_type::tick, and my_event_type::type.
Referenced by figure_latest_tech_event().
00223 { 00224 int ofs = e->tick - muxevent_tick; 00225 int amount = (((int) e->data2) % PLAYERPOS) / 16 - 1; 00226 00227 switch (e->type) { 00228 case EVENT_REPAIR_FIXI: 00229 ofs += amount * FIXINTERNAL_TIME * TECH_TICK; 00230 break; 00231 case EVENT_REPAIR_FIX: 00232 ofs += amount * FIXARMOR_TIME * TECH_TICK; 00233 break; 00234 } 00235 if(ofs > cheated_last) 00236 cheated_last = ofs; 00237 }
int figure_latest_tech_event | ( | MECH * | mech | ) |
Definition at line 239 of file mech.tech.c.
References cheat_find_last(), cheated_last, FIRST_TECH_EVENT, LAST_TECH_EVENT, and muxevent_gothru_type_data().
Referenced by fun_btunderrepair(), mech_startup(), mech_udisembark(), mechTechTimefunc(), tech_checkstatus(), and tech_repairs().
00240 { 00241 int i; 00242 00243 cheated_last = 0; 00244 for(i = FIRST_TECH_EVENT; i <= LAST_TECH_EVENT; i++) 00245 muxevent_gothru_type_data(i, (void *) mech, cheat_find_last); 00246 return cheated_last; 00247 }
int game_lag | ( | void | ) |
Definition at line 19 of file mech.tech.c.
References mudstate, muxevent_tick, statedata::now, and statedata::restart_time.
00020 { 00021 if(!muxevent_tick) 00022 return 0; 00023 return 100 * (mudstate.now - mudstate.restart_time) / muxevent_tick - 100; 00024 }
int game_lag_time | ( | int | i | ) |
Definition at line 26 of file mech.tech.c.
References game_lag().
Referenced by describe_repairs(), and tech_checkstatus().
00027 { 00028 return (100 + game_lag()) * i / 100; 00029 }
int tech_addtechtime | ( | dbref | player, | |
int | time | |||
) |
Definition at line 115 of file mech.tech.c.
References A_TECHTIME, mudstate, statedata::now, silly_atr_get(), silly_atr_set(), tech_status(), TECH_TICK, and tprintf().
00116 { 00117 time_t old; 00118 char *olds = silly_atr_get(player, A_TECHTIME); 00119 00120 if(olds) { 00121 old = (time_t) atoi(olds); 00122 if(old < mudstate.now) 00123 old = mudstate.now; 00124 } else 00125 old = mudstate.now; 00126 old += time * TECH_TICK; 00127 silly_atr_set(player, A_TECHTIME, tprintf("%u", old)); 00128 tech_status(player, old); 00129 return (old - mudstate.now); 00130 }
int tech_parsegun | ( | MECH * | mech, | |
char * | buffer, | |||
int * | loc, | |||
int * | pos, | |||
int * | brand | |||
) |
Definition at line 181 of file mech.tech.c.
References args, ArmorSectionFromString(), c, CritsInLoc(), find_matching_long_part(), FindWeaponNumberOnMech(), GetPartBrand, GetPartType, mech_parseattributes(), MechMove, and MechType.
00182 { 00183 char *args[3]; 00184 int l, argc, t, c = 0, pi, pb; 00185 00186 argc = mech_parseattributes(buffer, args, 3); 00187 if(argc < 1 || argc > (2 + (brand != NULL))) 00188 return -1; 00189 if(argc == (2 + (brand != NULL)) || (brand && argc == 2 && atoi(args[1]))) { 00190 if((*loc = 00191 ArmorSectionFromString(MechType(mech), MechMove(mech), 00192 args[0])) < 0) 00193 return -1; 00194 l = atoi(args[1]); 00195 if(l <= 0 || l > CritsInLoc(mech, *loc)) 00196 return -4; 00197 *pos = l - 1; 00198 } else { 00199 /* Check if it's a number */ 00200 if(args[0][0] < '0' || args[0][0] > '9') 00201 return -1; 00202 l = atoi(args[0]); 00203 if(l < 0) 00204 return -1; 00205 if((t = FindWeaponNumberOnMech(mech, l, loc, pos)) == -1) 00206 return -1; 00207 } 00208 t = GetPartType(mech, *loc, *pos); 00209 if(brand != NULL && argc > 1 && !atoi(args[argc - 1])) { 00210 if(!find_matching_long_part(args[argc - 1], &c, &pi, &pb)) 00211 return -2; 00212 if(pi != t) 00213 return -3; 00214 *brand = pb; 00215 } else if(brand != NULL) 00216 *brand = GetPartBrand(mech, *loc, *pos); 00217 return 0; 00218 }
int tech_parsepart | ( | MECH * | mech, | |
char * | buffer, | |||
int * | loc, | |||
int * | pos, | |||
int * | extra | |||
) |
Definition at line 176 of file mech.tech.c.
References tech_parsepart_advanced().
00177 { 00178 return tech_parsepart_advanced(mech, buffer, loc, pos, extra, 0); 00179 }
int tech_parsepart_advanced | ( | MECH * | mech, | |
char * | buffer, | |||
int * | loc, | |||
int * | pos, | |||
int * | extra, | |||
int | allowrear | |||
) |
Definition at line 132 of file mech.tech.c.
References args, ArmorSectionFromString(), CritsInLoc(), mech_parseattributes(), MechMove, and MechType.
Referenced by tech_parsepart(), and TECHCOMMANDH().
00134 { 00135 char *args[5]; 00136 int l, argc, isrear = 0; 00137 00138 if(!(argc = mech_parseattributes(buffer, args, 4))) 00139 return -1; 00140 if(argc > (2 + (extra != NULL))) 00141 return -1; 00142 if(!allowrear) { 00143 if((!extra && argc != (1 + (pos != NULL))) || (extra && 00144 (argc < 00145 (1 + (pos != NULL)) 00146 || argc > 00147 (2 + (pos != NULL))))) 00148 return -1; 00149 } else { 00150 if(argc == 2) { 00151 if(toupper(args[1][0]) != 'R') 00152 return -1; 00153 isrear = 8; 00154 } 00155 } 00156 if((*loc = 00157 ArmorSectionFromString(MechType(mech), MechMove(mech), args[0])) < 0) 00158 return -1; 00159 if(allowrear) 00160 *loc += isrear; 00161 if(pos) { 00162 l = atoi(args[1]) - 1; 00163 if(l < 0 || l >= CritsInLoc(mech, *loc)) 00164 return -2; 00165 *pos = l; 00166 } 00167 if(extra) { 00168 if(argc > 2) 00169 *extra = args[2][0]; 00170 else 00171 *extra = 0; 00172 } 00173 return 0; 00174 }
Definition at line 31 of file mech.tech.c.
References AccumulateTechXP(), BOUNDED(), char_rollsaving(), FindTechSkill(), HasBoolAdvantage(), In_Character, MAX, MECH::mynum, notify_printf(), Roll(), and Wizard.
Referenced by TECHCOMMANDH(), TFUNC_LOC(), TFUNC_LOC_RESEAL(), TFUNC_LOC_VAL(), and TFUNC_LOCPOS().
00032 { 00033 int s; 00034 int succ; 00035 int r = 00036 (HasBoolAdvantage(player, "tech_aptitude") ? char_rollsaving() : 00037 Roll()); 00038 00039 s = FindTechSkill(player, mech); 00040 s += diff; 00041 succ = r >= s; 00042 if(Wizard(player)) { 00043 notify_printf(player, "Tech - BTH: %d(Base:%d, Mod:%d) Roll: %d", 00044 s, s - diff, diff, r); 00045 } else { 00046 notify_printf(player, "BTH: %d Roll: %d", s, r); 00047 } 00048 if(succ && In_Character(mech->mynum)) 00049 AccumulateTechXP(player, mech, BOUNDED(1, s - 7, MAX(2, 1 + diff))); 00050 return (r - s); 00051 }
void tech_status | ( | dbref | player, | |
time_t | dat | |||
) |
Definition at line 81 of file mech.tech.c.
References A_TECHTIME, MAX_TECHTIME, MBUF_SIZE, mudstate, notify, statedata::now, silly_atr_get(), TECH_TICK, and TECH_UNIT.
Referenced by tech_addtechtime().
00082 { 00083 char buf[MBUF_SIZE]; 00084 char *olds; 00085 int un; 00086 00087 if(dat <= 0) { 00088 olds = silly_atr_get(player, A_TECHTIME); 00089 if(olds) { 00090 dat = (time_t) atoi(olds); 00091 if(dat < mudstate.now) 00092 dat = mudstate.now; 00093 } else 00094 dat = mudstate.now; 00095 } 00096 if(dat <= mudstate.now) 00097 notify(player, "You have no jobs pending!"); 00098 else { 00099 un = (dat - mudstate.now) / TECH_TICK; 00100 sprintf(buf, "You have %d %s%s of repairs pending", un, TECH_UNIT, 00101 un != 1 ? "s" : ""); 00102 if(un >= MAX_TECHTIME) 00103 sprintf(buf + strlen(buf), 00104 " and you're too tired to do more efficiently."); 00105 else { 00106 un = MAX_TECHTIME - un; 00107 sprintf(buf + strlen(buf), 00108 " and you're ready to do at least %d more %s%s of work.", 00109 un, TECH_UNIT, un == 1 ? "" : "s"); 00110 } 00111 notify(player, buf); 00112 } 00113 }
Definition at line 53 of file mech.tech.c.
References AccumulateTechWeaponsXP(), BOUNDED(), char_getskilltarget(), char_rollsaving(), HasBoolAdvantage(), In_Character, MAX, MECH::mynum, notify_printf(), Roll(), and Wizard.
Referenced by TECHCOMMANDH().
00054 { 00055 int s; 00056 int succ; 00057 int r = 00058 (HasBoolAdvantage(player, "tech_aptitude") ? char_rollsaving() : 00059 Roll()); 00060 00061 s = char_getskilltarget(player, "technician-weapons", 0); 00062 s += diff; 00063 succ = r >= s; 00064 if(Wizard(player)) { 00065 notify_printf(player, 00066 "Tech-W - BTH: %d(Base:%d, Mod:%d) Roll: %d", s, 00067 s - diff, diff, r); 00068 } else { 00069 notify_printf(player, "BTH: %d Roll: %d", s, r); 00070 } 00071 if(succ && In_Character(mech->mynum)) 00072 AccumulateTechWeaponsXP(player, mech, BOUNDED(1, s - 7, MAX(2, 00073 1 + 00074 diff))); 00075 return (r - s); 00076 }
int cheated_last = 0 |
Definition at line 220 of file mech.tech.c.
Referenced by cheat_find_last(), and figure_latest_tech_event().