竞拍与拍卖程序
2006/6/17 16:12:52
// cmds/std/auction.c 拍卖与竞价程序
// call_out() 映射控制版 for sz xo2(xkx)
// By Shure@mudbuilder.net 2001-8-17
/*
key string ob_id 物品ID
v[0] object obj 拍卖物品
v[1] int ob_price 竞标价格
v[2] object ob_auction 竞标者
v[3] object ob_onwer 物品所有者
v[4] string ob_desc 物品所有者对该物品的介绍
v[5] string auction_id 竞标者ID
v[6] string onwer_id 物主ID
v[7] string ob_name 物品名称
v[8] string ob_long 物品描述
mapping structure:
auction[obj : {ob, ob_price, ob_auction, ob_onwer, ob_desc, auction_id, ...} ]
*/
#include
inherit F_DBASE;
nosave mapping auction = ([]);
// 状态变化的控制中心
void auction_chat(string msg);
void auction_state_check(int times, int s_times, int last_price, string obj_id);
// 静止的状态切换
void auction_end(string ob_name, int ob_price, mixed ob_auction, object ob_onwer, object ob, string ob_id);
void auction_cancel(string ob_id, object discredit_1, object discredit_2);
// 实现拍卖
void get_ob_desc(string desc, object me, string str, int num);
void choise_secret(string decide, object me, string ob_id, string desc, int num);
// 数据反馈
int player_demand(int num, string unit, object me, string flag);
int player_bank(object ob);
int player_pay(object who, int amount);
int help();
int help_2();
// channeld.c需要增加auction频道
/*
"auction":([ "msg_speak": HIY "【拍卖场】%s: %s\n" NOR,
"msg_color": HIY,
]),
*/
int clean_up(){ return 1;}
void create()
{
seteuid(ROOT_UID);
set("name", "拍卖指令");
set("id", "auction");
set("channel_id","");
}
void auction_chat(string msg)
{
msg = replace_string(msg, NOR, HIY);
CHANNEL_D->do_channel(this_object(),"auction",msg);
}
void auction_state_check(int times, int s_times, int last_price, string obj_id)
{
int i, ob_price, flag1 = 0, flag2 = 0;
object ob, ob_auction, ob_onwer, new_auction, new_onwer, nul;
mixed *values, *v;
string *k, ob_name, ob_id, str;
// 重新定位此物品,避免因为其他物品被清除导致索引号变化
k = keys(auction);
i = member_array(obj_id,k);
v = values(auction)[i];
ob_id = k[i];
ob = v[0];
ob_price = v[1];
ob_auction = v[2];
ob_onwer = v[3];
ob_name = v[7];
if(!objectp(ob_auction) && !stringp(ob_auction))
{
flag1++;
if(objectp(new_auction = find_player(v[5])))
{
ob_auction = new_auction;
flag1 = 0;
}
}
if(!objectp(ob_onwer))
{
flag2++;
if(objectp(new_onwer = find_player(v[6])))
{
ob_onwer = new_onwer;
flag2 = 0;
}
}
if(flag2 && !flag1)
{
str="由于卖方缺席,取消"+ob_name+"的拍卖";
auction_chat(str);
auction_cancel(ob_id, ob_auction, nul);
return;
}
if(!objectp(ob) || !objectp(present(ob,ob_onwer)))
{
str="由于卖方保管不当,拍卖物品"+ob_name+"丢失,本次拍卖取消!\n";
auction_chat(str);
ob_onwer->delete_temp("auctioning");
auction_cancel(ob_id, ob_auction, nul);
return;
}
if(times < 30)
{
times++;
if(ob_price > last_price)
{
s_times = 0;
call_out("auction_state_check", 20, times, s_times, ob_price, ob_id);
}
else
{
s_times++;
if(s_times<4)
{
str = HIR"第"+CHINESE_D
下一页
返回列表
返回首页
©2025 MUD游戏网_文字mud 电脑版
Powered by iwms