本文整理汇总了C++中pc_isGM函数的典型用法代码示例。如果您正苦于以下问题:C++ pc_isGM函数的具体用法?C++ pc_isGM怎么用?C++ pc_isGM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pc_isGM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例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
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}