📄 huntersystem.cpp
字号:
// HunterSystem.cpp: implementation of the CHunterSystem class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Chat.h"
#include "Hangul.h"
#include "menu.h"
#include "dragon.h"
#include "Hong_Sub.h"
#include "Map.h"
#include "CharDataTable.h"
#include "TeamBattle.h"
#include "GameProc.h"
#include "LineCommand.h"
#include "Tool.h"
#include "Hong_Sprite.h"
#include "directsound.h"
#include "SmallMenu.h"
#include "TextOutMgr.h"
#include "MailMgr.h"
#include "HunterSystem.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// 泅惑裹 矫胶袍
CHunterList *my_hunter_list;
CHunterList *hunter_list;
CHunterList *curr_hunter_list;
CHunterSystem::CHunterSystem()
{
}
CHunterSystem::~CHunterSystem()
{
}
CHunterList* CHunterList::AddNode( k_hunter_list *value )
{
EatRearWhiteChar( value->target_name );
EatRearWhiteChar( value->regist_name );
CHunterList *temp = this;
if( value->index == 0 )
{
while( temp->next ) temp = temp->next;
temp->is_end = 1;
return temp;
}
else
{
while( temp->next )
{
if( value->index == temp->list.index ) return NULL;
temp = temp->next;
}
}
if( !list.index ) // 盖贸澜
{
LPCHARACTER ch = ExistHe( value->target_name ); // 郴 矫具俊 乐绰 逞牢啊...
if( ch )
{
my_sight = 1;
ch->hunter_target = true;
}
list = *value;
return this;
}
CHunterList *data = new CHunterList;
LPCHARACTER ch = ExistHe( value->target_name ); // 郴 矫具俊 乐绰 逞牢啊...
if( ch )
{
data->my_sight = 1;
ch->hunter_target = true;
}
data->list = *value;
temp->next = data;
data->prev = temp;
return data;
}
int CHunterList::print( int x, int y )
{
if( !list.index ) return 0;
PutCharImage( x+21, y+58, list.face, 0, FS_SMALL, 0, list.gender );
Hcolor( FONT_COLOR_NAME );
Hprint2( x+110, y+64, g_DestBackBuf, list.target_name );
Hprint2( x+110, y+154, g_DestBackBuf, list.regist_name );
Hcolor( FONT_COLOR_NUMBER );
Hprint2( x+110, y+109, g_DestBackBuf, "%d", list.money );
RectTextPut( x+25, y+199, 174, list.text ); // 胶农费 屈侥栏肺...
if( GetSysInfo( SI_GAME_MAKE_MODE ) )
{
Hprint2( x+176, y+17, g_DestBackBuf, "%d",list.index );
Hprint2( x+22, y+17, g_DestBackBuf, is_end?"END":"CONTINUE" );
}
if( is_end ) return -1;
return 1;
}
void CHunterList::DeleteAll()
{
SAFE_DELETE(next);
}
int CHunterList::DeleteNode( char *name )
{
CHunterList *temp = this;
while( temp )
{
if( ::stricmp( temp->list.target_name, name ) == 0 )
{
if( temp->prev ) temp->prev->next = temp->next;
if( temp->next ) temp->next->prev = temp->prev;
temp->next = NULL; // 家戈磊 锭巩俊...
SAFE_DELETE(temp);
// 绢恫 泅惑陛阑 罐绰 瘤俊 包茄扒 咯扁辑 贸府秦档 等促.
return 1;
}
temp = temp->next;
}
return 0;
}
int CHunterList::CheckList( char *name, int type ) // 郴 矫具俊 1:甸绢 吭阑锭, 0:哈绢 车阑锭
{
int ret = 0;
CHunterList *temp = this;
while( temp )
{
if( ::stricmp( temp->list.target_name, name ) == 0 )//021230 lsw Name Error
{
if( type ) temp->my_sight = 80;
else temp->my_sight = 0;
ret = 1;
}
temp = temp->next;
}
return ret;
}
int CHunterList::print2( int x, int y )
{
//窜绵 概流 焊咯林扁俊 拱妨 乐促.
if( IsRightWindowOpen() ) return 0; // 坷弗率 芒捞 豆阑锭,
int ret = 0;
Hcolor( FONT_COLOR_NAME );
CHunterList *temp = this;
int count = 1;
while( temp )
{
if( !temp->list.index )
{
temp = temp->next;
continue;
}
ret = 1;
if( temp->my_sight > 1)
{
if( temp->my_sight % 2 )
Hcolor( FONT_COLOR_PLUS );
else Hcolor( FONT_COLOR_NAME );
Hprint2( x, y+count*18, g_DestBackBuf, temp->list.target_name );
Hcolor( FONT_COLOR_NAME );
temp->my_sight--;
}
else if( temp->my_sight == 1 )
{
Hcolor( FONT_COLOR_PLUS );
Hprint2( x, y+count*18, g_DestBackBuf, temp->list.target_name );
Hcolor( FONT_COLOR_NAME );
}
else Hprint2( x, y+count*18, g_DestBackBuf, temp->list.target_name );
temp = temp->next;
count++;
}
if( ret )
{
Hcolor( FONT_COLOR_DEFAULT );
Hprint2( x, y, g_DestBackBuf, "-= LIST =-" );
}
return 1;
}
void CHunterList_Next( CHunterList *&target )
{
if( target->next ) target = target->next;
}
void CHunterList_Prev( CHunterList *&target )
{
if( target->prev ) target = target->prev;
}
int CHunterList::KillCharacter( char *name )
{
CHunterList *temp = this;
int ret = 0;
while( temp )
{
if( ::stricmp( temp->list.target_name, name )==0 )
{
SendKillHunterList( temp->list.index );
ret = 1;
}
temp = temp->next;
}
return ret;
}
int CHunterList::CompName( char *name ) // 殿废茄 荤恩捞 唱衬..
{
return ::stricmp( list.regist_name, name );
}
int CHunterList::CompTargetName( char *name ) // 格钎啊 唱衬..
{
return ::stricmp( list.target_name, name );
}
int CHunterList::CompTargetId( short int id )
{
CHunterList *temp = this;
int ret = 0;
while( temp )
{
if( temp->list.index == id ) return 1;
temp = temp->next;
}
return 0;
}
CHunterList *DeleteMyHunterList( CHunterList *header, char *name ) // 捞抚栏肺 楷搬等 畴靛 昏力窍扁
{
CHunterList *temp = header;
while( temp )
{
if( ::stricmp( temp->list.target_name, name )==0 )
{
if( temp == header ) header = header->next;
CHunterList *buf = temp->next;
if( temp->prev ) temp->prev->next = temp->next;
if( temp->next ) temp->next->prev = temp->prev;
temp->next = NULL;
SAFE_DELETE(temp);
temp = buf;
}
else temp = temp->next;
}
if( !header ) header = new CHunterList; // 歹捞惑 楷搬等 畴靛啊 绝阑锭
return header;
}
bool CHunterList::ExistMyHunterList( char *name ) // 郴 清磐 格废俊 器窃等 逞捞瘤 舅酒焊绰 风凭
{
CHunterList *temp = this;
while( temp )
{
if( !::stricmp( temp->list.target_name, name ) ) return true;
temp = temp->next;
}
return false;
}
void SendHunterRegist( char *name, DWORD money, char *text )
{
ConvString(text);
t_packet p;
p.h.header.type = CMD_HUNTER_REGIST;
strcpy( p.u.kein.hunter_regist.name, name );
p.u.kein.hunter_regist.money = money;
strcpy( p.u.kein.hunter_regist.text, text);
p.h.header.size = sizeof( k_hunter_regist )-1000+strlen(text);
QueuePacket( &p, 1 );
}
void SendGetHunterList( int id )
{
t_packet p;
p.h.header.type = CMD_GET_HUNTER_LIST;
p.u.kein.get_hunter_list.list_id = id;
p.h.header.size = sizeof( k_get_hunter_list );
QueuePacket( &p, 1 );
}
void RecvHunterList( k_hunter_list *hunterlist ) // 泅惑裹 府胶飘 啊廉坷扁
{
curr_hunter_list = curr_hunter_list->AddNode( hunterlist );
}
void SendKillHunterList( int id ) // 泅惑裹阑 棱疽阑锭 府胶飘酒捞叼甫 焊辰促.
{
t_packet p;
p.h.header.type = CMD_KILL_HUNTER_LIST;
p.u.kein.get_hunter_list.list_id = id;
p.h.header.size = sizeof( k_get_hunter_list );
QueuePacket( &p, 1 );
}
//////////////////////////////////////////////////////////////
// 郴啊 穿备甫 磷看促.
void RecvKillWho( char *who )
{
// 泅惑裹牢瘤 眉农..
// MP3( SN_KILL_PC );
int ret = my_hunter_list->KillCharacter( who ); // 眉农秦辑 乐栏搁 泅惑裹 酒捞叼甫 辑滚肺 焊辰促.
LPCHARACTER target = ExistHe( who); // 弊 某腐磐狼 器牢磐甫 掘绢柯饶
if( ret ) // 泅惑裹捞扼搁 // 郴啊 泅惑裹阑 磷牢吧 焊郴霖促. // 弊率 努扼捞攫飘 免仿阑 困秦
{
my_hunter_list = DeleteMyHunterList( my_hunter_list, who ); // 泅惑裹阑 格废俊辑 昏力茄促.
t_packet p;
p.h.header.type = CMD_KILLED_BY_HUNTER;
strcpy( p.u.kein.kill_who.name , who );
p.h.header.size = sizeof( k_kill_who );
QueuePacket( &p, 1 );
}
if( target )
{
target->hunter_target = false;// 泅惑裹 措惑阑 钱绢霖促.
/*
//////////////////// 傈捧 甘老 版快 //////////////////
if( g_FightMapStart )
{
if( Hero->fight_map_team_num && target->fight_map_team_num )
{
AddCurrentStatusMessage( 0, 126, 200, lan->OutputMessage(6,28), FightTeam[target->fight_map_team_num-1], target->name );//010215 lsw
MP3( SN_KILL_WHO );
}
}*/
}
}
// 绵窍钦聪促. 荐硅吝牢 泅惑裹阑 棱绰单 己傍沁嚼聪促.
// 泅惑陛篮 倔付 倔付 涝聪促.
void RecvKillHunterOk( k_kill_hunter_ok *result )
{
MP3( SN_KILL_HUNTER_OK );
AddCurrentStatusMessage( 200, 170, 75, lan->OutputMessage(6,29) );//010215 lsw
AddCurrentStatusMessage( 200, 170, 75, lan->OutputMessage(6,30), result->money );//010215 lsw
// AddMoney( result->money );
}
//#define CMD_HUNTER_REGIST_RESULT 10191 // 穿备穿备啊 寸脚膊辑 泅惑裹 霸矫魄俊 殿废茄 穿备穿备甫 磷捞绰单 己傍沁嚼聪促.
void RecvHunterRegistResult( char *hunter, char *target )
{
MP3( SN_RECV_MAIL );
AddCurrentStatusMessage( 200, 170, 75, lan->OutputMessage(6,31), hunter, target );//010215 lsw
}
void SendDangerOfHunter( short int target_id, char type )
{
t_packet p;
p.h.header.type = CMD_DANGER_OF_HUNTER;
p.u.kein.danger_of_hunter.target_id = target_id;
p.u.kein.danger_of_hunter.type = type;
p.h.header.size = sizeof( k_danger_of_hunter );
QueuePacket( &p, 1 );
}
void RecvDangerByHunter( char type )
{
if( type )
{
danger_by_hunter = 60;
}
else
{
danger_by_hunter = 0;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -