存盘方式的XYJ2000的当铺文件MUD代码

更新时间:2023-03-08 06:12:36 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

/*

Created by waiwai@2009/01/12 改制用于XYJ

在原XYJ文件的基础上,尽量不动原系统底层情况下进行。 当铺永远是低买高卖,这点应该体现。

将本文件CP至/std/room/目录下 然后在/include/globals.h中加入: #define HOCKSHOP_NEW

\

然后仅将长安和开封的当铺房间文件中的:inherit HOCKSHOP; 改为:inherit HOCKSHOP_NEW;

以下两点是必须修改(仅指修改为HOCKSHOP_NEW的当铺):

1、所有当铺老板文件顶部inherit NPC;

下面加入:int is_hock_boss() { return 1; }

2、在/std/room.c中,顶部的int query_max_items() {return 30;} 下面加入:int is_room() { return 1; }

以下几点可酌情修改:

1、所有动态名字的文件,文件顶部加入: int is_random_name() { return 1; } 如果具有no_sell或者无价值可以不加。

2、在/feature/food.c顶部void init() 上面加入:int is_food() { return 1; }

3、增加收购种类,可以比如单独在/d/city/dangpu.c中顶部的 void create () 上面加入:

int is_add_pawn_num() { return 100; }

加入后长安的当铺就是200个种类了,其它的还是100个。

4、can_sell参数可以随意设定一个不能卖的物品可以卖掉。 除了特殊的或者具有no_sell的

5、统一将look paizi一类的改为look sign且不写入房间,避免存盘 后无法修改,凡是想要可以look sign的房间,仅需在房间文件顶 部加入:

int look_sign() { return 1; }

1

巫师可以使用sell -d <物品id>清除当铺中某一种卖品。 */

#include

inherit ROOM; inherit F_SAVE;

int do_sellt(object ob, object me, string boss_name); int do_listhock();

mapping pawned_objects = ([]);

int is_hockshop_room() { return 1; } string money_num(int amount); string log_time();

string filter_color(string arg); string log_id(object ob); int money_all_inv(object me); int color_len(string str);

/* 收购价和原值的比率 */ #define sell_rate

/* 收购后卖出价比率 */ #define to_sell_rate 0.9

/* 可以保存的物品种类基础最大量 */ #define CAN_SAVE_OBJECT 100 #define BUSY_MESSAGE #define ERR_FILE_ZERO

/* 可以保存的单个物品个数最大数量 */ static int max_items = 999; /* 具有操作权限的最低巫师等级 */

// 设定为5在XYJ中指仅可admin权限有权操作 static int Wiz_L = 5;

/* 价值小于 1 两银子的物品当铺不收 */ static int min_value = 100;

string domain_hock_file(string file) {

\你现在忙得很,无法做任何事情。\\n\HIR\文件载入错误,请向管理员反馈。\\n\0.7

2

}

string domain;

if(sscanf(file, \

return domain; else

if(sscanf(file, \

return domain; else

if(sscanf(file, \

return domain;

return 0;

/* 收购种类多样性 */ int rdm_obj_num() { }

/* 是否有BOSS */

object have_hock_boss(object room) {

inv=deep_inventory(room); i=sizeof(inv); while(i--) { }

if(!inv[i] || !inv[i]->is_hock_boss()) continue; flag++; obj=inv[i]; if(!room) return 0; object *inv, obj; int i, flag=0; return tol; if(f)

tol+=f;

f=this_object()->is_add_pawn_num(); tol=CAN_SAVE_OBJECT; int tol, f;

3

}

void init() { }

/* 该当铺存放文件路径和名称 */ string query_save_file() { }

void setup() {

::setup();

seteuid(getuid()); return file;

if(file_size(file)==-1)

assure_file(file);

file=DATA_DIR+\name = base_name(this_object()); if(name[0..0] == \

name = name[1..];

name = replace_string(name,\string name, file;

add_action(\add_action(\

add_action(\add_action(\add_action(\return obj; if(!living(obj)) { }

write(obj->name()+\目前的状态无法办理业务。\\n\return 0; if(flag<1) { }

write(\当铺掌柜不在,无法进行交易。\\n\return 0;

4

}

restore();

/* 获取当票 */

int do_givestamps(string arg) {

if(!stamp_ob) {

stamp_ob = new(\

/* 系统中所有NEW的地方,必须做此判断 */ if(!stamp_ob) { }

stamp_ob->move(me,1);

write(name+\不耐烦的看了你一眼,身上有一张还要?\\n\

write(\当票文件出错,请联络巫师解决。\\n\return 1;

stamp_ob=present(\/* 这里控制存入即可控制典当的地点 */ if(efile!=\

return notify_fail(\这里尚未开放典当业务。\\n\efile=domain_hock_file(r_file); name=boss->query(\

////////////////////////////////////////////////////////

r_file=base_name(this_object()); boss=have_hock_boss(this_object()); if(!boss) return 1; // 禁止冒充BOSS

if(boss->query(\ }

write(query(\当前法定持牌人不在,无法进行交易。\\n\return 1;

////////////////////////////////////////////////////////

if(me->is_busy()) return notify_fail(BUSY_MESSAGE); me=this_player();

object stamp_ob, me, boss; string efile, name, r_file;

} else {

5

}

}

return 1;

write(name+\瞟了你一眼,扔给你一张当票。\\n\if(!me->is_busy())

me->start_busy(1);

return 1;

/* 收购前判断物品 */

int do_sellob_filter(object ob, string boss_name) {

if( ob->query(\

return notify_fail(boss_name+\摇摇头说道:“这种东西我不识货,不敢要。”\\n\

file=base_name(ob); if(ob->is_character())

return notify_fail(boss_name+\说道:小店奉公守法,不敢贩卖人口。\\n\if(ob->is_corpse())

return notify_fail(boss_name+\说道:这是谁的尸首快搬走,我们这还要做生意呢。if(ob->is_food() && !ob->query(\

return notify_fail(boss_name+\说道:食品留着自己吃吧。\\n\if( ob->query(\

return notify_fail(boss_name+\说道:这是「钱」,你没见过吗?\\n\if( ob->query(\

return notify_fail(boss_name+\说道:假货,不要不要!\\n\if( ob->is_diablo_obj() )

return notify_fail(boss_name+\说道:暗黑城里面出来的东西本店不敢收。\\n\if(!objectp(ob))

return 0; mixed ns; string file;

\\n\

6

if(file->query_amount() && file->query_amount()>1) { }

if(ob->query(\

return notify_fail(boss_name+\说道:这样东西看来象个假货,本店不收。\\n\message(\┋HOCKSHOP_QC┋Sell:ROOM(%s),%s\\n\\n\

base_name(this_object()), base_name(ob)), users()); return notify_fail(\系统禁止\这类物品的交易。\\n\

if(!ob->query(\

if(ob->query(\

|| ob->is_no_clone() || ob->is_sell_des() || ob->query(\|| ob->query(\|| ob->query(\|| ob->query(\|| ob->query(\|| ob->query(\|| ob->query(\|| ob->query(\|| ob->query(\

return notify_fail(boss_name+\说道:本店目前不予收购\。

\\n\

if(ob->is_random_name())

return notify_fail(boss_name+\说道:这种辨不清名字的物品不予收购!

\\n\

if(ob->must_owner_id())

return notify_fail(boss_name+\说道:属主属性物品不予收购!\\n\

if (ob->query(\

return notify_fail(boss_name+\说道:拿个喝过的也想来骗钱啊!\\n\

ob->query(\

if (ob->is_container() && !ob->is_armor())

return notify_fail(boss_name+\说道:这里不收购容器!\\n\

if( ob->query(\

return notify_fail(boss_name+\说道:神器物品我们这里不敢收购。\\n\

if (ob->query_unique() || ob->query(\

return notify_fail(boss_name+\说道:法宝类物品我们这里不敢收购。\\n\

7

}

/* 收购动作 */

int do_sell(string arg) {

object ob, *inv, me, boss;

me=this_player();

if(me->is_busy()) return notify_fail(BUSY_MESSAGE); string *items, file, name, log_file; int i, n;

return 1; }

return notify_fail(boss_name+\摇摇头说道:“这种东西我不识货,不敢要。”\\n\if( ns = ob->query(\

if (stringp(ns))

return notify_fail(boss_name+\摇摇头说道:\

}

if (ob->query(\

return notify_fail(boss_name+\忙摇头道:“小的只有一个脑袋,可不敢买大神

// 如果是帮会属性物品 if(ob->query(\

return notify_fail(CYN+boss_name+\惊道:“小的胆子很小,可\

if(ob->is_ctl_ob() || ob->is_iron_class_res() || ob->is_self_object())

return notify_fail(boss_name+\说道:这样东西小铺可是不敢保存。\\n\

if( ob->query(\

return notify_fail(boss_name+\说道:水的东西我们这里没法存放。\\n\

if( ob->query(\

return notify_fail(boss_name+\说道:冰的东西我们这里没法存放。\\n\

if( ob->query(\

return notify_fail(boss_name+\说道:\上做着记号呢,这里不

敢收购。\\n\

\不敢买\的东西。”\\n\

的东西。”\\n\

8

}

return 1;

save();

map_delete(pawned_objects, items[i]);

log_file(\在%s删除了卖品中

log_time(), log_id(me),

pawned_objects[items[i]], items[i]->query(\

的%d%s%s。\\n\

filter_color(this_object()->query(\filter_color(items[i]->query(\

log_file=LOG_DIR\if(file_size(log_file)==-1)

assure_file(log_file);

tell_object(me,HIG\你完全删除了物品列表中的

HIG\这项物品,数量:\。\\n\

\

if( i >= sizeof(pawned_objects) )

return notify_fail(\目前没有\这个物品!\\n\

for(i=0;i

if(items[i]->id(arg)) break;

if(n<0)

return notify_fail(\没有这项物品。\\n\

if(!arg)

return notify_fail(\你要删除哪项物品?\\n\

items = keys(pawned_objects); n = sizeof(items);

// Added by waiwai@2004/11/11 为了便于管理,有必要增加如下设定 if( wiz_level(me)>Wiz_L && arg && sscanf(arg,\if(!arg)

return notify_fail(\你要卖断什么物品?\\n\

9

//////////////////////////////////////////////////////// } /* 估价付款

针对金钱出的时候很少会出BUG,进的时候很容易出BUG 大部分情况是负重与BUSY引起的,因此,付款给玩家的 设置做了直接划入钱庄,省得啰嗦。 */

int do_sellt(object ob,object me, string boss_name) {

amount = ob->query_amount();

// 为了系统规范和扩展需要,个数性物品,必须严格写有 if(!objectp(ob) || !objectp(me))

return 0;

int value, amount, pay, thisnum, index, balance; string file, msg, msg2=\string *sell_msg = ({ });

\破破烂烂,一文不值\\质地低劣,难看之极\\又脏又破,臭气熏天\return do_sellt(ob, me, name); if(!do_sellob_filter(ob, name))

return 0;

if(!(ob = present(arg, me)))

return notify_fail(\你要卖断什么物品?\\n\name=boss->query(\

////////////////////////////////////////////////////////

// Added by waiwai@2012/02/22 boss=have_hock_boss(this_object()); if(!boss) return 1; // 禁止冒充BOSS

if(boss->query(\ }

write(query(\当前法定持牌人不在,无法进行交易。\\n\return 1;

10

// base_value和base_unit,任何巫师都必须认真对待

value = ob->query(\if(!value)

value = ob->query(\

if (amount>=1 ) {

} else

value = ob->query(\

if(!value )

return notify_fail(sprintf(\一文不值。\\n\

/* 对于个数性query_mount()物品必须按照实际个数给予计算金钱 * 但是卖后当铺文件不能累加这个数量,比如500包药,卖时会给 * 玩家按500包的收购价值计算,但当铺收购后会认定为1包,也就 * 是list显示是1包的数量,以次数计算数量,而不是实际个数。 * 这种设定是为了避免达到收购数量限制的问题,比如当铺只收购 * 500件货物,某人一次性卖了500包药,再有人过来卖当铺就不收 * 了,这种问题需要避免。虽然按道理应该计算实际的个数在当铺 * 中,但实际和现实总有特殊性,需要特殊设置的。如果不限制收 * 购总件数也是不现实的。 */

value = value * sell_rate * amount; value = value * sell_rate;

if( amount>=1 )

else

value=to_int(value); if(!value )

return notify_fail(sprintf(\一文不值。\\n\

// 人性化设置 switch(random(6)) {

case 0:

s_msg=\宝象国\ case 1:

s_msg=\车迟国\ case 2:

s_msg=\玉华县\ case 3:

s_msg=\乌鸡国\ case 4:

s_msg=\钦法国\ case 5:

11

s_msg=\祭赛国\

// 矿脉类或某些数量过多的物品卖后直接清除,不保留在物品栏 // 某些数量过多的物件,可在上设定is_sell_des()标记 if( ob->is_iron_class_res() || ob->is_sell_des() ) {

msg2 = sprintf(\又接着说道:%s在本店不予储藏,将贩运到%s。\\n\boss_name, if(pawned_objects[file]) { }

map_delete(pawned_objects,file);

if(!undefinedp(pawned_objects[file]) ) {

pay=1;

if(value <= min_value)

return notify_fail(ob->query(\收购价目前为:\,thisnum=pawned_objects[file]; }

file = base_name(ob);

低于最低收购价\,不予收购。\\n\

ob->query(\

} else

if(pawned_objects[file] > max_items) {

msg2 = sprintf(\又接着说道:因%s在本店储藏量已达到%d,将贩运到%s。\\n\boss_name, ob->query(\

} else

if(pawned_objects[file] < max_items) { // 数量 }

pawned_objects[file]++;

} else

/////////////////////////////////////////////////////////////////////////////////////////////////////////

// 总的种类判断

if(sizeof(pawned_objects) < rdm_obj_num()) {

pawned_objects += ([ file : 1 ]); pay=1;

} else

if(sizeof(pawned_objects) >= rdm_obj_num()) {

for(index=1;index<=rdm_obj_num()/10;index++) { } pay=0;

if( undefinedp(pawned_objects[index]) ) continue; map_delete(pawned_objects, index);

12

}

return notify_fail(query(\最多收购\个种类的物品,

请到别处卖吧。\\n\

/////////////////////////////////////////////////////////////////////////////////////////////////////////

balance=(int)me->query(\

log_file(\

sprintf(\在%s当品获利%s,物品:%d%s%s[%s.c]。\\n\

log_time(), log_id(me), filter_color(this_object()->query(\money_num(value), amount>0?amount:1,

ob->query(\filter_color(log_id(ob)), base_name(ob) ));

log_file=LOG_DIR\if(file_size(log_file)==-1)

assure_file(log_file);

if(!me->is_busy()) me->start_busy(1); if(msg2!=\

write(msg2);

msg = sprintf(\唱道:%s%s%d%s,当%s。\\n\

boss_name, sell_msg[random(sizeof(sell_msg))], ob->query(\amount?amount:1, money_num(value) );

if(!me->query(\

message_vision(sprintf(\把身上的%d%s%s拿出卖断到%s。\\n\

(amount?amount:1),

ob->query(\

if(msg3!=\

write(msg3);

ob->query(\

else

write(sprintf(\你把身上的%d%s%s拿出卖断到%s。\\n\

(amount?amount:1),

ob->query(\

ob->query(\

ob->query(\

write(\

13

}

int do_list(string arg) {

msg += \━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━msg += \序号] [ 商 品 名 称 ] [ 现货卖出单价 ] ━━━━━━━━━━━━━━━━━━━━━━━\\n\

msg = sprintf(\收购比率:%d%% 出售比率:%d%%\\n\

cd_desc?cd_desc:query(\boss_name?\法定持牌人:\to_int(sell_rate*100), to_int(to_sell_rate*100)); if(this_object()->completed_year())

cd_desc= \自\纪年

if(boss && boss->query(\

boss_name=log_id(boss); boss=have_hock_boss(this_object()); if(!sizeof(pawned_objects))

return notify_fail(query(\目前没有任何货物可卖。\\n\me=this_player(); restore();

string msg, *items, nummsg, file, obj_desc, lgfile=\int i, n, value, amount, thisnum, Ovalue, flag; object obj, me, boss;

string rate_desc, pawn_desc=\return 1; }

destruct(ob); save(); if(pay) {

me->add(\

write(sprintf(\你相记钱庄存款增加了%s[%s → %s]。\\n\

money_num(value), money_num(balance),

money_num((int)me->query(\

me->save();

\落成]\

14

[ 库 存 量 ] [ 基准收购单价 ]\\n\

msg +=

sprintf(\ery(\

file->query(\

file->query(\(25+color_len(money_num(value)))+\→ 数i+1,

file->query(\money_num(value), thisnum,

thisnum=pawned_objects[file];

value = value * to_sell_rate;

Ovalue = value * sell_rate;

if(file->query(\

value = file->query(\value = file->query(\else

obj=new(file); // 路径容错

if(!objectp(obj)) { }

flag++;

lgfile+=file+\continue;

n = sizeof(items); flag=0;

for(i=0;i

file=items[i];

items = keys(pawned_objects);

msg += \──────────────────────────────────────────────────────────\\n\

量:=%-3s %\

file->name()+\

money_num(Ovalue) );

15

}

}

if(obj) destruct(obj);

msg += \───────────────────────────────────msg += \序号] [ 商 品 名 称 ] [ 现货卖出单价 ] msg += \━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━msg += \注:请用 \物品ID>\来购买物品。目前\

\提供销售 \个种类的商品。[定义 \buy_of_bank 1\为

───────────────────────\\n\[ 库 存 量 ] [ 基准收购单价 ]\\n\━━━━━━━━━━━━━━━━━━━━━━━\\n\

钱庄转账购买方式]\\n\

if(this_object()->is_add_pawn_num()>0)

pawn_desc=\↑\

msg += sprintf(\最大收购种类为:%d个%s。最大储藏单个物品数量为:%d。估价后低

query(\

于%s之物品不予收购。\\n\

me->start_more(msg); if(flag>0)

log_time(), environment(), base_name(this_object()), lgfile));

log_file(\→ %s\\n\

return 1;

int do_buy(string arg) {

if( !arg )

return notify_fail(\你要买什么东西?\\n\if(!sizeof(pawned_objects))

return notify_fail(query(\里现在没有待出售的货物。\\n\if(me->is_busy()) return notify_fail(BUSY_MESSAGE); me=this_player();

int i, n, value, pay, balance; object ob, me, boss;

string *items, unit, boss_name, file, log_file; int p=0;

16

if(file->query(\

value = file->query(\if(value)

value = file->query(\

if( i >= to_int(sizeof(pawned_objects)))

return notify_fail(\你要买什么东西?\\n\for(i=0;i

if(items[i]->id(arg)) { }

return notify_fail(\没有这样东西。\\n\

file=items[i]; p++; break;

items = keys(pawned_objects); n = to_int(sizeof(items)); if(n<1)

return notify_fail(\这里目前没有任何东西出售。\\n\balance=(int)me->query(\boss_name=boss->query(\

////////////////////////////////////////////////////////

if(!me->query(\ }

// Added by waiwai@2012/02/22 boss=have_hock_boss(this_object()); if(!boss) return 1; // 禁止冒充BOSS

if(boss->query(\ }

write(query(\当前法定持牌人不在,无法进行交易。\\n\return 1;

if(money_all_inv(me)<1) { }

write(\你身上没有半文铜板,啥也买不了。\\n\return 1;

////////////////////////////////////////////////////////

if(p<1)

} else

17

value = file->query(\

if(!value)

value = value+1000; value = (value+1)*10; if( value

value = value*to_sell_rate;

if(wiz_level(me)>Wiz_L && me->query(\

value=1;

// Added by waiwai@2012/02/22

if(me->query(\ }

if(!me->is_busy()) me->start_busy(1); ob = new(file); if(!objectp(ob)) { }

return 1;

write(ERR_FILE_ZERO);

log_time(), environment(), base_name(this_object()), file)); if(balance

if(money_all_inv(me)<1) { }

if(money_all_inv(me)

write(sprintf(\说道:很抱歉,买%s需要花费%s,您身上仅有

boss_name, file->name(), money_num(value) )); write(\你身上没有半文钱,无法购买任何东西。\\n\return 1;

write(\购买\需要\,你相记钱庄存款仅有return 1;

\。\\n\

} else {

\。\\n\

return 1;

log_file(\→ %s\\n\

18

if(file->query_amount() && file->query_amount()>1) { }

if( --pawned_objects[items[i]] <= 0)

map_delete(pawned_objects, file);

message(\┋HOCKSHOP_QC┋Buy:ROOM(%s),%s\\n\\n\

base_name(this_object()), file), users()); write(\系统禁止性错误,\禁止购买。\\n\if(ob) destruct(ob); return 1;

save();

ob ->set(\

ob ->set(\

unit=ob->query(\if(!me->query(\

message_vision(sprintf(\从%s买下一%s%s,花费:%s。\\n\

query(\

else

write(sprintf(\你从%s买下一%s%s,花费:%s。\\n\

query(\

if(!ob->move(me,1)) { }

if(me->query(\

me->add(\me->save();

write(sprintf(\你相记钱庄存款减少了%s[%s → %s]。\\n\

money_num(value), money_num(balance),

write(boss_name+\说道:你拿不了\了,就给你先放这里地ob->move(this_object(),1);

上吧。\\n\

money_num((int)me->query(\

} else { }

log_file=LOG_DIR\if(file_size(log_file)==-1)

me->pay_money(value); me->save();

19

}

assure_file(log_file);

log_file( \

sprintf(\在%s买下%d%s%s[%s.c],花费:%s。\\n\

log_time(), log_id(me), filter_color(this_object()->query(\ob->query_amount()?ob->query_amount():1,

ob->query_amount()?ob->query(\filter_color(log_id(ob)), base_name(ob), money_num(value) ) );

return 1;

string money_num(int amount) { }

string Chinese_time(string get_time) {

return output; }

if (amount)

if (output != \

return output + amount + \文铜板\return amount + \文铜板\else

amount %= 100; if (amount / 10000) {

if (amount / 100) {

if (output != \

output += amount / 100 + \两白银\output = amount / 100 + \两白银\else

output = amount / 10000 + \两黄金\amount %= 10000; if (amount < 1)

return 0; string output;

} else output = \

20

string *month_name = ({\

return replace_string(sprintf(\month_name) + 1), day), \ + \}

string log_time() { }

int color_len(string str) {

int i; int extra;

extra = 0;

for (i = 0; i < strlen(str); i++) {

if (str[i] == ESC[0]) {

while((extra++, str[i] != 'm') && i < strlen(str)) i++; } }

return extra; }

string filter_color(string arg) {

arg = replace_string(arg, BLK, \arg = replace_string(arg, RED, \arg = replace_string(arg, GRN, \arg = replace_string(arg, YEL, \return msg;

msg = Chinese_time(msg); string msg = ctime(time());

sscanf(get_time,\

\string year, month, S; int day, I;

21

arg = replace_string(arg, BLU, \arg = replace_string(arg, MAG, \arg = replace_string(arg, CYN, \arg = replace_string(arg, WHT, \arg = replace_string(arg, HIR, \arg = replace_string(arg, HIG, \arg = replace_string(arg, HIY, \arg = replace_string(arg, HIB, \arg = replace_string(arg, HIM, \arg = replace_string(arg, HIC, \arg = replace_string(arg, HIW, \arg = replace_string(arg, NOR, \

// arg = replace_string(arg, HIK, \

arg = replace_string(arg, BOLD, \ arg = replace_string(arg, BLINK, \ arg = replace_string(arg, BBLK, \ arg = replace_string(arg, BRED, \ arg = replace_string(arg, BGRN, \ arg = replace_string(arg, BYEL, \ arg = replace_string(arg, BBLU, \ arg = replace_string(arg, BMAG, \ arg = replace_string(arg, BCYN, \ arg = replace_string(arg, HBRED, \ arg = replace_string(arg, HBGRN, \ arg = replace_string(arg, HBYEL, \ arg = replace_string(arg, HBBLU, \ arg = replace_string(arg, HBMAG, \ arg = replace_string(arg, HBCYN, \ arg = replace_string(arg, HBWHT, \ arg = replace_string(arg, U, \ arg = replace_string(arg, \

return arg; }

string log_id(object ob) {

if(userp(ob)) {

id=geteuid(ob); id=lower_case(id); id=ob->query(\string msg, id;

} else

22

}

msg = sprintf(\msg = sprintf(\return msg;

int money_all_inv(object me) { }

nomask int check_money(object ob, object me) {

int amount;

string desc, name, file;

if (objectp(gold) && gold->query(\ }

return amount;

if(!sscanf(file_name(gold),\

amount+=0;

amount+=gold->value(); else

if (objectp(silver) && silver->query(\ }

if(!sscanf(file_name(silver),\

amount+=0;

amount+=silver->value(); else

if (objectp(coin) && coin->query(\ }

if(!sscanf(file_name(coin),\

amount+=0;

amount+=coin->value(); else

coin=present(\silver=present(\gold=present(\int amount=0;

object coin, silver, gold;

23

if(!ob) return 1;

if(!me || !ob->is_money()) return 0; if(environment(me)->is_room())

name=environment(me)->query(\name=environment(me)->query(\else

if(ob->query(\ }

file=LOG_DIR\if(file_size(file)==-1)

assure_file(file);

|| ob->query(\|| ob->query(\if(ob->query(\

desc=money_num((ob->query_amount()*10000)); else

if(ob->query(\

desc=money_num((ob->query_amount()*100)); else

if(ob->query(\

desc=money_num((ob->query_amount()));

if(!sscanf(file_name(ob),\{ }

log_file(\%s(%s)在%s伪钞%s(%s.c)log_time(), me->name(1), geteuid(me),

me->query_temp(\离线时带有\企图使filter_color(desc), base_name(ob) ));

write(HIR\你身上的伪钞\被系统没收了。\\n\destruct(ob); return 0;

被没收。\\n\

用\

#ifdef WIZARD_FLAG

if( ob && ob->query_wiz_flag() && !wizardp(me) ) {

log_file(\%s(%s)在%s来自巫师的金

钱(%s),被系统没收。\\n\

24

}

}

log_time(), me->name(1), geteuid(me),

me->query_temp(\离线时带有\企图使filter_color(desc) ));

write(HIR\你身上存有来自巫师的非法金钱(\,被系统没收了。\\n\destruct(ob);

用\

#endif

else

return 1;

int do_look(string arg) {

msg=\

*************** * 购买(buy) 用list查看。 * 卖断(sell)

if(!arg || (arg!=\

return 0;

if(!this_object()->look_sign())

return 0; string msg;

object me=this_player();

*************** * 索要当票(givestamps) * * 当品(pawn/diandang) * * 赎回(retrieve/shuhui) * 查阅(stamps/chayue) * ***************\\n\ }

return 1; write(msg);

25

}

}

pawns = pawns[0..i - 1] + pawns[i + 1..i - 1]; set(\save(); continue;

tol+=1;

if(tol>=CAN_MAX_PAWNS) { }

write(\你最多仅能典当\件物品。\\n\return 1;

} else tol=0;

if( !me->can_afford(v)) { }

write(name+\唱道:押\sell_msg[random(sizeof(sell_msg))] + ob->query(\+

write(\你没有足够的钱支付,手续费需要\。\\n\return 1;

\一\。\\n\

write(sprintf(\你把身上的%s拿出来当掉了,支付手续费%s。\\n\

HOCKSHOP_NEW->money_num(v) ));

dbase = ob->query_entire_dbase(); pawn = allocate_mapping(11); pawn[\

pawn[\pawn[\pawn[\pawn[\

pawn[\pawn[\pawn[\pawn[\pawn[\if(efile==\

pawn[\长安城-董记当铺\else

if(efile==\

pawn[\开封城-徐记当铺\else

31

if(efile==\

pawn[\天竺国-乐记当铺\else

if(efile==\

pawn[\傲来国-吴家当铺\pawn[\else

if(tol<1) { }

if( !pointerp(pawns) || !sizeof(pawns) )

pawns = ({ pawn }); pawns += ({ pawn }); else

/* 所有MUD都该做此设置,可避免ID相同,却不是同一人 */ if(!query(\

set(\set(\if(!query(\

set(\save(); /*

在任何类似处,特别是没有前置判断的时候,都必须先做判断 否则会给变向消BUSY提供机会。而所有设置到物品易手特别是 金钱变动的时候,都必须至少BUSY为1。 */ }

int do_retrieve(string arg)

return 1; if(amount>1)

ob->add_amount(-1); destruct(ob); else

me->pay_money(v); me->save(); if(!me->is_busy())

me->start_busy(1);

32

{

me=this_player();

if(!query(\query(\

if (!arg)

////////////////////////////////////////////////////////

if( !sscanf(arg, \

return notify_fail(\你要取回第几号物品?\\n\name=boss->query(\

////////////////////////////////////////////////////////

boss=HOCKSHOP_NEW->have_hock_boss(env); if(!boss) return 1; // 禁止冒充BOSS

if(boss->query(\ }

write(query(\当前法定持牌人不在,无法进行交易。\\n\return 1;

pawns= query(\

if( !pointerp(pawns) || !sizeof(pawns) ) { }

write(\你目前没有任何当品放在当铺中!\\n\return 1;

return notify_fail(\你要取回第几样物品?请输入正确序号。\\n\if(me->is_busy()) return notify_fail(\你正忙着。\\n\ }

write(\这张当票不是你的。\\n\des_wait(); return 1;

if(!env->is_hockshop_room())

return notify_fail(\你只能在当铺取回当品。\\n\env=environment(me); mapping *pawns;

int num, amount, err_flag=0; object me, obj, env, boss; string name, file, errfile=\

33

if (file_size(file+\

write(sprintf(\你从%s将 \号当品%s取了回来。\\n\env->query(\arg, obj->name() ) );

return 1;

if(!me->is_busy()) me->start_busy(1); if(!obj->move(me,1)) { }

pawns= pawns[0..num-2] + pawns[num..sizeof(pawns)-1]; set(\save();

tell_object(me,\由于\太重了,你只好丢在地上。\\n\obj->move(env,1);

if( !undefinedp(pawns[num-1][\ }

string *key; int j;

key = keys(pawns[num-1][\j = sizeof(key);

while(j--) obj->set(key[j], pawns[num-1][\obj->delete(\obj=new(file+\ }

if(pawns[num-1][\ }

write(pawns[num-1][\是存放在return 1;

pawns= pawns[0..num-2] + pawns[num..sizeof(pawns)-1]; set(\save();

file=pawns[num-1][\

if( num < 1 || num > sizeof(pawns) )

return notify_fail(\物品序号不对。\\n\

return notify_fail(\没有这件物品!\\n\

\的,你无法在这里取回。\\n\

34

}

int do_stamps() {

if(getuid(me)!=query(\

return notify_fail(\这张当票不是你的。\\n\

// 容错

time=HOCKSHOP_NEW->Chinese_time(ctime(pawns[i][\

file=pawns[i][\

msg_to +=\┏━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━msg_to +=\┃序号┃ 物 件 名 称 [ID] ┃ 典 当 地 点 msg_to +=\┣━━╋━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━x=0; A=0;

for(i=count-1; i>=0; i--) { // 降序排列

reset_eval_cost();

┳━━━━━━━━┳━━┓\\n\┃ 到 期 时 间 ┃ QC ┃\\n\╋━━━━━━━━╋━━┫\\n\

msg_to += \◆ 取回当品请用:retrieve/shuhui <序号> ◆ 红色 \×× \说明文件异常。\\n\

count=sizeof(pawns) ; pawns= query(\

if( !pointerp(pawns) || !sizeof(pawns) ) { }

write( \目前没有任何典当过的物品。\\n\return 1; restore();

if(me->is_busy()) return notify_fail(\你正忙着。\\n\mapping *pawns;

int i, A, count, x, t=0, err_flag=0;

string desc=\object obj, me=this_player(); string time, hk_room, hk_file;

35

}

obj=new(file); if (!obj) { } //

if(pawns[i][\ }

if(pawns[i][\

hk_room=pawns[i][\

hk_room=pawns[i][\else

pawns = pawns[0..i - 1] + pawns[i + 1..i - 1]; set(\x+=1; continue; err_flag++;

errfile+=\→ \desc=HIY\××\continue;

msg_to+=sprintf(\┃\┃ %-\

if(obj) destruct(obj); A+=1;

i+1, pawns[i][\

HOCKSHOP_NEW->color_len(pawns[i][\┃s┃s┃%4s┃\\n\

msg_to += \┗━━┻━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━msg_to += sprintf(\你目前共有%d件当品:[必须在对应典当地点取回对应物品]\\n\A); if(err_flag>0) { }

me->start_more(msg_to);

if(!me->is_busy()) me->start_busy(1);

msg_to+=\有 \样物品存在系统路径异常。\\n\/* 避免不断的LOG */

if((time()-me->query_temp(\ }

log_file(\me->set_temp(\

┻━━━━━━━━┻━━┛\\n\

36

}

void restore_waste() {

set(\

NOR\这是一张你在\中各大当铺典当或赎回物品时必须使用的当票。\\n\NOR\─────────────────────────────────────\\n\NOR\物品id 将物品进行典当\\n\NOR\序号 把物品从当铺赎回\\n\NOR\查看典当过的物品\\n\

NOR\─────────────────────────────────────\\n\\每人总计可典当\件物品,物品限赎期为\,过期物品作废。\\n\ }

void check_pawns(object who) {

i = sizeof(pawns); f=0; if(i>0) {

if(id!=query(\pawns = query(\id=getuid(who);

if(!this_object() || !who) return; restore(); int i, f; mapping *pawns; string id; restore();

if((PAWNS_LOST_TIME/3600)>0)

time=(PAWNS_LOST_TIME/3600)+\小时\time=(PAWNS_LOST_TIME/60)+\分钟\else string time; return 1; if(x>0) save();

37

}

}

}

des_wait(); return;

/* 唯一性标志判断,不会随先后注册相同ID而继承 */ if(query(\ }

while (i--) { }

if(pawns[i][\ } f+=1;

pawns = pawns[0..i - 1] + pawns[i + 1..i - 1]; set(\continue; seteuid(ROOT_UID);

rm(DATA_DIR+\seteuid(getuid()); des_wait(); return;

/* 尽量不在循环里进行这个动作 */ if(f>0)

save();

void destroy_it(object me) { }

string Middle_name(string name, int raw) {

string str; int j, len; destruct(me);

if(environment()->is_character() && userp(this_player()))

write(sprintf(\掉在地上不见了。。。\\n\

environment()==this_player()?\你身上的\

/* 由于做了延迟,需要做判断,避免交叉des而zero */ if(!me) return;

38

str=name;

if(strlen(str) > raw)

str = str[0..raw]; if(strlen(str) < raw) { len = raw-strlen(str); if(len%2) { str += \ len--;

}

for(j=0;j

str = \ }

return str;

}

39

本文来源:https://www.bwwdw.com/article/ckj.html

Top