summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-09-16 08:12:48 -0300
committershennetsind <ind@henn.et>2013-09-16 08:12:48 -0300
commit5d33b1cc58d3c831f5fb9f7f368aa996d4be82c7 (patch)
treeda13821a29480d88dcd872c682b26b75e5191482 /src/map
parent4eb223b62e70a293dd2c95f1ce8b29a3f0c83ef7 (diff)
parentfe2f840e5d6cb4230ba02c47132790d067b3814d (diff)
downloadhercules-5d33b1cc58d3c831f5fb9f7f368aa996d4be82c7.tar.gz
hercules-5d33b1cc58d3c831f5fb9f7f368aa996d4be82c7.tar.bz2
hercules-5d33b1cc58d3c831f5fb9f7f368aa996d4be82c7.tar.xz
hercules-5d33b1cc58d3c831f5fb9f7f368aa996d4be82c7.zip
Merge branch 'master' of https://github.com/HerculesWS/Hercules
Solved minor conflicts that were caused by the unit interface Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/chat.c894
-rw-r--r--src/map/chat.h112
-rw-r--r--src/map/duel.c408
-rw-r--r--src/map/intif.h256
4 files changed, 835 insertions, 835 deletions
diff --git a/src/map/chat.c b/src/map/chat.c
index 75ae3681b..3a76dd157 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -1,447 +1,447 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
-
-#include "../common/cbasetypes.h"
-#include "../common/malloc.h"
-#include "../common/nullpo.h"
-#include "../common/showmsg.h"
-#include "../common/strlib.h"
-#include "../common/mmo.h"
-#include "atcommand.h" // msg_txt()
-#include "battle.h" // struct battle_config
-#include "clif.h"
-#include "map.h"
-#include "npc.h" // npc_event_do()
-#include "pc.h"
-#include "skill.h" // ext_skill_unit_onplace()
-#include "chat.h"
-
-#include <stdio.h>
-#include <string.h>
-
-
-int chat_triggerevent(struct chat_data *cd); // forward declaration
-
-/// Initializes a chatroom object (common functionality for both pc and npc chatrooms).
-/// Returns a chatroom object on success, or NULL on failure.
-static struct chat_data* chat_createchat(struct block_list* bl, const char* title, const char* pass, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl)
-{
- struct chat_data* cd;
- nullpo_retr(NULL, bl);
-
- cd = (struct chat_data *) aMalloc(sizeof(struct chat_data));
-
- safestrncpy(cd->title, title, sizeof(cd->title));
- safestrncpy(cd->pass, pass, sizeof(cd->pass));
- cd->pub = pub;
- cd->users = 0;
- cd->limit = min(limit, ARRAYLENGTH(cd->usersd));
- cd->trigger = trigger;
- cd->zeny = zeny;
- cd->minLvl = minLvl;
- cd->maxLvl = maxLvl;
- memset(cd->usersd, 0, sizeof(cd->usersd));
- cd->owner = bl;
- safestrncpy(cd->npc_event, ev, sizeof(cd->npc_event));
-
- cd->bl.id = iMap->get_new_object_id();
- cd->bl.m = bl->m;
- cd->bl.x = bl->x;
- cd->bl.y = bl->y;
- cd->bl.type = BL_CHAT;
- cd->bl.next = cd->bl.prev = NULL;
-
- if( cd->bl.id == 0 )
- {
- aFree(cd);
- cd = NULL;
- }
-
- iMap->addiddb(&cd->bl);
-
- if( bl->type != BL_NPC )
- cd->kick_list = idb_alloc(DB_OPT_BASE);
-
- return cd;
-}
-
-/*==========================================
- * player chatroom creation
- *------------------------------------------*/
-int chat_createpcchat(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub)
-{
- struct chat_data* cd;
- nullpo_ret(sd);
-
- if( sd->chatID )
- return 0; //Prevent people abusing the chat system by creating multiple chats, as pointed out by End of Exam. [Skotlex]
-
- if( sd->state.vending || sd->state.buyingstore )
- {// not chat, when you already have a store open
- return 0;
- }
-
- if( map[sd->bl.m].flag.nochat )
- {
- clif->message(sd->fd, msg_txt(281));
- return 0; //Can't create chatrooms on this map.
- }
-
- if( iMap->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) )
- {
- clif->message (sd->fd, msg_txt(665));
- return 0;
- }
-
- pc_stop_walking(sd,1);
-
- cd = chat_createchat(&sd->bl, title, pass, limit, pub, 0, "", 0, 1, MAX_LEVEL);
- if( cd ) {
- cd->users = 1;
- cd->usersd[0] = sd;
- pc_setchatid(sd,cd->bl.id);
- pc_stop_attack(sd);
- clif->createchat(sd,0);
- clif->dispchat(cd,0);
- } else
- clif->createchat(sd,1);
-
- return 0;
-}
-
-/*==========================================
- * 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*)iMap->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->owner->type == BL_NPC) ? cd->users+1 : cd->users) >= cd->limit )
- {
- clif->joinchatfail(sd,0);
- return 0;
- }
-
- if( !cd->pub && strncmp(pass, cd->pass, sizeof(cd->pass)) != 0 && !pc->has_permission(sd, PC_PERM_JOIN_ALL_CHAT) )
- {
- clif->joinchatfail(sd,1);
- 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;
- }
-
- if( cd->owner->type != BL_NPC && idb_exists(cd->kick_list,sd->status.char_id) ) {
- clif->joinchatfail(sd,2);//You have been kicked out of the room.
- return 0;
- }
-
- pc_stop_walking(sd,1);
- cd->usersd[cd->users] = sd;
- cd->users++;
-
- pc_setchatid(sd,cd->bl.id);
-
- clif->joinchatok(sd, cd); //To the person who newly joined the list of all
- clif->addchat(cd, sd); //Reports To the person who already in the chat
- clif->dispchat(cd, 0); //Reported number of changes to the people around
-
- chat_triggerevent(cd); //Event
-
- return 0;
-}
-
-
-/*==========================================
- * leave a chatroom
- *------------------------------------------*/
-int chat_leavechat(struct map_session_data* sd, bool kicked)
-{
- struct chat_data* cd;
- int i;
- int leavechar;
-
- nullpo_retr(1, sd);
-
- cd = (struct chat_data*)iMap->id2bl(sd->chatID);
- if( cd == NULL )
- {
- pc_setchatid(sd, 0);
- return 1;
- }
-
- ARR_FIND( 0, cd->users, i, cd->usersd[i] == sd );
- if ( i == cd->users )
- { // Not found in the chatroom?
- pc_setchatid(sd, 0);
- return -1;
- }
-
- clif->leavechat(cd, sd, kicked);
- pc_setchatid(sd, 0);
- cd->users--;
-
- leavechar = i;
-
- for( i = leavechar; i < cd->users; i++ )
- cd->usersd[i] = cd->usersd[i+1];
-
-
- if( cd->users == 0 && cd->owner->type == BL_PC ) { // Delete empty chatroom
- struct skill_unit* unit;
- struct skill_unit_group* group;
-
- clif->clearchat(cd, 0);
- db_destroy(cd->kick_list);
- iMap->deliddb(&cd->bl);
- iMap->delblock(&cd->bl);
- iMap->freeblock(&cd->bl);
-
- unit = iMap->find_skill_unit_oncell(&sd->bl, sd->bl.x, sd->bl.y, AL_WARP, NULL, 0);
- group = (unit != NULL) ? unit->group : NULL;
- if (group != NULL)
- skill->unit_onplace(unit, &sd->bl, group->tick);
-
- return 1;
- }
-
- if( leavechar == 0 && cd->owner->type == BL_PC )
- { // Set and announce new owner
- cd->owner = (struct block_list*) cd->usersd[0];
- clif->changechatowner(cd, cd->usersd[0]);
- clif->clearchat(cd, 0);
-
- //Adjust Chat location after owner has been changed.
- iMap->delblock( &cd->bl );
- cd->bl.x=cd->usersd[0]->bl.x;
- cd->bl.y=cd->usersd[0]->bl.y;
- iMap->addblock( &cd->bl );
-
- clif->dispchat(cd,0);
- }
- else
- clif->dispchat(cd,0); // refresh chatroom
-
- return 0;
-}
-
-/*==========================================
- * change a chatroom's owner
- *------------------------------------------*/
-int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
-{
- struct chat_data* cd;
- struct map_session_data* tmpsd;
- int i;
-
- nullpo_retr(1, sd);
-
- cd = (struct chat_data*)iMap->id2bl(sd->chatID);
- if( cd == NULL || (struct block_list*) sd != cd->owner )
- return 1;
-
- ARR_FIND( 1, cd->users, i, strncmp(cd->usersd[i]->status.name, nextownername, NAME_LENGTH) == 0 );
- if( i == cd->users )
- return -1; // name not found
-
- // erase temporarily
- clif->clearchat(cd,0);
-
- // set new owner
- cd->owner = (struct block_list*) cd->usersd[i];
- clif->changechatowner(cd,cd->usersd[i]);
-
- // swap the old and new owners' positions
- tmpsd = cd->usersd[i];
- cd->usersd[i] = cd->usersd[0];
- cd->usersd[0] = tmpsd;
-
- // set the new chatroom position
- iMap->delblock( &cd->bl );
- cd->bl.x = cd->owner->x;
- cd->bl.y = cd->owner->y;
- iMap->addblock( &cd->bl );
-
- // and display again
- clif->dispchat(cd,0);
-
- return 0;
-}
-
-/*==========================================
- * change a chatroom's status (title, etc)
- *------------------------------------------*/
-int chat_changechatstatus(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub)
-{
- struct chat_data* cd;
-
- nullpo_retr(1, sd);
-
- cd = (struct chat_data*)iMap->id2bl(sd->chatID);
- if( cd==NULL || (struct block_list *)sd != cd->owner )
- return 1;
-
- safestrncpy(cd->title, title, CHATROOM_TITLE_SIZE);
- safestrncpy(cd->pass, pass, CHATROOM_PASS_SIZE);
- cd->limit = min(limit, ARRAYLENGTH(cd->usersd));
- cd->pub = pub;
-
- clif->changechatstatus(cd);
- clif->dispchat(cd,0);
-
- return 0;
-}
-
-/*==========================================
- * 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 *)iMap->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 (pc->has_permission(cd->usersd[i], PC_PERM_NO_CHAT_KICK))
- return 0; //gm kick protection [Valaris]
-
- idb_put(cd->kick_list,cd->usersd[i]->status.char_id,(void*)1);
-
- chat->leavechat(cd->usersd[i],1);
- return 0;
-}
-
-/// Creates a chat room for the npc.
-int chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl)
-{
- struct chat_data* cd;
- nullpo_ret(nd);
-
- if( nd->chat_id ) {
- ShowError("chat_createnpcchat: npc '%s' already has a chatroom, cannot create new one!\n", nd->exname);
- return 0;
- }
-
- if( zeny > MAX_ZENY || maxLvl > MAX_LEVEL ) {
- ShowError("chat_createnpcchat: npc '%s' has a required lvl or amount of zeny over the max limit!\n", nd->exname);
- return 0;
- }
-
- cd = chat_createchat(&nd->bl, title, "", limit, pub, trigger, ev, zeny, minLvl, maxLvl);
-
- if( cd ) {
- nd->chat_id = cd->bl.id;
- clif->dispchat(cd,0);
- }
-
- return 0;
-}
-
-/// Removes the chatroom from the npc.
-int chat_deletenpcchat(struct npc_data* nd)
-{
- struct chat_data *cd;
- nullpo_ret(nd);
-
- cd = (struct chat_data*)iMap->id2bl(nd->chat_id);
- if( cd == NULL )
- return 0;
-
- chat->npckickall(cd);
- clif->clearchat(cd, 0);
- iMap->deliddb(&cd->bl);
- iMap->delblock(&cd->bl);
- iMap->freeblock(&cd->bl);
- nd->chat_id = 0;
-
- return 0;
-}
-
-/*==========================================
- * Trigger npc event when we enter the chatroom
- *------------------------------------------*/
-int chat_triggerevent(struct chat_data *cd)
-{
- nullpo_ret(cd);
-
- if( cd->users >= cd->trigger && cd->npc_event[0] )
- npc_event_do(cd->npc_event);
- return 0;
-}
-
-/// Enables the event of the chat room.
-/// At most, 127 users are needed to trigger the event.
-int chat_enableevent(struct chat_data* cd)
-{
- nullpo_ret(cd);
-
- cd->trigger &= 0x7f;
- chat_triggerevent(cd);
- return 0;
-}
-
-/// Disables the event of the chat room
-int chat_disableevent(struct chat_data* cd)
-{
- nullpo_ret(cd);
-
- cd->trigger |= 0x80;
- return 0;
-}
-
-/// Kicks all the users from the chat room.
-int chat_npckickall(struct chat_data* cd)
-{
- nullpo_ret(cd);
-
- while( cd->users > 0 )
- chat->leavechat(cd->usersd[cd->users-1],0);
-
- return 0;
-}
-
-/*=====================================
-* Default Functions : chat.h
-* Generated by HerculesInterfaceMaker
-* created by Susu
-*-------------------------------------*/
-void chat_defaults(void) {
- chat = &chat_s;
- /* funcs */
-
- chat->createpcchat = chat_createpcchat;
- chat->joinchat = chat_joinchat;
- chat->leavechat = chat_leavechat;
- chat->changechatowner = chat_changechatowner;
- chat->changechatstatus = chat_changechatstatus;
- chat->kickchat = chat_kickchat;
-
- chat->createnpcchat = chat_createnpcchat;
- chat->deletenpcchat = chat_deletenpcchat;
- chat->enableevent = chat_enableevent;
- chat->disableevent = chat_disableevent;
- chat->npckickall = chat_npckickall;
-}
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+
+#include "../common/cbasetypes.h"
+#include "../common/malloc.h"
+#include "../common/nullpo.h"
+#include "../common/showmsg.h"
+#include "../common/strlib.h"
+#include "../common/mmo.h"
+#include "atcommand.h" // msg_txt()
+#include "battle.h" // struct battle_config
+#include "clif.h"
+#include "map.h"
+#include "npc.h" // npc_event_do()
+#include "pc.h"
+#include "skill.h" // ext_skill_unit_onplace()
+#include "chat.h"
+
+#include <stdio.h>
+#include <string.h>
+
+
+int chat_triggerevent(struct chat_data *cd); // forward declaration
+
+/// Initializes a chatroom object (common functionality for both pc and npc chatrooms).
+/// Returns a chatroom object on success, or NULL on failure.
+static struct chat_data* chat_createchat(struct block_list* bl, const char* title, const char* pass, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl)
+{
+ struct chat_data* cd;
+ nullpo_retr(NULL, bl);
+
+ cd = (struct chat_data *) aMalloc(sizeof(struct chat_data));
+
+ safestrncpy(cd->title, title, sizeof(cd->title));
+ safestrncpy(cd->pass, pass, sizeof(cd->pass));
+ cd->pub = pub;
+ cd->users = 0;
+ cd->limit = min(limit, ARRAYLENGTH(cd->usersd));
+ cd->trigger = trigger;
+ cd->zeny = zeny;
+ cd->minLvl = minLvl;
+ cd->maxLvl = maxLvl;
+ memset(cd->usersd, 0, sizeof(cd->usersd));
+ cd->owner = bl;
+ safestrncpy(cd->npc_event, ev, sizeof(cd->npc_event));
+
+ cd->bl.id = iMap->get_new_object_id();
+ cd->bl.m = bl->m;
+ cd->bl.x = bl->x;
+ cd->bl.y = bl->y;
+ cd->bl.type = BL_CHAT;
+ cd->bl.next = cd->bl.prev = NULL;
+
+ if( cd->bl.id == 0 )
+ {
+ aFree(cd);
+ cd = NULL;
+ }
+
+ iMap->addiddb(&cd->bl);
+
+ if( bl->type != BL_NPC )
+ cd->kick_list = idb_alloc(DB_OPT_BASE);
+
+ return cd;
+}
+
+/*==========================================
+ * player chatroom creation
+ *------------------------------------------*/
+int chat_createpcchat(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub)
+{
+ struct chat_data* cd;
+ nullpo_ret(sd);
+
+ if( sd->chatID )
+ return 0; //Prevent people abusing the chat system by creating multiple chats, as pointed out by End of Exam. [Skotlex]
+
+ if( sd->state.vending || sd->state.buyingstore )
+ {// not chat, when you already have a store open
+ return 0;
+ }
+
+ if( map[sd->bl.m].flag.nochat )
+ {
+ clif->message(sd->fd, msg_txt(281));
+ return 0; //Can't create chatrooms on this map.
+ }
+
+ if( iMap->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) )
+ {
+ clif->message (sd->fd, msg_txt(665));
+ return 0;
+ }
+
+ pc_stop_walking(sd,1);
+
+ cd = chat_createchat(&sd->bl, title, pass, limit, pub, 0, "", 0, 1, MAX_LEVEL);
+ if( cd ) {
+ cd->users = 1;
+ cd->usersd[0] = sd;
+ pc_setchatid(sd,cd->bl.id);
+ pc_stop_attack(sd);
+ clif->createchat(sd,0);
+ clif->dispchat(cd,0);
+ } else
+ clif->createchat(sd,1);
+
+ return 0;
+}
+
+/*==========================================
+ * 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*)iMap->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->owner->type == BL_NPC) ? cd->users+1 : cd->users) >= cd->limit )
+ {
+ clif->joinchatfail(sd,0);
+ return 0;
+ }
+
+ if( !cd->pub && strncmp(pass, cd->pass, sizeof(cd->pass)) != 0 && !pc->has_permission(sd, PC_PERM_JOIN_ALL_CHAT) )
+ {
+ clif->joinchatfail(sd,1);
+ 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;
+ }
+
+ if( cd->owner->type != BL_NPC && idb_exists(cd->kick_list,sd->status.char_id) ) {
+ clif->joinchatfail(sd,2);//You have been kicked out of the room.
+ return 0;
+ }
+
+ pc_stop_walking(sd,1);
+ cd->usersd[cd->users] = sd;
+ cd->users++;
+
+ pc_setchatid(sd,cd->bl.id);
+
+ clif->joinchatok(sd, cd); //To the person who newly joined the list of all
+ clif->addchat(cd, sd); //Reports To the person who already in the chat
+ clif->dispchat(cd, 0); //Reported number of changes to the people around
+
+ chat_triggerevent(cd); //Event
+
+ return 0;
+}
+
+
+/*==========================================
+ * leave a chatroom
+ *------------------------------------------*/
+int chat_leavechat(struct map_session_data* sd, bool kicked)
+{
+ struct chat_data* cd;
+ int i;
+ int leavechar;
+
+ nullpo_retr(1, sd);
+
+ cd = (struct chat_data*)iMap->id2bl(sd->chatID);
+ if( cd == NULL )
+ {
+ pc_setchatid(sd, 0);
+ return 1;
+ }
+
+ ARR_FIND( 0, cd->users, i, cd->usersd[i] == sd );
+ if ( i == cd->users )
+ { // Not found in the chatroom?
+ pc_setchatid(sd, 0);
+ return -1;
+ }
+
+ clif->leavechat(cd, sd, kicked);
+ pc_setchatid(sd, 0);
+ cd->users--;
+
+ leavechar = i;
+
+ for( i = leavechar; i < cd->users; i++ )
+ cd->usersd[i] = cd->usersd[i+1];
+
+
+ if( cd->users == 0 && cd->owner->type == BL_PC ) { // Delete empty chatroom
+ struct skill_unit* unit;
+ struct skill_unit_group* group;
+
+ clif->clearchat(cd, 0);
+ db_destroy(cd->kick_list);
+ iMap->deliddb(&cd->bl);
+ iMap->delblock(&cd->bl);
+ iMap->freeblock(&cd->bl);
+
+ unit = iMap->find_skill_unit_oncell(&sd->bl, sd->bl.x, sd->bl.y, AL_WARP, NULL, 0);
+ group = (unit != NULL) ? unit->group : NULL;
+ if (group != NULL)
+ skill->unit_onplace(unit, &sd->bl, group->tick);
+
+ return 1;
+ }
+
+ if( leavechar == 0 && cd->owner->type == BL_PC )
+ { // Set and announce new owner
+ cd->owner = (struct block_list*) cd->usersd[0];
+ clif->changechatowner(cd, cd->usersd[0]);
+ clif->clearchat(cd, 0);
+
+ //Adjust Chat location after owner has been changed.
+ iMap->delblock( &cd->bl );
+ cd->bl.x=cd->usersd[0]->bl.x;
+ cd->bl.y=cd->usersd[0]->bl.y;
+ iMap->addblock( &cd->bl );
+
+ clif->dispchat(cd,0);
+ }
+ else
+ clif->dispchat(cd,0); // refresh chatroom
+
+ return 0;
+}
+
+/*==========================================
+ * change a chatroom's owner
+ *------------------------------------------*/
+int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
+{
+ struct chat_data* cd;
+ struct map_session_data* tmpsd;
+ int i;
+
+ nullpo_retr(1, sd);
+
+ cd = (struct chat_data*)iMap->id2bl(sd->chatID);
+ if( cd == NULL || (struct block_list*) sd != cd->owner )
+ return 1;
+
+ ARR_FIND( 1, cd->users, i, strncmp(cd->usersd[i]->status.name, nextownername, NAME_LENGTH) == 0 );
+ if( i == cd->users )
+ return -1; // name not found
+
+ // erase temporarily
+ clif->clearchat(cd,0);
+
+ // set new owner
+ cd->owner = (struct block_list*) cd->usersd[i];
+ clif->changechatowner(cd,cd->usersd[i]);
+
+ // swap the old and new owners' positions
+ tmpsd = cd->usersd[i];
+ cd->usersd[i] = cd->usersd[0];
+ cd->usersd[0] = tmpsd;
+
+ // set the new chatroom position
+ iMap->delblock( &cd->bl );
+ cd->bl.x = cd->owner->x;
+ cd->bl.y = cd->owner->y;
+ iMap->addblock( &cd->bl );
+
+ // and display again
+ clif->dispchat(cd,0);
+
+ return 0;
+}
+
+/*==========================================
+ * change a chatroom's status (title, etc)
+ *------------------------------------------*/
+int chat_changechatstatus(struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub)
+{
+ struct chat_data* cd;
+
+ nullpo_retr(1, sd);
+
+ cd = (struct chat_data*)iMap->id2bl(sd->chatID);
+ if( cd==NULL || (struct block_list *)sd != cd->owner )
+ return 1;
+
+ safestrncpy(cd->title, title, CHATROOM_TITLE_SIZE);
+ safestrncpy(cd->pass, pass, CHATROOM_PASS_SIZE);
+ cd->limit = min(limit, ARRAYLENGTH(cd->usersd));
+ cd->pub = pub;
+
+ clif->changechatstatus(cd);
+ clif->dispchat(cd,0);
+
+ return 0;
+}
+
+/*==========================================
+ * 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 *)iMap->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 (pc->has_permission(cd->usersd[i], PC_PERM_NO_CHAT_KICK))
+ return 0; //gm kick protection [Valaris]
+
+ idb_put(cd->kick_list,cd->usersd[i]->status.char_id,(void*)1);
+
+ chat->leavechat(cd->usersd[i],1);
+ return 0;
+}
+
+/// Creates a chat room for the npc.
+int chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl)
+{
+ struct chat_data* cd;
+ nullpo_ret(nd);
+
+ if( nd->chat_id ) {
+ ShowError("chat_createnpcchat: npc '%s' already has a chatroom, cannot create new one!\n", nd->exname);
+ return 0;
+ }
+
+ if( zeny > MAX_ZENY || maxLvl > MAX_LEVEL ) {
+ ShowError("chat_createnpcchat: npc '%s' has a required lvl or amount of zeny over the max limit!\n", nd->exname);
+ return 0;
+ }
+
+ cd = chat_createchat(&nd->bl, title, "", limit, pub, trigger, ev, zeny, minLvl, maxLvl);
+
+ if( cd ) {
+ nd->chat_id = cd->bl.id;
+ clif->dispchat(cd,0);
+ }
+
+ return 0;
+}
+
+/// Removes the chatroom from the npc.
+int chat_deletenpcchat(struct npc_data* nd)
+{
+ struct chat_data *cd;
+ nullpo_ret(nd);
+
+ cd = (struct chat_data*)iMap->id2bl(nd->chat_id);
+ if( cd == NULL )
+ return 0;
+
+ chat->npckickall(cd);
+ clif->clearchat(cd, 0);
+ iMap->deliddb(&cd->bl);
+ iMap->delblock(&cd->bl);
+ iMap->freeblock(&cd->bl);
+ nd->chat_id = 0;
+
+ return 0;
+}
+
+/*==========================================
+ * Trigger npc event when we enter the chatroom
+ *------------------------------------------*/
+int chat_triggerevent(struct chat_data *cd)
+{
+ nullpo_ret(cd);
+
+ if( cd->users >= cd->trigger && cd->npc_event[0] )
+ npc_event_do(cd->npc_event);
+ return 0;
+}
+
+/// Enables the event of the chat room.
+/// At most, 127 users are needed to trigger the event.
+int chat_enableevent(struct chat_data* cd)
+{
+ nullpo_ret(cd);
+
+ cd->trigger &= 0x7f;
+ chat_triggerevent(cd);
+ return 0;
+}
+
+/// Disables the event of the chat room
+int chat_disableevent(struct chat_data* cd)
+{
+ nullpo_ret(cd);
+
+ cd->trigger |= 0x80;
+ return 0;
+}
+
+/// Kicks all the users from the chat room.
+int chat_npckickall(struct chat_data* cd)
+{
+ nullpo_ret(cd);
+
+ while( cd->users > 0 )
+ chat->leavechat(cd->usersd[cd->users-1],0);
+
+ return 0;
+}
+
+/*=====================================
+* Default Functions : chat.h
+* Generated by HerculesInterfaceMaker
+* created by Susu
+*-------------------------------------*/
+void chat_defaults(void) {
+ chat = &chat_s;
+ /* funcs */
+
+ chat->createpcchat = chat_createpcchat;
+ chat->joinchat = chat_joinchat;
+ chat->leavechat = chat_leavechat;
+ chat->changechatowner = chat_changechatowner;
+ chat->changechatstatus = chat_changechatstatus;
+ chat->kickchat = chat_kickchat;
+
+ chat->createnpcchat = chat_createnpcchat;
+ chat->deletenpcchat = chat_deletenpcchat;
+ chat->enableevent = chat_enableevent;
+ chat->disableevent = chat_disableevent;
+ chat->npckickall = chat_npckickall;
+}
diff --git a/src/map/chat.h b/src/map/chat.h
index ff78d8617..a7736e9f3 100644
--- a/src/map/chat.h
+++ b/src/map/chat.h
@@ -1,56 +1,56 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
-#ifndef _CHAT_H_
-#define _CHAT_H_
-#include "map.h" // struct block_list, CHATROOM_TITLE_SIZE
-struct map_session_data;
-struct chat_data;
-
-
-struct chat_data {
- struct block_list bl; // data for this map object
- char title[CHATROOM_TITLE_SIZE]; // room title
- char pass[CHATROOM_PASS_SIZE]; // password
- bool pub; // private/public flag
- uint8 users; // current user count
- uint8 limit; // join limit
- uint8 trigger; // number of users needed to trigger event
- uint32 zeny; // required zeny to join
- uint32 minLvl; // minimum base level to join
- uint32 maxLvl; // maximum base level allowed to join
- struct map_session_data* usersd[20];
- struct block_list* owner;
- char npc_event[EVENT_NAME_LENGTH];
- DBMap* kick_list; //DBMap of users who were kicked from this chat
-};
-
-
-
-
-/*=====================================
-* Interface : chat.h
-* Generated by HerculesInterfaceMaker
-* created by Susu
-*-------------------------------------*/
-struct chat_interface {
- /* funcs */
-
- int (*createpcchat) (struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub);
- int (*joinchat) (struct map_session_data* sd, int chatid, const char* pass);
- int (*leavechat) (struct map_session_data* sd, bool kicked);
- int (*changechatowner) (struct map_session_data* sd, const char* nextownername);
- int (*changechatstatus) (struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub);
- int (*kickchat) (struct map_session_data* sd, const char* kickusername);
-
- int (*createnpcchat) (struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl);
- int (*deletenpcchat) (struct npc_data* nd);
- int (*enableevent) (struct chat_data* cd);
- int (*disableevent) (struct chat_data* cd);
- int (*npckickall) (struct chat_data* cd);
-} chat_s;
-
-struct chat_interface *chat;
-
-void chat_defaults(void);
-
-#endif /* _CHAT_H_ */
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+#ifndef _CHAT_H_
+#define _CHAT_H_
+#include "map.h" // struct block_list, CHATROOM_TITLE_SIZE
+struct map_session_data;
+struct chat_data;
+
+
+struct chat_data {
+ struct block_list bl; // data for this map object
+ char title[CHATROOM_TITLE_SIZE]; // room title
+ char pass[CHATROOM_PASS_SIZE]; // password
+ bool pub; // private/public flag
+ uint8 users; // current user count
+ uint8 limit; // join limit
+ uint8 trigger; // number of users needed to trigger event
+ uint32 zeny; // required zeny to join
+ uint32 minLvl; // minimum base level to join
+ uint32 maxLvl; // maximum base level allowed to join
+ struct map_session_data* usersd[20];
+ struct block_list* owner;
+ char npc_event[EVENT_NAME_LENGTH];
+ DBMap* kick_list; //DBMap of users who were kicked from this chat
+};
+
+
+
+
+/*=====================================
+* Interface : chat.h
+* Generated by HerculesInterfaceMaker
+* created by Susu
+*-------------------------------------*/
+struct chat_interface {
+ /* funcs */
+
+ int (*createpcchat) (struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub);
+ int (*joinchat) (struct map_session_data* sd, int chatid, const char* pass);
+ int (*leavechat) (struct map_session_data* sd, bool kicked);
+ int (*changechatowner) (struct map_session_data* sd, const char* nextownername);
+ int (*changechatstatus) (struct map_session_data* sd, const char* title, const char* pass, int limit, bool pub);
+ int (*kickchat) (struct map_session_data* sd, const char* kickusername);
+
+ int (*createnpcchat) (struct npc_data* nd, const char* title, int limit, bool pub, int trigger, const char* ev, int zeny, int minLvl, int maxLvl);
+ int (*deletenpcchat) (struct npc_data* nd);
+ int (*enableevent) (struct chat_data* cd);
+ int (*disableevent) (struct chat_data* cd);
+ int (*npckickall) (struct chat_data* cd);
+} chat_s;
+
+struct chat_interface *chat;
+
+void chat_defaults(void);
+
+#endif /* _CHAT_H_ */
diff --git a/src/map/duel.c b/src/map/duel.c
index a04ed855b..c3b241e9e 100644
--- a/src/map/duel.c
+++ b/src/map/duel.c
@@ -1,204 +1,204 @@
-// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
-// See the LICENSE file
-// Portions Copyright (c) Athena Dev Teams
-
-#include "../common/cbasetypes.h"
-
-#include "atcommand.h" // msg_txt
-#include "clif.h"
-#include "duel.h"
-#include "pc.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-/*==========================================
- * Duel organizing functions [LuzZza]
- *------------------------------------------*/
-void duel_savetime(struct map_session_data* sd)
-{
- time_t timer;
- struct tm *t;
-
- time(&timer);
- t = localtime(&timer);
-
- pc_setglobalreg(sd, "PC_LAST_DUEL_TIME", t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min);
-}
-
-int duel_checktime(struct map_session_data* sd)
-{
- int diff;
- time_t timer;
- struct tm *t;
-
- time(&timer);
- t = localtime(&timer);
-
- diff = t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min - pc_readglobalreg(sd, "PC_LAST_DUEL_TIME");
-
- return !(diff >= 0 && diff < battle_config.duel_time_interval);
-}
-static int duel_showinfo_sub(struct map_session_data* sd, va_list va)
-{
- struct map_session_data *ssd = va_arg(va, struct map_session_data*);
- int *p = va_arg(va, int*);
- char output[256];
-
- if (sd->duel_group != ssd->duel_group) return 0;
-
- sprintf(output, " %d. %s", ++(*p), sd->status.name);
- clif->disp_onlyself(ssd, output, strlen(output));
- return 1;
-}
-
-void duel_showinfo(const unsigned int did, struct map_session_data* sd)
-{
- int p=0;
- char output[256];
-
- if(iDuel->duel_list[did].max_players_limit > 0)
- sprintf(output, msg_txt(370), //" -- Duels: %d/%d, Members: %d/%d, Max players: %d --"
- did, iDuel->duel_count,
- iDuel->duel_list[did].members_count,
- iDuel->duel_list[did].members_count + iDuel->duel_list[did].invites_count,
- iDuel->duel_list[did].max_players_limit);
- else
- sprintf(output, msg_txt(371), //" -- Duels: %d/%d, Members: %d/%d --"
- did, iDuel->duel_count,
- iDuel->duel_list[did].members_count,
- iDuel->duel_list[did].members_count + iDuel->duel_list[did].invites_count);
-
- clif->disp_onlyself(sd, output, strlen(output));
- iMap->map_foreachpc(duel_showinfo_sub, sd, &p);
-}
-
-int duel_create(struct map_session_data* sd, const unsigned int maxpl)
-{
- int i=1;
- char output[256];
-
- while(iDuel->duel_list[i].members_count > 0 && i < MAX_DUEL) i++;
- if(i == MAX_DUEL) return 0;
-
- iDuel->duel_count++;
- sd->duel_group = i;
- iDuel->duel_list[i].members_count++;
- iDuel->duel_list[i].invites_count = 0;
- iDuel->duel_list[i].max_players_limit = maxpl;
-
- strcpy(output, msg_txt(372)); // " -- Duel has been created (@invite/@leave) --"
- clif->disp_onlyself(sd, output, strlen(output));
-
- clif->map_property(sd, MAPPROPERTY_FREEPVPZONE);
- clif->maptypeproperty2(&sd->bl,SELF);
- return i;
-}
-
-void duel_invite(const unsigned int did, struct map_session_data* sd, struct map_session_data* target_sd)
-{
- char output[256];
-
- // " -- Player %s invites %s to duel --"
- sprintf(output, msg_txt(373), sd->status.name, target_sd->status.name);
- clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
-
- target_sd->duel_invite = did;
- iDuel->duel_list[did].invites_count++;
-
- // "Blue -- Player %s invites you to PVP duel (@accept/@reject) --"
- sprintf(output, msg_txt(374), sd->status.name);
- clif->broadcast((struct block_list *)target_sd, output, strlen(output)+1, BC_BLUE, SELF);
-}
-
-static int duel_leave_sub(struct map_session_data* sd, va_list va)
-{
- int did = va_arg(va, int);
- if (sd->duel_invite == did)
- sd->duel_invite = 0;
- return 0;
-}
-
-void duel_leave(const unsigned int did, struct map_session_data* sd)
-{
- char output[256];
-
- // " <- Player %s has left duel --"
- sprintf(output, msg_txt(375), sd->status.name);
- clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
-
- iDuel->duel_list[did].members_count--;
-
- if(iDuel->duel_list[did].members_count == 0) {
- iMap->map_foreachpc(duel_leave_sub, did);
- iDuel->duel_count--;
- }
-
- sd->duel_group = 0;
- duel_savetime(sd);
- clif->map_property(sd, MAPPROPERTY_NOTHING);
- clif->maptypeproperty2(&sd->bl,SELF);
-}
-
-void duel_accept(const unsigned int did, struct map_session_data* sd)
-{
- char output[256];
-
- iDuel->duel_list[did].members_count++;
- sd->duel_group = sd->duel_invite;
- iDuel->duel_list[did].invites_count--;
- sd->duel_invite = 0;
-
- // " -> Player %s has accepted duel --"
- sprintf(output, msg_txt(376), sd->status.name);
- clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
-
- clif->map_property(sd, MAPPROPERTY_FREEPVPZONE);
- clif->maptypeproperty2(&sd->bl,SELF);
-}
-
-void duel_reject(const unsigned int did, struct map_session_data* sd)
-{
- char output[256];
-
- // " -- Player %s has rejected duel --"
- sprintf(output, msg_txt(377), sd->status.name);
- clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
-
- iDuel->duel_list[did].invites_count--;
- sd->duel_invite = 0;
-}
-
-void do_final_duel(void)
-{
-}
-
-void do_init_duel(void)
-{
- memset(&iDuel->duel_list[0], 0, sizeof(iDuel->duel_list));
-}
-
-/*=====================================
-* Default Functions : duel.h
-* Generated by HerculesInterfaceMaker
-* created by Susu
-*-------------------------------------*/
-void iDuel_defaults(void) {
- iDuel = &iDuel_s;
- /* vars */
- iDuel->duel_count = 0;
- /* funcs */
- //Duel functions // [LuzZza]
- iDuel->create = duel_create;
- iDuel->invite = duel_invite;
- iDuel->accept = duel_accept;
- iDuel->reject = duel_reject;
- iDuel->leave = duel_leave;
- iDuel->showinfo = duel_showinfo;
- iDuel->checktime = duel_checktime;
-
- iDuel->do_init_duel = do_init_duel;
- iDuel->do_final_duel = do_final_duel;
-}
+// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// See the LICENSE file
+// Portions Copyright (c) Athena Dev Teams
+
+#include "../common/cbasetypes.h"
+
+#include "atcommand.h" // msg_txt
+#include "clif.h"
+#include "duel.h"
+#include "pc.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+/*==========================================
+ * Duel organizing functions [LuzZza]
+ *------------------------------------------*/
+void duel_savetime(struct map_session_data* sd)
+{
+ time_t timer;
+ struct tm *t;
+
+ time(&timer);
+ t = localtime(&timer);
+
+ pc_setglobalreg(sd, "PC_LAST_DUEL_TIME", t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min);
+}
+
+int duel_checktime(struct map_session_data* sd)
+{
+ int diff;
+ time_t timer;
+ struct tm *t;
+
+ time(&timer);
+ t = localtime(&timer);
+
+ diff = t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min - pc_readglobalreg(sd, "PC_LAST_DUEL_TIME");
+
+ return !(diff >= 0 && diff < battle_config.duel_time_interval);
+}
+static int duel_showinfo_sub(struct map_session_data* sd, va_list va)
+{
+ struct map_session_data *ssd = va_arg(va, struct map_session_data*);
+ int *p = va_arg(va, int*);
+ char output[256];
+
+ if (sd->duel_group != ssd->duel_group) return 0;
+
+ sprintf(output, " %d. %s", ++(*p), sd->status.name);
+ clif->disp_onlyself(ssd, output, strlen(output));
+ return 1;
+}
+
+void duel_showinfo(const unsigned int did, struct map_session_data* sd)
+{
+ int p=0;
+ char output[256];
+
+ if(iDuel->duel_list[did].max_players_limit > 0)
+ sprintf(output, msg_txt(370), //" -- Duels: %d/%d, Members: %d/%d, Max players: %d --"
+ did, iDuel->duel_count,
+ iDuel->duel_list[did].members_count,
+ iDuel->duel_list[did].members_count + iDuel->duel_list[did].invites_count,
+ iDuel->duel_list[did].max_players_limit);
+ else
+ sprintf(output, msg_txt(371), //" -- Duels: %d/%d, Members: %d/%d --"
+ did, iDuel->duel_count,
+ iDuel->duel_list[did].members_count,
+ iDuel->duel_list[did].members_count + iDuel->duel_list[did].invites_count);
+
+ clif->disp_onlyself(sd, output, strlen(output));
+ iMap->map_foreachpc(duel_showinfo_sub, sd, &p);
+}
+
+int duel_create(struct map_session_data* sd, const unsigned int maxpl)
+{
+ int i=1;
+ char output[256];
+
+ while(iDuel->duel_list[i].members_count > 0 && i < MAX_DUEL) i++;
+ if(i == MAX_DUEL) return 0;
+
+ iDuel->duel_count++;
+ sd->duel_group = i;
+ iDuel->duel_list[i].members_count++;
+ iDuel->duel_list[i].invites_count = 0;
+ iDuel->duel_list[i].max_players_limit = maxpl;
+
+ strcpy(output, msg_txt(372)); // " -- Duel has been created (@invite/@leave) --"
+ clif->disp_onlyself(sd, output, strlen(output));
+
+ clif->map_property(sd, MAPPROPERTY_FREEPVPZONE);
+ clif->maptypeproperty2(&sd->bl,SELF);
+ return i;
+}
+
+void duel_invite(const unsigned int did, struct map_session_data* sd, struct map_session_data* target_sd)
+{
+ char output[256];
+
+ // " -- Player %s invites %s to duel --"
+ sprintf(output, msg_txt(373), sd->status.name, target_sd->status.name);
+ clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
+
+ target_sd->duel_invite = did;
+ iDuel->duel_list[did].invites_count++;
+
+ // "Blue -- Player %s invites you to PVP duel (@accept/@reject) --"
+ sprintf(output, msg_txt(374), sd->status.name);
+ clif->broadcast((struct block_list *)target_sd, output, strlen(output)+1, BC_BLUE, SELF);
+}
+
+static int duel_leave_sub(struct map_session_data* sd, va_list va)
+{
+ int did = va_arg(va, int);
+ if (sd->duel_invite == did)
+ sd->duel_invite = 0;
+ return 0;
+}
+
+void duel_leave(const unsigned int did, struct map_session_data* sd)
+{
+ char output[256];
+
+ // " <- Player %s has left duel --"
+ sprintf(output, msg_txt(375), sd->status.name);
+ clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
+
+ iDuel->duel_list[did].members_count--;
+
+ if(iDuel->duel_list[did].members_count == 0) {
+ iMap->map_foreachpc(duel_leave_sub, did);
+ iDuel->duel_count--;
+ }
+
+ sd->duel_group = 0;
+ duel_savetime(sd);
+ clif->map_property(sd, MAPPROPERTY_NOTHING);
+ clif->maptypeproperty2(&sd->bl,SELF);
+}
+
+void duel_accept(const unsigned int did, struct map_session_data* sd)
+{
+ char output[256];
+
+ iDuel->duel_list[did].members_count++;
+ sd->duel_group = sd->duel_invite;
+ iDuel->duel_list[did].invites_count--;
+ sd->duel_invite = 0;
+
+ // " -> Player %s has accepted duel --"
+ sprintf(output, msg_txt(376), sd->status.name);
+ clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
+
+ clif->map_property(sd, MAPPROPERTY_FREEPVPZONE);
+ clif->maptypeproperty2(&sd->bl,SELF);
+}
+
+void duel_reject(const unsigned int did, struct map_session_data* sd)
+{
+ char output[256];
+
+ // " -- Player %s has rejected duel --"
+ sprintf(output, msg_txt(377), sd->status.name);
+ clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
+
+ iDuel->duel_list[did].invites_count--;
+ sd->duel_invite = 0;
+}
+
+void do_final_duel(void)
+{
+}
+
+void do_init_duel(void)
+{
+ memset(&iDuel->duel_list[0], 0, sizeof(iDuel->duel_list));
+}
+
+/*=====================================
+* Default Functions : duel.h
+* Generated by HerculesInterfaceMaker
+* created by Susu
+*-------------------------------------*/
+void iDuel_defaults(void) {
+ iDuel = &iDuel_s;
+ /* vars */
+ iDuel->duel_count = 0;
+ /* funcs */
+ //Duel functions // [LuzZza]
+ iDuel->create = duel_create;
+ iDuel->invite = duel_invite;
+ iDuel->accept = duel_accept;
+ iDuel->reject = duel_reject;
+ iDuel->leave = duel_leave;
+ iDuel->showinfo = duel_showinfo;
+ iDuel->checktime = duel_checktime;
+
+ iDuel->do_init_duel = do_init_duel;
+ iDuel->do_final_duel = do_final_duel;
+}
diff --git a/src/map/intif.h b/src/map/intif.h
index f0c1067fb..8abcf819d 100644
--- a/src/map/intif.h
+++ b/src/map/intif.h
@@ -1,128 +1,128 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
-#ifndef _INTIF_H_
-#define _INFIF_H_
-//#include "../common/mmo.h"
-struct party_member;
-struct guild_member;
-struct guild_position;
-struct s_pet;
-struct s_homunculus;
-struct s_mercenary;
-struct s_elemental;
-struct mail_message;
-struct auction_data;
-
-
-
-
-
-#define intif_rename_pc(sd, name) intif->rename(sd, 0, name)
-#define intif_rename_pet(sd, name) intif->rename(sd, 1, name)
-#define intif_rename_hom(sd, name) intif->rename(sd, 2, name)
-
-
-
-
-
-
-/*=====================================
-* Interface : intif.h
-* Generated by HerculesInterfaceMaker
-* created by Susu
-*-------------------------------------*/
-struct intif_interface {
- /* funcs */
-
-
- int (*parse) (int fd);
-
- int (*create_pet)(int account_id, int char_id, short pet_type, short pet_lv, short pet_egg_id,
- short pet_equip, short intimate, short hungry, char rename_flag, char incuvate, char *pet_name);
-
- int (*broadcast) (const char* mes, int len, int type);
- int (*broadcast2) (const char* mes, int len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY);
- int (*main_message) (struct map_session_data* sd, const char* message);
-
- int (*wis_message) (struct map_session_data *sd,char *nick,char *mes,int mes_len);
- int (*wis_message_to_gm) (char *Wisp_name, int permission, char *mes);
-
- int (*saveregistry) (struct map_session_data *sd, int type);
- int (*request_registry) (struct map_session_data *sd, int flag);
-
- int (*request_guild_storage) (int account_id, int guild_id);
- int (*send_guild_storage) (int account_id, struct guild_storage *gstor);
-
- int (*create_party) (struct party_member *member,char *name,int item,int item2);
- int (*request_partyinfo) (int party_id, int char_id);
-
- int (*party_addmember) (int party_id,struct party_member *member);
- int (*party_changeoption) (int party_id, int account_id, int exp, int item);
- int (*party_leave) (int party_id,int account_id, int char_id);
- int (*party_changemap) (struct map_session_data *sd, int online);
- int (*break_party) (int party_id);
- int (*party_message) (int party_id, int account_id, const char *mes,int len);
- int (*party_leaderchange) (int party_id,int account_id,int char_id);
-
- int (*guild_create) (const char *name, const struct guild_member *master);
- int (*guild_request_info) (int guild_id);
- int (*guild_addmember) (int guild_id, struct guild_member *m);
- int (*guild_leave) (int guild_id, int account_id, int char_id, int flag, const char *mes);
- int (*guild_memberinfoshort) (int guild_id, int account_id, int char_id, int online, int lv, int class_);
- int (*guild_break) (int guild_id);
- int (*guild_message) (int guild_id, int account_id, const char *mes, int len);
- int (*guild_change_gm) (int guild_id, const char* name, int len);
- int (*guild_change_basicinfo) (int guild_id, int type, const void *data, int len);
- int (*guild_change_memberinfo) (int guild_id, int account_id, int char_id, int type, const void *data, int len);
- int (*guild_position) (int guild_id, int idx, struct guild_position *p);
- int (*guild_skillup) (int guild_id, uint16 skill_id, int account_id, int max);
- int (*guild_alliance) (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag);
- int (*guild_notice) (int guild_id, const char *mes1, const char *mes2);
- int (*guild_emblem) (int guild_id, int len, const char *data);
- int (*guild_castle_dataload) (int num, int *castle_ids);
- int (*guild_castle_datasave) (int castle_id, int index, int value);
- int (*request_petdata) (int account_id, int char_id, int pet_id);
- int (*save_petdata) (int account_id, struct s_pet *p);
- int (*delete_petdata) (int pet_id);
- int (*rename) (struct map_session_data *sd, int type, char *name);
- int (*homunculus_create) (int account_id, struct s_homunculus *sh);
- bool (*homunculus_requestload) (int account_id, int homun_id);
- int (*homunculus_requestsave) (int account_id, struct s_homunculus* sh);
- int (*homunculus_requestdelete) (int homun_id);
- /******QUEST SYTEM*******/
- int (*request_questlog) (struct map_session_data * sd);
- int (*quest_save) (struct map_session_data * sd);
- // MERCENARY SYSTEM
- int (*mercenary_create) (struct s_mercenary *merc);
- int (*mercenary_request) (int merc_id, int char_id);
- int (*mercenary_delete) (int merc_id);
- int (*mercenary_save) (struct s_mercenary *merc);
- // MAIL SYSTEM
- int (*Mail_requestinbox) (int char_id, unsigned char flag);
- int (*Mail_read) (int mail_id);
- int (*Mail_getattach) (int char_id, int mail_id);
- int (*Mail_delete) (int char_id, int mail_id);
- int (*Mail_return) (int char_id, int mail_id);
- int (*Mail_send) (int account_id, struct mail_message *msg);
- // AUCTION SYSTEM
- int (*Auction_requestlist) (int char_id, short type, int price, const char* searchtext, short page);
- int (*Auction_register) (struct auction_data *auction);
- int (*Auction_cancel) (int char_id, unsigned int auction_id);
- int (*Auction_close) (int char_id, unsigned int auction_id);
- int (*Auction_bid) (int char_id, const char* name, unsigned int auction_id, int bid);
- // ELEMENTAL SYSTEM
- int (*elemental_create) (struct s_elemental *ele);
- int (*elemental_request) (int ele_id, int char_id);
- int (*elemental_delete) (int ele_id);
- int (*elemental_save) (struct s_elemental *ele);
- /* @accinfo */
- void (*request_accinfo) (int u_fd, int aid, int group_lv, char* query);
-
- int (*CheckForCharServer) (void);
-} intif_s;
-
-struct intif_interface *intif;
-
-void intif_defaults(void);
-
-#endif /* _INTIF_H_ */
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+#ifndef _INTIF_H_
+#define _INFIF_H_
+//#include "../common/mmo.h"
+struct party_member;
+struct guild_member;
+struct guild_position;
+struct s_pet;
+struct s_homunculus;
+struct s_mercenary;
+struct s_elemental;
+struct mail_message;
+struct auction_data;
+
+
+
+
+
+#define intif_rename_pc(sd, name) intif->rename(sd, 0, name)
+#define intif_rename_pet(sd, name) intif->rename(sd, 1, name)
+#define intif_rename_hom(sd, name) intif->rename(sd, 2, name)
+
+
+
+
+
+
+/*=====================================
+* Interface : intif.h
+* Generated by HerculesInterfaceMaker
+* created by Susu
+*-------------------------------------*/
+struct intif_interface {
+ /* funcs */
+
+
+ int (*parse) (int fd);
+
+ int (*create_pet)(int account_id, int char_id, short pet_type, short pet_lv, short pet_egg_id,
+ short pet_equip, short intimate, short hungry, char rename_flag, char incuvate, char *pet_name);
+
+ int (*broadcast) (const char* mes, int len, int type);
+ int (*broadcast2) (const char* mes, int len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY);
+ int (*main_message) (struct map_session_data* sd, const char* message);
+
+ int (*wis_message) (struct map_session_data *sd,char *nick,char *mes,int mes_len);
+ int (*wis_message_to_gm) (char *Wisp_name, int permission, char *mes);
+
+ int (*saveregistry) (struct map_session_data *sd, int type);
+ int (*request_registry) (struct map_session_data *sd, int flag);
+
+ int (*request_guild_storage) (int account_id, int guild_id);
+ int (*send_guild_storage) (int account_id, struct guild_storage *gstor);
+
+ int (*create_party) (struct party_member *member,char *name,int item,int item2);
+ int (*request_partyinfo) (int party_id, int char_id);
+
+ int (*party_addmember) (int party_id,struct party_member *member);
+ int (*party_changeoption) (int party_id, int account_id, int exp, int item);
+ int (*party_leave) (int party_id,int account_id, int char_id);
+ int (*party_changemap) (struct map_session_data *sd, int online);
+ int (*break_party) (int party_id);
+ int (*party_message) (int party_id, int account_id, const char *mes,int len);
+ int (*party_leaderchange) (int party_id,int account_id,int char_id);
+
+ int (*guild_create) (const char *name, const struct guild_member *master);
+ int (*guild_request_info) (int guild_id);
+ int (*guild_addmember) (int guild_id, struct guild_member *m);
+ int (*guild_leave) (int guild_id, int account_id, int char_id, int flag, const char *mes);
+ int (*guild_memberinfoshort) (int guild_id, int account_id, int char_id, int online, int lv, int class_);
+ int (*guild_break) (int guild_id);
+ int (*guild_message) (int guild_id, int account_id, const char *mes, int len);
+ int (*guild_change_gm) (int guild_id, const char* name, int len);
+ int (*guild_change_basicinfo) (int guild_id, int type, const void *data, int len);
+ int (*guild_change_memberinfo) (int guild_id, int account_id, int char_id, int type, const void *data, int len);
+ int (*guild_position) (int guild_id, int idx, struct guild_position *p);
+ int (*guild_skillup) (int guild_id, uint16 skill_id, int account_id, int max);
+ int (*guild_alliance) (int guild_id1, int guild_id2, int account_id1, int account_id2, int flag);
+ int (*guild_notice) (int guild_id, const char *mes1, const char *mes2);
+ int (*guild_emblem) (int guild_id, int len, const char *data);
+ int (*guild_castle_dataload) (int num, int *castle_ids);
+ int (*guild_castle_datasave) (int castle_id, int index, int value);
+ int (*request_petdata) (int account_id, int char_id, int pet_id);
+ int (*save_petdata) (int account_id, struct s_pet *p);
+ int (*delete_petdata) (int pet_id);
+ int (*rename) (struct map_session_data *sd, int type, char *name);
+ int (*homunculus_create) (int account_id, struct s_homunculus *sh);
+ bool (*homunculus_requestload) (int account_id, int homun_id);
+ int (*homunculus_requestsave) (int account_id, struct s_homunculus* sh);
+ int (*homunculus_requestdelete) (int homun_id);
+ /******QUEST SYTEM*******/
+ int (*request_questlog) (struct map_session_data * sd);
+ int (*quest_save) (struct map_session_data * sd);
+ // MERCENARY SYSTEM
+ int (*mercenary_create) (struct s_mercenary *merc);
+ int (*mercenary_request) (int merc_id, int char_id);
+ int (*mercenary_delete) (int merc_id);
+ int (*mercenary_save) (struct s_mercenary *merc);
+ // MAIL SYSTEM
+ int (*Mail_requestinbox) (int char_id, unsigned char flag);
+ int (*Mail_read) (int mail_id);
+ int (*Mail_getattach) (int char_id, int mail_id);
+ int (*Mail_delete) (int char_id, int mail_id);
+ int (*Mail_return) (int char_id, int mail_id);
+ int (*Mail_send) (int account_id, struct mail_message *msg);
+ // AUCTION SYSTEM
+ int (*Auction_requestlist) (int char_id, short type, int price, const char* searchtext, short page);
+ int (*Auction_register) (struct auction_data *auction);
+ int (*Auction_cancel) (int char_id, unsigned int auction_id);
+ int (*Auction_close) (int char_id, unsigned int auction_id);
+ int (*Auction_bid) (int char_id, const char* name, unsigned int auction_id, int bid);
+ // ELEMENTAL SYSTEM
+ int (*elemental_create) (struct s_elemental *ele);
+ int (*elemental_request) (int ele_id, int char_id);
+ int (*elemental_delete) (int ele_id);
+ int (*elemental_save) (struct s_elemental *ele);
+ /* @accinfo */
+ void (*request_accinfo) (int u_fd, int aid, int group_lv, char* query);
+
+ int (*CheckForCharServer) (void);
+} intif_s;
+
+struct intif_interface *intif;
+
+void intif_defaults(void);
+
+#endif /* _INTIF_H_ */