-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathSMJS_GameRulesProps.h
More file actions
37 lines (26 loc) · 1.03 KB
/
SMJS_GameRulesProps.h
File metadata and controls
37 lines (26 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef _INCLUDE_SMJS_GAMERULESPROPS_H_
#define _INCLUDE_SMJS_GAMERULESPROPS_H_
#include "SMJS.h"
#include "SMJS_BaseWrapped.h"
#include "SMJS_Netprops.h"
class SMJS_GameRulesProps : public SMJS_BaseWrapped, public SMJS_NPValueCacher {
public:
void *gamerules;
void *proxy;
SMJS_GameRulesProps();
WRAPPED_CLS(SMJS_GameRulesProps, SMJS_BaseWrapped){
temp->InstanceTemplate()->SetNamedPropertyHandler(GetRulesProp, SetRulesProp);
}
v8::Persistent<v8::Value> GenerateThenFindCachedValue(PLUGIN_ID plId, std::string key, SendProp *p, size_t offset){
bool isCacheable;
auto res = v8::Persistent<v8::Value>::New(SMJS_Netprops::SGetNetProp(gamerules, NULL, p, offset, &isCacheable));
if(isCacheable){
InsertCachedValue(plId, key, res);
}
return res;
}
void OnWrapperAttached(SMJS_Plugin *plugin, v8::Persistent<v8::Value> wrapper);
static Handle<Value> GetRulesProp(Local<String> property, const AccessorInfo& info);
static Handle<Value> SetRulesProp(Local<String> prop, Local<Value> value, const AccessorInfo& info);
};
#endif