?? 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 ) // 蓋貿(mào)瀾
{
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 ); // 膠農(nóng)費 屈僥欄肺...
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);
// 絹恫 泅惑陛闌 罐綽 瘤俊 包茄扒 咯扁輯 貿(mào)府秦檔 等促.
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 ) // 郴 清磐 格廢俊 器竊等 逞撈瘤 舅酒焊綽 風(fēng)憑
{
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 )
{
// 泅惑裹牢瘤 眉農(nóng)..
// MP3( SN_KILL_PC );
int ret = my_hunter_list->KillCharacter( who ); // 眉農(nóng)秦輯 樂欄擱 泅惑裹 酒撈叼甫 輯滾肺 焊辰促.
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;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -