#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "emlen.h"
#ifndef WINDOWS
#include <sys/errno.h>
#include <netinet/in.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/time.h>
#include <dirent.h>
#endif
#ifdef NEW_WORLD
void create_standards(CHAR_DATA *ch, char *argy) {
int i=0;
int start_vnum;
int cur_vnum;
int wearloc_counter=0;
char arg1[500];
char arg2[500];
char buf[500];
DEFINE_COMMAND("create_standards",create_standards,POSITION_DEAD,110,LOG_ALWAYS,"Creates standard items.. for Orin only.. can be dangerous.")
/* 30 vnums reserved for each material type, starting at vnum specified */
/* Skip 30 vnums if material type is disabled. */
argy=one_argy(argy,arg1);
if (!is_number(arg1)) return;
start_vnum=atoi(arg1);
cur_vnum=start_vnum;
argy=one_argy(argy,arg2);
if (str_cmp(arg2,"YES")) return;
while (str_cmp(materials[i].name,"END")) {
for (wearloc_counter=0; wearloc_counter<8; wearloc_counter++) {
sprintf(buf,"create %d",cur_vnum);
do_oedit(ch,buf);
((OBJ_PROTOTYPE *) ch->desc->pEdit)->extra_flags=materials[i].initflags;
sprintf(buf,"material %d",i+1);
oedit(ch,buf);
oedit(ch,"armor");
oedit(ch,"take");
sprintf(buf,"v6 %d",materials[i].strength);
oedit(ch,buf);
sprintf(buf,"v7 %d",materials[i].strength);
oedit(ch,buf);
sprintf(buf,"v5 %d",materials[i].a_slash);
oedit(ch,buf);
sprintf(buf,"v4 %d",materials[i].a_pound);
oedit(ch,buf);
sprintf(buf,"v8 %d",materials[i].a_pierce);
oedit(ch,buf);
if (wearloc_counter==0) {
oedit(ch,"body");
sprintf(buf,"cost %d",materials[i].cost/3);
oedit(ch,buf);
sprintf(buf,"weight %d",materials[i].weight/4);
oedit(ch,buf);
sprintf(buf,"v1 %d",materials[i].armor);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"name breastplate plate %s",materials[i].name);
else
sprintf(buf,"name shirt %s",materials[i].name);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"short a %s breastplate",materials[i].name);
else
sprintf(buf,"short a %s shirt",materials[i].name);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"long A %s breastplate lies on the ground here.",materials[i].name);
else
sprintf(buf,"long A %s shirt lies on the ground here.",materials[i].name);
oedit(ch,buf);
}
if (wearloc_counter==1) {
oedit(ch,"head");
sprintf(buf,"weight %d",materials[i].weight/7);
oedit(ch,buf);
sprintf(buf,"cost %d",materials[i].cost/6);
oedit(ch,buf);
sprintf(buf,"v2 %d",materials[i].armor);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"name helm helmet %s",materials[i].name);
else
sprintf(buf,"name hood %s",materials[i].name);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"short a %s helmet",materials[i].name);
else
sprintf(buf,"short a %s hood",materials[i].name);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"long A %s helmet lies on the ground here.",materials[i].name);
else
sprintf(buf,"long A %s hood lies on the ground here.",materials[i].name);
oedit(ch,buf);
}
if (wearloc_counter==2) {
oedit(ch,"legs");
sprintf(buf,"weight %d",materials[i].weight/5);
oedit(ch,buf);
sprintf(buf,"cost %d",materials[i].cost/5);
oedit(ch,buf);
sprintf(buf,"v0 %d",materials[i].armor);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"name leggings %s",materials[i].name);
else
sprintf(buf,"name pants %s",materials[i].name);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"short some %s leggings",materials[i].name);
else
sprintf(buf,"short some %s pants",materials[i].name);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"long Some %s leggings are here on the ground.",materials[i].name);
else
sprintf(buf,"long Some %s pants are here on the ground.",materials[i].name);
oedit(ch,buf);
}
if (wearloc_counter==3) {
oedit(ch,"feet");
sprintf(buf,"weight %d",materials[i].weight/7);
oedit(ch,buf);
sprintf(buf,"cost %d",materials[i].cost/7);
oedit(ch,buf);
sprintf(buf,"v0 %d",materials[i].armor);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"name boots %s",materials[i].name);
else
sprintf(buf,"name shoes %s",materials[i].name);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"short some %s boots",materials[i].name);
else
sprintf(buf,"short some %s shoes",materials[i].name);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"long Some %s boots are here on the ground.",materials[i].name);
else
sprintf(buf,"long Some %s shoes are here on the ground.",materials[i].name);
oedit(ch,buf);
}
if (wearloc_counter==4) {
oedit(ch,"hands");
sprintf(buf,"weight %d",materials[i].weight/8);
oedit(ch,buf);
sprintf(buf,"cost %d",materials[i].cost/8);
oedit(ch,buf);
sprintf(buf,"v3 %d",materials[i].armor);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"name gauntlets %s",materials[i].name);
else
sprintf(buf,"name gloves %s",materials[i].name);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"short some %s gauntlets",materials[i].name);
else
sprintf(buf,"short some %s gloves",materials[i].name);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"long Some %s gauntlets are here on the ground.",materials[i].name);
else
sprintf(buf,"long Some %s gloves are here on the ground.",materials[i].name);
oedit(ch,buf);
}
if (wearloc_counter==5) {
oedit(ch,"arms");
sprintf(buf,"weight %d",materials[i].weight/6);
oedit(ch,buf);
sprintf(buf,"cost %d",materials[i].cost/5);
oedit(ch,buf);
sprintf(buf,"v3 %d",materials[i].armor);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"name armplates %s",materials[i].name);
else
sprintf(buf,"name sleeves %s",materials[i].name);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"short some %s armplates",materials[i].name);
else
sprintf(buf,"short some %s sleeves",materials[i].name);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"long Some %s armplates are here on the ground.",materials[i].name);
else
sprintf(buf,"long Some %s sleeves are here on the ground.",materials[i].name);
oedit(ch,buf);
}
if (wearloc_counter==6) {
oedit(ch,"waist");
sprintf(buf,"v1 %d",materials[i].armor/2);
oedit(ch,buf);
sprintf(buf,"cost %d",materials[i].cost/6);
oedit(ch,buf);
sprintf(buf,"v0 %d",materials[i].armor/2);
oedit(ch,buf);
sprintf(buf,"weight %d",materials[i].weight/7);
oedit(ch,buf);
sprintf(buf,"name belt %s",materials[i].name);
oedit(ch,buf);
sprintf(buf,"short a %s belt",materials[i].name);
oedit(ch,buf);
sprintf(buf,"long A %s belt lies on the ground here.",materials[i].name);
oedit(ch,buf);
}
if (wearloc_counter==7) {
oedit(ch,"shoulder");
sprintf(buf,"weight %d",materials[i].weight/8);
oedit(ch,buf);
sprintf(buf,"cost %d",materials[i].cost/7);
oedit(ch,buf);
sprintf(buf,"v2 %d",materials[i].armor/2);
oedit(ch,buf);
sprintf(buf,"v1 %d",materials[i].armor/2);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"name shoulderplate %s",materials[i].name);
else
sprintf(buf,"name shoulderpad %s",materials[i].name);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"short a %s shoulderplate",materials[i].name);
else
sprintf(buf,"short a %s shoulderpad",materials[i].name);
oedit(ch,buf);
if (materials[i].s_bplate_etc)
sprintf(buf,"long A %s shoulderplate lies on the ground here.",materials[i].name);
else
sprintf(buf,"long A %s shoulderpad lies on the ground here.",materials[i].name);
oedit(ch,buf);
}
cur_vnum++;
}
cur_vnum+=22;
i++;
}
send_to_char("Done with standards!\n\r",ch);
return;
}
#endif
int count_mat(void) {
int i=0;
while (str_cmp(materials[i].name,"END")) i++;
return i;
}
void handle_points(MOB_PROTOTYPE *mobp, CHAR_DATA *mob) {
#ifdef NEW_WORLD
int pts=mobp->points;
int i;
int available=pts-12;
OBJ_PROTOTYPE *op;
SINGLE_OBJECT *obj;
int ran;
int vn;
int max=count_mat();
if (pts==0) return;
if (number_range(1,5)==2 && available>0) { /* Body */
while (1) {
ran=number_range(0,max);
if (available<materials[ran].pointcost) continue;
if (mobp->level<materials[ran].min_level) continue;
vn=400+(ran*30);
if ( (op=get_obj_index(vn)) == NULL) return;
available-=materials[ran].pointcost;
obj = create_object(op,7);
obj_to(obj,mob);
wear_obj(mob,obj,FALSE,0);
break;
}
} else
{
vn=400;
if ( (op=get_obj_index(vn)) == NULL) return;
available-=materials[0].pointcost;
obj = create_object(op,7);
obj_to(obj,mob);
wear_obj(mob,obj,FALSE,0);
}
available+=5;
if (number_range(1,5)==2 && available>0) { /* Pants */
while (1) {
ran=number_range(0,max);
if (available<materials[ran].pointcost) continue;
if (mobp->level<materials[ran].min_level) continue;
vn=402+(ran*30);
if ( (op=get_obj_index(vn)) == NULL) return;
available-=materials[ran].pointcost;
obj = create_object(op,7);
obj_to(obj,mob);
wear_obj(mob,obj,FALSE,0);
break;
}
} else
{
vn=402;
if ( (op=get_obj_index(vn)) == NULL) return;
available-=materials[0].pointcost;
obj = create_object(op,7);
obj_to(obj,mob);
wear_obj(mob,obj,FALSE,0);
}
available+=5;
if (number_range(1,5)==2 && available>0) { /* Shoes */
while (1) {
ran=number_range(0,max);
if (available<materials[ran].pointcost) continue;
if (mobp->level<materials[ran].min_level) continue;
vn=403+(ran*30);
if ( (op=get_obj_index(vn)) == NULL) return;
available-=materials[ran].pointcost;
obj = create_object(op,7);
obj_to(obj,mob);
wear_obj(mob,obj,FALSE,0);
break;
}
} else
{
vn=403;
if ( (op=get_obj_index(vn)) == NULL) return;
available-=materials[0].pointcost;
obj = create_object(op,7);
obj_to(obj,mob);
wear_obj(mob,obj,FALSE,0);
}
if (number_range(1,5)==2 && available>6) { /* Hood/etc */
while (1) {
ran=number_range(0,max);
if (available<materials[ran].pointcost) continue;
if (mobp->level<materials[ran].min_level) continue;
vn=401+(ran*30);
if ( (op=get_obj_index(vn)) == NULL) return;
available-=materials[ran].pointcost;
obj = create_object(op,7);
obj_to(obj,mob);
wear_obj(mob,obj,FALSE,0);
break;
}
}
for (i=4; i<8; i++) {
if (available>6) { /* Other Stuff */
while (1) {
ran=number_range(0,max);
if (available<materials[ran].pointcost) continue;
if (mobp->level<materials[ran].min_level) continue;
vn=400+i+(ran*30);
if ( (op=get_obj_index(vn)) == NULL) return;
available-=materials[ran].pointcost;
obj = create_object(op,7);
obj_to(obj,mob);
wear_obj(mob,obj,FALSE,0);
goto here;
}
}
here:
}
#endif
return;
}