raylib-wasm-transpiler/server/components/Entity.js

204 lines
5.1 KiB
JavaScript

class Entity {
get Name() {
return this._decoder.decode(new Uint8Array(this._ptr.slice(0, 24)));
}
set Name(v) {
this._data.set(this._encoder.encode(v), 0);
}
get Strength() {
return this._data.getUint8(24, true);
}
set Strength(v) {
return this._data.setUint8(24, v, true);
}
get Endurance() {
return this._data.getUint8(25, true);
}
set Endurance(v) {
return this._data.setUint8(25, v, true);
}
get Intelligence() {
return this._data.getUint8(26, true);
}
set Intelligence(v) {
return this._data.setUint8(26, v, true);
}
get Wisdom() {
return this._data.getUint8(27, true);
}
set Wisdom(v) {
return this._data.setUint8(27, v, true);
}
get Charisma() {
return this._data.getUint8(28, true);
}
set Charisma(v) {
return this._data.setUint8(28, v, true);
}
get Faith() {
return this._data.getUint8(29, true);
}
set Faith(v) {
return this._data.setUint8(29, v, true);
}
get Artisan() {
return this._data.getUint8(30, true);
}
set Artisan(v) {
return this._data.setUint8(30, v, true);
}
get Metalworking() {
return this._data.getUint8(31, true);
}
set Metalworking(v) {
return this._data.setUint8(31, v, true);
}
get Alchemy() {
return this._data.getUint8(32, true);
}
set Alchemy(v) {
return this._data.setUint8(32, v, true);
}
get Engineering() {
return this._data.getUint8(33, true);
}
set Engineering(v) {
return this._data.setUint8(33, v, true);
}
get Culinary() {
return this._data.getUint8(34, true);
}
set Culinary(v) {
return this._data.setUint8(34, v, true);
}
get Ranged() {
return this._data.getUint8(35, true);
}
set Ranged(v) {
return this._data.setUint8(35, v, true);
}
get Melee() {
return this._data.getUint8(36, true);
}
set Melee(v) {
return this._data.setUint8(36, v, true);
}
get Acrobatics() {
return this._data.getUint8(37, true);
}
set Acrobatics(v) {
return this._data.setUint8(37, v, true);
}
get Prestidigitation() {
return this._data.getUint8(38, true);
}
set Prestidigitation(v) {
return this._data.setUint8(38, v, true);
}
get Language() {
return this._data.getUint8(39, true);
}
set Language(v) {
return this._data.setUint8(39, v, true);
}
get Medicine() {
return this._data.getUint8(40, true);
}
set Medicine(v) {
return this._data.setUint8(40, v, true);
}
get Thaumitology() {
return this._data.getUint8(41, true);
}
set Thaumitology(v) {
return this._data.setUint8(41, v, true);
}
get Theology() {
return this._data.getUint8(42, true);
}
set Theology(v) {
return this._data.setUint8(42, v, true);
}
get Fishing() {
return this._data.getUint8(43, true);
}
set Fishing(v) {
return this._data.setUint8(43, v, true);
}
get Mining() {
return this._data.getUint8(44, true);
}
set Mining(v) {
return this._data.setUint8(44, v, true);
}
get Survival() {
return this._data.getUint8(45, true);
}
set Survival(v) {
return this._data.setUint8(45, v, true);
}
get Gardening() {
return this._data.getUint8(46, true);
}
set Gardening(v) {
return this._data.setUint8(46, v, true);
}
get History() {
return this._data.getUint8(47, true);
}
set History(v) {
return this._data.setUint8(47, v, true);
}
get Perception() {
return this._data.getUint8(48, true);
}
set Perception(v) {
return this._data.setUint8(48, v, true);
}
get Luck() {
return this._data.getUint8(49, true);
}
set Luck(v) {
return this._data.setUint8(49, v, true);
}
get Stealth() {
return this._data.getUint8(50, true);
}
set Stealth(v) {
return this._data.setUint8(50, v, true);
}
get Attractiveness() {
return this._data.getUint8(51, true);
}
set Attractiveness(v) {
return this._data.setUint8(51, v, true);
}
get Affluence() {
return this._data.getUint8(52, true);
}
set Affluence(v) {
return this._data.setUint8(52, v, true);
}
get Notoriety() {
return this._data.getUint8(53, true);
}
set Notoriety(v) {
return this._data.setUint8(53, v, true);
}
get bytes() {
return new Uint8Array(this._ptr);
}
constructor(init = {}, ptr = undefined) {
this._size = 54;
this._ptr = ptr.buffer || new ArrayBuffer(this._size);
this._data = new DataView(this._ptr);
this._encoder = new TextEncoder();
this._decoder = new TextDecoder();
for (const key of Object.keys(init)) {
this[key] = init[key];
}
}
}
export default Entity