⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 worldserver.h.svn-base

📁 ROSE的源代码。了解的自己研究,编译通过
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
/*
    Rose Online Server Emulator
    Copyright (C) 2006,2007 OSRose Team http://www.osrose.net
    
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

    depeloped with Main erose/hrose source server + some change from the original eich source        
*/
#ifndef __ROSE_SERVERS__
#define __ROSE_SERVERS__
#include "../common/sockets.h"
#include "worldmonster.h"
#include "worldmap.h"
#include "player.h"
#include "character.h"
#include "party.h"
#include "datatypes.h"
#define MAXVISUALRANGE 100
#define MINVISUALRANGE 60
#define ClearItem(i) { i.appraised=false; i.count=0; i.durability=0; i.itemnum=0; i.itemtype=0; i.lifespan=0; i.refine=0; i.socketed=false; i.stats=0; i.gem=0; }

#define WORLD_THREAD 0
#define VISUALITY_THREAD 1
#define SHUTDOWN_THREAD 2

//LMA TESTLOOP
extern UINT lma_loop;

// Main loginserver server class
class CWorldServer : public CServerSocket
{
    public:
    	//------------------ MAIN (worldserver.cpp)
    	CWorldServer ( string );
        CClientSocket* CreateClientSocket( );	
    	~CWorldServer( );
    	bool OnReceivePacket( CClientSocket* thisclient, CPacket* P );    
    	void OnClientDisconnect( CClientSocket* thisclient );	
    	void DeleteClientSocket( CClientSocket* thisclient );	
    	bool OnServerReady( );
    	void SpawnMonsters( );	    	
    	void LoadConfigurations( char* ); 
        void LoadCommandLevels( void ); 
        void ServerLoop( );  
        
      	//------------------ WORLD PROCESS (worldprocess.cpp)  	
      	//bool GiveExp( CMonster* thismon );
      	//LMA BEGIN
      	//20070621-211100
      	//FOR CF
      	bool GiveExp( CMonster* thismon, UINT special_lvl, UINT special_exp);
      	//LMA END
        
        //LMA BEGIN
        //20070623-232300
        bool Ping();        //MySQL Ping
        //LMA END
        
        //------------------ QUEST DATA (quest.cpp)    		    
    	bool pakGiveQuest( CPlayer* thisclient, CPacket* P );	    	
    
    	//------------------ BUFFS (buff.cpp)
        	CBValue GetBuffValue( CSkills* thisskill, CCharacter* character, UINT Evalue, UINT i, UINT up, UINT down, UINT CurrentValue, bool Buff=true, bool Status=false );
            bool CheckABuffs( CSkills* thisskill, CCharacter* character, int Evalue ,int i);
            bool CheckDBuffs( CSkills* thisskill, CCharacter* character, int Evalue ,int i);                        	
        	bool AddBuffs( CSkills* thisskill, CCharacter* character, int Evalue , bool flag);    		
        	bool AddDeBuffs( CSkills* thisskill, CCharacter* character, int Evalue );
        	bool AddBuffs( CSkills* thisskill, CCharacter* character, int Evalue );	
	
    	//------------------ SERVER EXTRAS (extrafunctions.cpp)  
        bool IsValidItem(UINT type, UINT id );
        UINT GetUIntValue( const char* s , void* var=NULL );
        int GetIntValue( const char* s , void* var=NULL );        
        char* GetStrValue( const char* s , void* var=NULL );        
    	bool SendSysMsg( CPlayer* thisclient, string message );
    	UINT RandNumber( UINT init, UINT range, UINT seed=0 );
    	UINT GetColorExp( UINT playerlevel,UINT moblevel, UINT exp );
    	bool CheckInventorySlot( CPlayer* thisclient, int slot );
    	bool pakGMClass( CPlayer* thisclient, char* classid );
        bool pakGMKillInRange( CPlayer* thisclient, int range );  	
    	bool pakGMHide( CPlayer* thisclient, int mode );
    	void SendToVisible( CPacket* pak, CPlayer* thisclient, bool thisclient=true );	
    	void SendToVisible( CPacket* pak, CPlayer* thisclient, CPlayer* xotherclient );		
    	
    	void SendToVisible( CPacket* pak, class CCharacter* character, CDrop* thisdrop=NULL );
            	
    	bool IsMonInCircle( CPlayer* thisclient, CMonster* thismon, float radius );
        bool IsPlayerInCircle( CPlayer* thisclient, CPlayer* otherclient, float radius );
        CUseInfo* GetUseItemInfo(  CPlayer* thisclient, UINT slot );	    	    		
    	bool IsVisible( CPlayer* thisclient, CPlayer* otherclient );		
    	bool IsMonInCircle( fPoint center, fPoint position, float radius );   
    	bool IsVisible( CPlayer* thisclient, CMonster* thismon );	
    	bool IsVisible( CPlayer* thisclient, CDrop* thisdrop );
        CItem GetItemByHeadAndData( unsigned head, unsigned data );    	
    	bool IsVisible( CPlayer* thisclient, CNPC* thisnpc );	
    	void SendToVisible( CPacket* pak, CMonster* thismon, CDrop* thisdrop=NULL );			
    	void SendToVisible( CPacket* pak, CDrop* thisdrop );	
        CPlayer* GetClientByUserName( char *username );	
    	UINT BuildBuffs( CCharacter* player );
    	void CheckForLevelUp ( CPlayer* thisclient );	                 	
        bool isSkillTargetFriendly( CSkills* thisskill );		
    	CRespawnPoint* GetRespawnByID( UINT id );
    	CPlayer* GetClientByCID( UINT id, UINT map=0 );
    	CPlayer* GetClientByCharName( char* name );	
    	CPlayer* GetClientByID( UINT id, UINT map=0 );	
    	CTeleGate* GetTeleGateByID( UINT id );	
    	UINT BuildItemHead( CItem thisitem );
    	UINT BuildItemData( CItem thisitem );	
    	CMonster* GetMonsterByID( UINT id, UINT map );
    	CSpawnArea* GetSpawnArea( UINT id, UINT map=0 );
        bool DeleteSpawn( CSpawnArea* spawn );
        CNPCData* GetNPCDataByID( UINT id );    	
    	void SendToMap( CPacket* pak, int mapid );	
        unsigned BuildItemRefine(CItem thisitem ); 	
        CMDrops* GetDropData( UINT id );     
    	CRespawnPoint* GetRespawnByMap( int id );   
        CSkills* GetSkillByID( UINT id );          		      
    	void ClearClientID( UINT id );
    	CDrop* GetDropByID( UINT id, UINT map=0 );	
    	CNPC* GetNPCByID( UINT id, UINT map=0 );
        CNPC* GetNPCByType( UINT npctype );
        CDrop* GetDrop( CMonster* thismon );	
    	void SendToAll( CPacket* pak );	
    	UINT GetNewClientID( );	   		
    	void DisconnectAll();	
    	CPlayer* GetClientByUserID( UINT userid );   
        UINT GetLevelGhost( UINT map, UINT level );
        UINT GetFairyRange( UINT part );
        void RefreshFairy( );
    
        //------------------ Fairies ---------------------
        void DoFairyStuff( CPlayer* targetclient, int action );
        void DoFairyFree( int fairy );
    
    	//------------------ MATH (extrafunctions.cpp)
    	fPoint RandInCircle(fPoint center, float radius);
    	fPoint RandInPoly(fPoint p[], int pcount);
    	fPoint RandInTriangle(fPoint p1, fPoint p2, fPoint p3);
    	float AreaOfTriangle(fPoint p1, fPoint p2, fPoint p3);
    	float distance( fPoint pos1, fPoint pos2 );
    
    	//------------------ PACKETS (worldpackets.cpp)
    	bool pakItemMall( CPlayer* thisclient, CPacket* P );
    	bool pakWeight( CPlayer* thisclient, CPacket* P );
    	bool pakPrintscreen( CPlayer* thisclient, CPacket* P );
    	bool pakSpawnChar( CPlayer* thisclient, CPlayer* otherclient );	
        bool pakModifiedItemDone( CPlayer* thisclient, CPacket* P );	
    	bool pakSpawnDrop( CPlayer* thisclient, CDrop* thisdrop );        	    
        bool pakChangeStorage( CPlayer* thisclient, CPacket* P );
        bool pakModifiedItem( CPlayer* thisclient, CPacket* P );
        bool pakPartyManager( CPlayer* thisclient, CPacket* P ); 
        bool pakLevelUpSkill( CPlayer *thisclient, CPacket* P ); 
    	bool pakChangeStance( CPlayer* thisclient, CPacket* P );   
        bool pakCharDSClient( CPlayer* thisclient, CPacket* P );          
    	bool pakChangeEquip( CPlayer* thisclient, CPacket* P );    
    	bool pakStartAttack( CPlayer* thisclient, CPacket* P );
       	bool pakSpawnNPC( CPlayer* thisclient, CNPC* thisnpc );          
        bool pakRideRequest( CPlayer* thisclient, CPacket* P );     
        bool pakPartyActions( CPlayer* thisclient, CPacket* P );      
        bool pakPartyOption( CPlayer* thisclient, CPacket* P ); 
    	bool pakTradeAction( CPlayer* thisclient, CPacket* P ); 
    	bool pakChangeCart( CPlayer* thisclient, CPacket* P );    	
        bool pakSkillSelf ( CPlayer* thisclient, CPacket* P );    
    	bool pakDoIdentify( CPlayer *thisclient, CPacket *P );    
    	bool pakNormalChat( CPlayer* thisclient, CPacket* P );		       
    	bool pakCharSelect( CPlayer* thisclient, CPacket* P );
    	bool pakStartSkill( CPlayer* thisclient, CPacket* P );	       
        bool pakRepairItem( CPlayer* thisclient, CPacket* P );  
    	bool pakMoveSkill( CPlayer* thisclient, CPacket* P );    		
        bool pakCloseShop( CPlayer* thisclient, CPacket* P );          
        bool pakStoreZuly( CPlayer* thisclient, CPacket* P );    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -