UID7297
阅读权限120
威望 点
积分2017
注册时间2010-11-7
最后登录1970-1-1
听众
收听
升级
100%
|
此系统目的在于,除了普通的现金商店以外,可以自定义其他变量的商店系统,比如说在线积分等等,方便编写积分购物等脚本
第一步:原:
- struct {
- struct npc_item_list* shop_item;
- int count;
- } shop;
-
复制代码 改:
- struct {
- struct npc_item_list* shop_item;
- int count;
- char *cash_var, *point_var; //变量名称
- short cash_vartype, point_vartype; //1 = 全局帐号变量, 2 = 帐号变量, 3 = 人物变量
- int itemid;
- } shop;
-
复制代码 第二步:
- npc.c
- npc_cashshop_buylist
-
复制代码 原:
- // Payment Process ----------------------------------------------------
- if( sd->kafraPoints < points || sd->cashPoints < (vt - points) )
- return 6;
- pc_paycash(sd,vt,points);
复制代码 改:
- // Payment Process
- if( (pc_readregistry(sd,nd->u.shop.point_var,nd->u.shop.point_vartype) < points) || (pc_readregistry(sd,nd->u.shop.cash_var,nd->u.shop.cash_vartype) < vt - points) )
- return 6;
- if (!strcasecmp(nd->u.shop.cash_var,"#CASHPOINTS") && !strcasecmp(nd->u.shop.point_var,"#KAFRAPOINTS"))
- pc_paycash(sd, vt, points);
- else{
- pc_setregistry(sd,nd->u.shop.cash_var,pc_readregistry(sd,nd->u.shop.cash_var,nd->u.shop.cash_vartype) - (vt - points),nd->u.shop.cash_vartype);
- pc_setregistry(sd,nd->u.shop.point_var,pc_readregistry(sd,nd->u.shop.point_var,nd->u.shop.point_vartype) - points,nd->u.shop.point_vartype);
- }
-
复制代码 第三步:原:
- if( (sd->kafraPoints < points) || (sd->cashPoints < price - points) )
- return 6;
-
- pc_paycash(sd, price, points);
复制代码 改:
- if( (pc_readregistry(sd,nd->u.shop.point_var,nd->u.shop.point_vartype) < points) || (pc_readregistry(sd,nd->u.shop.cash_var,nd->u.shop.cash_vartype) < price - points) )
- return 6;
- if (!strcasecmp(nd->u.shop.cash_var,"#CASHPOINTS") && !strcasecmp(nd->u.shop.point_var,"#KAFRAPOINTS"))
- pc_paycash(sd, price, points);
- else{
- pc_setregistry(sd,nd->u.shop.cash_var,pc_readregistry(sd,nd->u.shop.cash_var,nd->u.shop.cash_vartype) - (price - points),nd->u.shop.cash_vartype);
- pc_setregistry(sd,nd->u.shop.point_var,pc_readregistry(sd,nd->u.shop.point_var,nd->u.shop.point_vartype) - points,nd->u.shop.point_vartype);
- }
复制代码 第四步:- npc.c
- int npc_unload(struct npc_data* nd, bool single) {
复制代码 原:- if( (nd->subtype == SHOP || nd->subtype == CASHSHOP) && nd->src_id == 0) //src check for duplicate shops [Orcao]
- aFree(nd->u.shop.shop_item);
-
复制代码 改:- if( (nd->subtype == SHOP || nd->subtype == CASHSHOP) && nd->src_id == 0){ //src check for duplicate shops [Orcao]
- aFree(nd->u.shop.shop_item);
- aFree(nd->u.shop.cash_var);
- aFree(nd->u.shop.point_var);
- }
复制代码 |
温馨提示:
1. 本站模拟器源于网络,经 99Max.mE 二次开发,仅供个人学习娱乐使用,切勿用于商业用途,否则后果自负!
2. 如需更好体验游戏内容,请前往官方游戏!不具备合法的运营模式,都是强盗,请勿擅自搭建私服!
3. 如本站内容有侵犯您的权益,请发送信息至QQ:372607220 或 EMAIL:372607220@qq.com ,我们会及时删除。
|