66 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C++
		
	
	
	
			
		
		
	
	
			66 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C++
		
	
	
	
| #pragma once
 | |
| #include "squirrel.h"
 | |
| #include "sqstdaux.h"
 | |
| #include "sqstdblob.h"
 | |
| #include "sqstdio.h"
 | |
| #include "sqstdmath.h"
 | |
| #include "sqstdstring.h"
 | |
| #include "sqstdsystem.h"
 | |
| #include <iostream>
 | |
| 
 | |
| typedef int (*__CreateParty)(void *CParty, void *CUser);
 | |
| static SQInteger Party_CreateParty(HSQUIRRELVM v)
 | |
| {
 | |
|     SQUserPointer P;
 | |
|     sq_getuserpointer(v, 2, &P);
 | |
|     SQUserPointer User;
 | |
|     sq_getuserpointer(v, 3, &User);
 | |
|     ((__CreateParty)0x0859B1BE)(P, User);
 | |
|     return 0;
 | |
| }
 | |
| typedef int (*__SetPartyInfoUI)(void *CParty, int code);
 | |
| static SQInteger Party_SetPartyInfoUI(HSQUIRRELVM v) // 设置队伍信息UI可以不写 创出来空的  要写的话要搞个指针 写入很多参数
 | |
| {
 | |
|     SQUserPointer P;
 | |
|     sq_getuserpointer(v, 2, &P);
 | |
|     ((__SetPartyInfoUI)0x0859B234)(P, 0x44d672e);
 | |
|     return 0;
 | |
| }
 | |
| typedef int (*__JoinParty)(void *CParty, void *CUser);
 | |
| static SQInteger Party_JoinParty(HSQUIRRELVM v)
 | |
| {
 | |
|     SQUserPointer P;
 | |
|     sq_getuserpointer(v, 2, &P);
 | |
|     SQUserPointer User;
 | |
|     sq_getuserpointer(v, 3, &User);
 | |
|     ((__JoinParty)0x0859B2B6)(P, User);
 | |
|     return 0;
 | |
| }
 | |
| typedef int (*__SendPartyIpInfo)(void *CParty);
 | |
| static SQInteger Party_SendPartyIpInfo(HSQUIRRELVM v)
 | |
| {
 | |
|     SQUserPointer P;
 | |
|     sq_getuserpointer(v, 2, &P);
 | |
|     ((__SendPartyIpInfo)0x0859CEA2)(P);
 | |
|     return 0;
 | |
| }
 | |
| static SQInteger register_Party_func(HSQUIRRELVM v, SQFUNCTION f, const char *fname)
 | |
| {
 | |
|     sq_pushroottable(v);
 | |
|     sq_pushstring(v, fname, -1);
 | |
|     sq_newclosure(v, f, 0); // create a new function
 | |
|     sq_newslot(v, -3, SQFalse);
 | |
|     sq_pop(v, 1); // pops the root table
 | |
| }
 | |
| 
 | |
| static void RegisterParty(HSQUIRRELVM v)
 | |
| {
 | |
|     // 创建队伍
 | |
|     register_Party_func(v, Party_CreateParty, _SC("Sq_Party_CreateParty"));
 | |
|     // 设置队伍信息UI
 | |
|     register_Party_func(v, Party_SetPartyInfoUI, _SC("Sq_Party_SetPartyInfoUI"));
 | |
|     // 让玩家加入队伍
 | |
|     register_Party_func(v, Party_JoinParty, _SC("Sq_Party_JoinParty"));
 | |
|     // 广播队伍玩家IP
 | |
|     register_Party_func(v, Party_SendPartyIpInfo, _SC("Sq_Party_SendPartyIpInfo"));
 | |
| } |