本文整理汇总了C++中pc_isGM函数的典型用法代码示例。如果您正苦于以下问题:C++ pc_isGM函数的具体用法?C++ pc_isGM怎么用?C++ pc_isGM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pc_isGM函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: mail_invalid_operation
// This function only check if the mail operations are valid
bool mail_invalid_operation(struct map_session_data *sd)
{
if( !map[sd->bl.m].flag.town && pc_isGM(sd) < get_atcommand_level(atcommand_mail) )
{
ShowWarning("clif_parse_Mail: char '%s' trying to do invalid mail operations.\n", sd->status.name);
return true;
}
return false;
}
开发者ID:Aeromesi,项目名称:PkRO_Translation,代码行数:11,代码来源:mail.c
示例2: vending_vendinglistreq
/*==========================================
* Request a shop's item list
*------------------------------------------*/
void vending_vendinglistreq(struct map_session_data* sd, int id)
{
struct map_session_data* vsd;
nullpo_retv(sd);
if( (vsd = map_id2sd(id)) == NULL )
return;
if( !vsd->state.vending )
return; // not vending
if ( !pc_can_give_items(pc_isGM(sd)) || !pc_can_give_items(pc_isGM(vsd)) ) //check if both GMs are allowed to trade
{ // GM is not allowed to trade
clif_displaymessage(sd->fd, msg_txt(246));
return;
}
sd->vended_id = vsd->vender_id; // register vending uid
clif_vendinglist(sd, id, vsd->vending);
}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:23,代码来源:vending.c
示例3: trade_traderequest
/*==========================================
* 取引要請を相手に送る
*------------------------------------------
*/
void trade_traderequest(struct map_session_data *sd, int target_id) {
struct map_session_data *target_sd;
int level;
nullpo_retv(sd);
if (map[sd->bl.m].flag.notrade) {
clif_displaymessage (sd->fd, msg_txt(272));
return; //Can't trade in notrade mapflag maps.
}
if ((target_sd = map_id2sd(target_id)) != NULL) {
if (!battle_config.invite_request_check) {
if (target_sd->guild_invite > 0 || target_sd->party_invite > 0) {
clif_tradestart(sd, 2); // 相手はPT要請中かGuild要請中
return;
}
}
level = pc_isGM(sd);
if ( pc_can_give_items(level) || pc_can_give_items(pc_isGM(target_sd)) ) //check if both GMs are allowed to trade
{
clif_displaymessage(sd->fd, msg_txt(246));
trade_tradecancel(sd); // GM is not allowed to trade
} else if ((target_sd->trade_partner != 0) || (sd->trade_partner != 0)) {
trade_tradecancel(sd); // person is in another trade
} else {
//Fixed. Only real GMs can request trade from far away! [Lupus]
if (level < lowest_gm_level && (sd->bl.m != target_sd->bl.m ||
(sd->bl.x - target_sd->bl.x <= -5 || sd->bl.x - target_sd->bl.x >= 5) ||
(sd->bl.y - target_sd->bl.y <= -5 || sd->bl.y - target_sd->bl.y >= 5))) {
clif_tradestart(sd, 0); // too far
} else if (sd != target_sd) {
target_sd->trade_partner = sd->status.account_id;
sd->trade_partner = target_sd->status.account_id;
clif_traderequest(target_sd, sd->status.name);
}
}
} else {
clif_tradestart(sd, 1); // character does not exist
}
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:45,代码来源:trade.c
示例4: storage_additem
/*==========================================
* Internal add-item function.
*------------------------------------------*/
static int storage_additem(struct map_session_data* sd, struct item* item_data, int amount, int flag)
{
struct storage_data* stor = &sd->status.storage;
struct item_data *data;
int i;
if( item_data->nameid <= 0 || amount <= 0 )
return 1;
data = itemdb_search(item_data->nameid);
if( !itemdb_canstore(item_data, pc_isGM(sd)) )
{ //Check if item is storable. [Skotlex]
clif_displaymessage (sd->fd, msg_txt(264));
return 1;
}
if( itemdb_isstackable2(data) )
{//Stackable
for( i = 0; i < MAX_STORAGE; i++ )
{
if( compare_item(&stor->items[i], item_data) )
{// existing items found, stack them
if( amount > MAX_AMOUNT - stor->items[i].amount )
return 1;
stor->items[i].amount += amount;
if( flag ) clif_storageitemadded(sd,&stor->items[i],i,amount);
if(log_config.enable_logs&0x800)
log_pick_pc(sd, "R", item_data->nameid, -amount, item_data, 0);
return 0;
}
}
}
// find free slot
ARR_FIND( 0, MAX_STORAGE, i, stor->items[i].nameid == 0 );
if( i >= MAX_STORAGE )
return 1;
// add item to slot
memcpy(&stor->items[i],item_data,sizeof(stor->items[0]));
stor->storage_amount++;
stor->items[i].amount = amount;
if( flag )
{
clif_storageitemadded(sd,&stor->items[i],i,amount);
clif_updatestorageamount(sd,stor->storage_amount);
}
if(log_config.enable_logs&0x800)
log_pick_pc(sd, "R", item_data->nameid, -amount, item_data, item_data->serial );
return 0;
}
开发者ID:ranfs,项目名称:fa6d4ae1781f9a68f1a4d5,代码行数:56,代码来源:storage.c
示例5: guild_storage_additem
int guild_storage_additem(struct map_session_data* sd, struct guild_storage* stor, struct item* item_data, int amount)
{
struct item_data *data;
int i;
nullpo_retr(1, sd);
nullpo_retr(1, stor);
nullpo_retr(1, item_data);
if(item_data->nameid <= 0 || amount <= 0)
return 1;
data = itemdb_search(item_data->nameid);
if( !itemdb_canguildstore(item_data, pc_isGM(sd)) || item_data->expire_time || item_data->bound )
{ //Check if item is storable. [Skotlex]
clif_displaymessage (sd->fd, msg_txt(264));
return 1;
}
if( sd->state.secure_items )
{
clif_displaymessage(sd->fd, "You can't store items on Guild Storage. Blocked with @security");
return 1;
}
if(itemdb_isstackable2(data)){ //Stackable
for(i=0;i<MAX_GUILD_STORAGE;i++){
if(compare_item(&stor->items[i], item_data)) {
if(stor->items[i].amount+amount > MAX_AMOUNT)
return 1;
stor->items[i].amount+=amount;
clif_storageitemadded(sd,&stor->items[i],i,amount);
stor->dirty = 1;
return 0;
}
}
}
//Add item
for(i=0;i<MAX_GUILD_STORAGE && stor->items[i].nameid;i++);
if(i>=MAX_GUILD_STORAGE)
return 1;
memcpy(&stor->items[i],item_data,sizeof(stor->items[0]));
stor->items[i].amount=amount;
stor->storage_amount++;
clif_storageitemadded(sd,&stor->items[i],i,amount);
clif_updatestorageamount(sd, stor->storage_amount, MAX_GUILD_STORAGE);
stor->dirty = 1;
return 0;
}
开发者ID:philg666,项目名称:Latest_eAmod,代码行数:52,代码来源:storage.c
示例6: guild_storage_additem
int guild_storage_additem(struct map_session_data* sd, struct guild_storage* stor, struct item* item_data, int amount)
{
struct item_data *data;
int i;
nullpo_retr(1, sd);
nullpo_retr(1, stor);
nullpo_retr(1, item_data);
if(item_data->nameid <= 0 || amount <= 0)
return 1;
data = itemdb_search(item_data->nameid);
if( !itemdb_canguildstore(item_data, pc_isGM(sd)) || item_data->expire_time )
{ //Check if item is storable. [Skotlex]
clif_displaymessage (sd->fd, msg_txt(264));
return 1;
}
if(itemdb_isstackable2(data)){ //Stackable
for(i=0;i<MAX_GUILD_STORAGE;i++){
if(compare_item(&stor->items[i], item_data)) {
if(stor->items[i].amount+amount > MAX_AMOUNT)
return 1;
stor->items[i].amount+=amount;
clif_storageitemadded(sd,&stor->items[i],i,amount);
stor->dirty = 1;
if(log_config.enable_logs&0x1000)
log_pick_pc(sd, "G", item_data->nameid, -amount, item_data);
return 0;
}
}
}
//Add item
for(i=0;i<MAX_GUILD_STORAGE && stor->items[i].nameid;i++);
if(i>=MAX_GUILD_STORAGE)
return 1;
memcpy(&stor->items[i],item_data,sizeof(stor->items[0]));
stor->items[i].amount=amount;
stor->storage_amount++;
clif_storageitemadded(sd,&stor->items[i],i,amount);
clif_updateguildstorageamount(sd,stor->storage_amount);
stor->dirty = 1;
if(log_config.enable_logs&0x1000)
log_pick_pc(sd, "G", item_data->nameid, -amount, item_data);
return 0;
}
开发者ID:Cavalero,项目名称:3ceam,代码行数:50,代码来源:storage.c
示例7: storage_additem
/*==========================================
* Internal add-item function.
*------------------------------------------
*/
static int storage_additem(struct map_session_data *sd,struct storage *stor,struct item *item_data,int amount)
{
struct item_data *data;
int i;
if (sd->state.finalsave)
return 1;
if(item_data->nameid <= 0 || amount <= 0)
return 1;
data = itemdb_search(item_data->nameid);
if (!itemdb_canstore(item_data, pc_isGM(sd)))
{ //Check if item is storable. [Skotlex]
clif_displaymessage (sd->fd, msg_txt(264));
return 1;
}
if(itemdb_isstackable2(data)){ //Stackable
for(i=0;i<MAX_STORAGE;i++){
if( compare_item (&stor->storage_[i], item_data)) {
if(amount > MAX_AMOUNT - stor->storage_[i].amount)
return 1;
stor->storage_[i].amount+=amount;
clif_storageitemadded(sd,stor,i,amount);
stor->dirty = 1;
if(log_config.enable_logs&0x800)
log_pick_pc(sd, "R", item_data->nameid, -amount, item_data);
return 0;
}
}
}
//Add item
for(i=0;i<MAX_STORAGE && stor->storage_[i].nameid;i++);
if(i>=MAX_STORAGE)
return 1;
memcpy(&stor->storage_[i],item_data,sizeof(stor->storage_[0]));
stor->storage_[i].amount=amount;
stor->storage_amount++;
clif_storageitemadded(sd,stor,i,amount);
clif_updatestorageamount(sd,stor);
stor->dirty = 1;
if(log_config.enable_logs&0x800)
log_pick_pc(sd, "R", item_data->nameid, -amount, item_data);
return 0;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:53,代码来源:storage.c
示例8: mail_setitem
unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount)
{
if( sd->state.secure_items )
{
clif_displaymessage(sd->fd, "You can't attach. Blocked with @security");
return 1;
}
if( battle_config.super_woe_enable )
{
clif_displaymessage(sd->fd, "Super WoE don't allow send items/zeny with attachments");
return 1;
}
if( idx == 0 )
{ // Zeny Transfer
if( amount < 0 || !pc_can_give_items(pc_isGM(sd)) )
return 1;
if( amount > sd->status.zeny )
amount = sd->status.zeny;
sd->mail.zeny = amount;
// pc_onstatuschanged(sd, SP_ZENY);
return 0;
}
else
{ // Item Transfer
idx -= 2;
mail_removeitem(sd, 0);
if( idx < 0 || idx >= MAX_INVENTORY )
return 1;
if( amount < 0 || amount > sd->status.inventory[idx].amount )
return 1;
if( !pc_candrop(sd, &sd->status.inventory[idx]) )
return 1;
sd->mail.index = idx;
sd->mail.nameid = sd->status.inventory[idx].nameid;
sd->mail.amount = amount;
return 0;
}
}
开发者ID:Chocolate31,项目名称:eamod,代码行数:45,代码来源:mail.c
示例9: storage_storageopen
/*==========================================
* Opens a storage. Returns:
* 0 - success
* 1 - fail
*------------------------------------------*/
int storage_storageopen(struct map_session_data *sd)
{
nullpo_retr(0, sd);
if(sd->state.storage_flag)
return 1; //Already open?
if( !pc_can_give_items(pc_isGM(sd)) )
{ //check is this GM level is allowed to put items to storage
clif_displaymessage(sd->fd, msg_txt(246));
return 1;
}
sd->state.storage_flag = 1;
clif_storagelist(sd,&sd->status.storage);
clif_updatestorageamount(sd,sd->status.storage.storage_amount);
return 0;
}
开发者ID:anacondaqq,项目名称:Beginner-eAthena,代码行数:23,代码来源:storage.c
示例10: ext_storage_open
int ext_storage_open(struct map_session_data *sd)
{
nullpo_ret(sd);
if(sd->state.storage_flag)
return 1;
if( !pc_can_give_items(pc_isGM(sd)) )
{ //check is this GM level is allowed to put items to storage
clif_displaymessage(sd->fd, msg_txt(246));
return 1;
}
sd->state.storage_flag = 3;
storage_sortitem(sd->status.ext_storage.items, ARRAYLENGTH(sd->status.ext_storage.items));
clif_storagelist(sd, sd->status.ext_storage.items, ARRAYLENGTH(sd->status.ext_storage.items));
clif_updateextrastorageamount(sd,sd->status.ext_storage.storage_amount);
return 0;
}
开发者ID:ranfs,项目名称:fa6d4ae1781f9a68f1a4d5,代码行数:19,代码来源:storage.c
示例11: mapif_parse_WisToGM
// Received wisp message from map-server via char-server for ALL gm
static
void mapif_parse_WisToGM(Session *, const Packet_Head<0x3803>& head, AString& message)
{
// 0x3003/0x3803 <packet_len>.w <wispname>.24B <min_gm_level>.w <message>.?B
GmLevel min_gm_level = head.min_gm_level;
CharName Wisp_name = head.char_name;
// information is sended to all online GM
for (io::FD i : iter_fds())
{
Session *s2 = get_session(i);
if (!s2)
continue;
dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get()));
if (pl_sd && pl_sd->state.auth && !pl_sd->state.connect_new)
{
if (pc_isGM(pl_sd).satisfies(min_gm_level))
clif_wis_message(s2, Wisp_name, message);
}
}
}
开发者ID:themanaworld,项目名称:tmwa,代码行数:21,代码来源:intif.cpp
示例12: chat_kickchat
/*==========================================
* kick an user from a chatroom
*------------------------------------------*/
int chat_kickchat(struct map_session_data* sd, const char* kickusername)
{
struct chat_data* cd;
int i;
nullpo_retr(1, sd);
cd = (struct chat_data *)map_id2bl(sd->chatID);
if( cd==NULL || (struct block_list *)sd != cd->owner )
return -1;
ARR_FIND( 0, cd->users, i, strncmp(cd->usersd[i]->status.name, kickusername, NAME_LENGTH) == 0 );
if( i == cd->users )
return -1;
if( battle_config.gm_kick_chat && pc_isGM(cd->usersd[i]) >= battle_config.gm_kick_chat )
return 0; //gm kick protection [Valaris]
chat_leavechat(cd->usersd[i],1);
return 0;
}
开发者ID:Nihadm89,项目名称:server,代码行数:25,代码来源:chat.c
示例13: chat_kickchat
/*==========================================
* チャットルームから蹴り出す
*------------------------------------------
*/
int chat_kickchat(struct map_session_data *sd,char *kickusername)
{
struct chat_data *cd;
int i;
nullpo_retr(1, sd);
cd = (struct chat_data *)map_id2bl(sd->chatID);
for(i = 0; i < cd->users; i++) {
if (strcmp(cd->usersd[i]->status.name, kickusername) == 0) {
if (battle_config.gm_kick_chat && pc_isGM(cd->usersd[i]) >= battle_config.gm_kick_chat)
//gm kick protection by valaris
return 0;
chat_leavechat(cd->usersd[i]);
return 0;
}
}
return -1;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:26,代码来源:chat.c
示例14: chat_joinchat
/*==========================================
* 既存チャットルームに参加
*------------------------------------------
*/
int chat_joinchat (struct map_session_data *sd, int chatid, char* pass)
{
struct chat_data *cd;
nullpo_retr(0, sd);
cd = (struct chat_data*)map_id2bl(chatid);
//No need for a nullpo check. The chatid was sent by the client, if they lag or mess with the packet
//a wrong chat id can be received. [Skotlex]
if (cd == NULL)
return 1;
if (cd->bl.m != sd->bl.m || sd->vender_id || sd->chatID || cd->limit <= cd->users) {
clif_joinchatfail(sd,0);
return 0;
}
//Allows Gm access to protected room with any password they want by valaris
if ((cd->pub == 0 && strncmp(pass, (char *)cd->pass, 8) && (pc_isGM(sd) < battle_config.gm_join_chat || !battle_config.gm_join_chat)) ||
chatid == (int)sd->chatID) //Double Chat fix by Alex14, thx CHaNGeTe
{
clif_joinchatfail(sd,1);
return 0;
}
pc_stop_walking(sd,1);
cd->usersd[cd->users] = sd;
cd->users++;
pc_setchatid(sd,cd->bl.id);
clif_joinchatok(sd,cd); // 新たに参加した人には全員のリスト
clif_addchat(cd,sd); // 既に中に居た人には追加した人の報告
clif_dispchat(cd,0); // 周囲の人には人数変化報告
chat_triggerevent(cd); // イベント
return 0;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:41,代码来源:chat.c
示例15: storage_guild_storageopen
int storage_guild_storageopen(struct map_session_data* sd)
{
struct guild_storage *gstor;
nullpo_ret(sd);
if(sd->status.guild_id <= 0)
return 2;
if(sd->state.storage_flag)
return 1; //Can't open both storages at a time.
if( !pc_can_give_items(pc_isGM(sd)) ) { //check is this GM level can open guild storage and store items [Lupus]
clif_displaymessage(sd->fd, msg_txt(246));
return 1;
}
if( map[sd->bl.m].flag.noguildstorage )
{
clif_displaymessage(sd->fd, msg_txt(912));
return 1;
}
if((gstor = guild2storage2(sd->status.guild_id)) == NULL) {
intif_request_guild_storage(sd->status.account_id,sd->status.guild_id);
return 0;
}
if(gstor->storage_status)
return 1;
gstor->storage_status = 1;
sd->state.storage_flag = 2;
storage_sortitem(gstor->items, ARRAYLENGTH(gstor->items));
clif_storagelist(sd, gstor->items, ARRAYLENGTH(gstor->items));
clif_updatestorageamount(sd, gstor->storage_amount, MAX_GUILD_STORAGE);
return 0;
}
开发者ID:philg666,项目名称:Latest_eAmod,代码行数:37,代码来源:storage.c
示例16: mail_setitem
unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount)
{
if( idx == 0 )
{ // Zeny Transfer
if( amount < 0 || !pc_can_give_items(pc_isGM(sd)) )
return 1;
if( amount > sd->status.zeny )
amount = sd->status.zeny;
sd->mail.zeny = amount;
// clif_updatestatus(sd, SP_ZENY);
return 0;
}
else
{ // Item Transfer
idx -= 2;
if(sd->status.inventory[idx+2].nameid == 690)
return 0;
mail_removeitem(sd, 0);
if( idx < 0 || idx >= MAX_INVENTORY )
return 1;
if( amount < 0 || amount > sd->status.inventory[idx].amount )
return 1;
if( !pc_candrop(sd, &sd->status.inventory[idx]) )
return 1;
sd->mail.index = idx;
sd->mail.nameid = sd->status.inventory[idx].nameid;
sd->mail.amount = amount;
return 0;
}
}
开发者ID:Aeromesi,项目名称:PkRO_Translation,代码行数:36,代码来源:mail.c
示例17: storage_storageopen
/*==========================================
* Opens a storage. Returns:
* 0 - success
* 1 - fail
*------------------------------------------*/
int storage_storageopen(struct map_session_data *sd)
{
nullpo_ret(sd);
if(sd->state.storage_flag)
return 1; //Already open?
if( !pc_can_give_items(pc_isGM(sd)) )
{ //check is this GM level is allowed to put items to storage
clif_displaymessage(sd->fd, msg_txt(246));
return 1;
}
if( map[sd->bl.m].flag.nostorage )
{
clif_displaymessage(sd->fd, msg_txt(911));
return 1;
}
sd->state.storage_flag = 1;
storage_sortitem(sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items));
clif_storagelist(sd, sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items));
clif_updatestorageamount(sd, sd->status.storage.storage_amount, MAX_STORAGE);
return 0;
}
开发者ID:philg666,项目名称:Latest_eAmod,代码行数:29,代码来源:storage.c
示例18: trade_tradeack
/*==========================================
* Reply to a trade-request.
* Type values:
* 0: Char is too far
* 1: Character does not exist
* 2: Trade failed
* 3: Accept
* 4: Cancel
* Weird enough, the client should only send 3/4
* and the server is the one that can reply 0~2
*------------------------------------------*/
void trade_tradeack(struct map_session_data *sd, int type)
{
struct map_session_data *tsd;
nullpo_retv(sd);
if (sd->state.trading || !sd->trade_partner)
return; //Already trading or no partner set.
if ((tsd = map_id2sd(sd->trade_partner)) == NULL) {
clif_tradestart(sd, 1); // character does not exist
sd->trade_partner=0;
return;
}
if (tsd->state.trading || tsd->trade_partner != sd->bl.id)
{
clif_tradestart(sd, 2);
return; //Already trading or wrong partner.
}
if (type == 4) { // Cancel
clif_tradestart(tsd, type);
clif_tradestart(sd, type);
sd->state.deal_locked = 0;
sd->trade_partner = 0;
tsd->state.deal_locked = 0;
tsd->trade_partner = 0;
return;
}
if (type != 3)
return; //If client didn't send accept, it's a broken packet?
//Copied here as well since the original character could had warped.
if (pc_isGM(tsd) < battle_config.lowest_gm_level && (sd->bl.m != tsd->bl.m ||
!check_distance_bl(&sd->bl, &tsd->bl, TRADE_DISTANCE)
)) {
clif_tradestart(sd, 0); // too far
sd->trade_partner=0;
tsd->trade_partner = 0;
return;
}
//Check if you can start trade.
if (sd->npc_id || sd->vender_id || sd->state.storage_flag ||
tsd->npc_id || tsd->vender_id || tsd->state.storage_flag)
{ //Fail
clif_tradestart(sd, 2);
clif_tradestart(tsd, 2);
sd->state.deal_locked = 0;
sd->trade_partner = 0;
tsd->state.deal_locked = 0;
tsd->trade_partner = 0;
return;
}
//Initiate trade
sd->state.trading = 1;
tsd->state.trading = 1;
memset(&sd->deal, 0, sizeof(sd->deal));
memset(&tsd->deal, 0, sizeof(tsd->deal));
clif_tradestart(tsd, type);
clif_tradestart(sd, type);
}
开发者ID:KimKyung-wook,项目名称:ilathena-project,代码行数:75,代码来源:trade.c
示例19: chat_joinchat
/*==========================================
* join an existing chatroom
*------------------------------------------*/
int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass)
{
struct chat_data* cd;
nullpo_ret(sd);
cd = (struct chat_data*)map_id2bl(chatid);
if( cd == NULL || cd->bl.type != BL_CHAT || cd->bl.m != sd->bl.m || sd->state.vending || sd->state.buyingstore || sd->chatID || cd->users >= cd->limit )
{
clif_joinchatfail(sd,0);
return 0;
}
if( !cd->pub && strncmp(pass, cd->pass, sizeof(cd->pass)) != 0 && !(battle_config.gm_join_chat && pc_isGM(sd) >= battle_config.gm_join_chat) )
{
clif_joinchatfail(sd,1);
return 0;
}
if( cd->upperBool && pc_jobid2mapid(sd->status.class_)&JOBL_UPPER )
{
clif_joinchatfail(sd,7);
return 0;
}
if( sd->status.base_level < cd->minLvl || sd->status.base_level > cd->maxLvl )
{
if(sd->status.base_level < cd->minLvl)
clif_joinchatfail(sd,5);
else
clif_joinchatfail(sd,6);
return 0;
}
if( sd->status.zeny < cd->zeny )
{
clif_joinchatfail(sd,4);
return 0;
}
pc_stop_walking(sd,1);
cd->usersd[cd->users] = sd;
cd->users++;
pc_setchatid(sd,cd->bl.id);
clif_joinchatok(sd,cd); // 新たに参加した人には全員のリスト
clif_addchat(cd,sd); // 既に中に居た人には追加した人の報告
clif_dispchat(cd,0); // 周囲の人には人数変化報告
chat_triggerevent(cd); // イベント
return 0;
}
开发者ID:Nihadm89,项目名称:server,代码行数:58,代码来源:chat.c
示例20: buyingstore_create
void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned char result, const char* storename, const uint8* itemlist, unsigned int count)
{
unsigned int i, weight, listidx;
struct item_data* id;
if( !result || count == 0 )
{// canceled, or no items
return;
}
if( !battle_config.feature_buying_store || pc_istrading(sd) || sd->buyingstore.slots == 0 || count > sd->buyingstore.slots || zenylimit <= 0 || zenylimit > sd->status.zeny || !storename[0] )
{// disabled or invalid input
sd->buyingstore.slots = 0;
clif_buyingstore_open_failed(sd, BUYINGSTORE_CREATE, 0);
return;
}
if( !pc_can_give_items(pc_isGM(sd)) )
{// custom: GM is not allowed to buy (give zeny)
sd->buyingstore.slots = 0;
clif_displaymessage(sd->fd, msg_txt(246));
clif_buyingstore_open_failed(sd, BUYINGSTORE_CREATE, 0);
return;
}
if( sd->sc.data[SC_NOCHAT] && (sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM) )
{// custom: mute limitation
return;
}
if( map[sd->bl.m].flag.novending || map_getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) )
{// custom: no vending maps/cells
clif_displaymessage(sd->fd, msg_txt(276)); // "You can't open a shop on this map"
return;
}
weight = sd->weight;
// check item list
for( i = 0; i < count; i++ )
{// itemlist: <name id>.W <amount>.W <price>.L
unsigned short nameid, amount;
int price, idx;
nameid = RBUFW(itemlist,i*8+0);
amount = RBUFW(itemlist,i*8+2);
price = RBUFL(itemlist,i*8+4);
if( ( id = itemdb_exists(nameid) ) == NULL || amount == 0 )
{// invalid input
break;
}
if( price <= 0 || price > BUYINGSTORE_MAX_PRICE )
{// invalid price: unlike vending, items cannot be bought at 0 Zeny
break;
}
if( !id->flag.buyingstore || !itemdb_cantrade_sub(id, pc_isGM(sd), pc_isGM(sd)) || ( idx = pc_search_inventory(sd, nameid) ) == -1 )
{// restrictions: allowed, no character-bound items and at least one must be owned
break;
}
if( sd->status.inventory[idx].amount+amount > BUYINGSTORE_MAX_AMOUNT )
{// too many items of same kind
break;
}
if( i )
{// duplicate check. as the client does this too, only malicious intent should be caught here
ARR_FIND( 0, i, listidx, sd->buyingstore.items[listidx].nameid == nameid );
if( listidx != i )
{// duplicate
ShowWarning("buyingstore_create: Found duplicate item on buying list (nameid=%hu, amount=%hu, account_id=%d, char_id=%d).\n", nameid, amount, sd->status.account_id, sd->status.char_id);
break;
}
}
weight+= id->weight*amount;
sd->buyingstore.items[i].nameid = nameid;
sd->buyingstore.items[i].amount = amount;
sd->buyingstore.items[i].price = price;
}
if( i != count )
{// invalid item/amount/price
sd->buyingstore.slots = 0;
clif_buyingstore_open_failed(sd, BUYINGSTORE_CREATE, 0);
return;
}
if( (sd->max_weight*90)/100 < weight )
{// not able to carry all wanted items without getting overweight (90%)
sd->buyingstore.slots = 0;
clif_buyingstore_open_failed(sd, BUYINGSTORE_CREATE_OVERWEIGHT, weight);
return;
}
// success
sd->state.buyingstore = true;
//.........这里部分代码省略.........
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:101,代码来源:buyingstore.c
注:本文中的pc_isGM函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论