Risenio лет назад: 7
Родитель
Сommit
4d6511ecce
3 измененных файлов с 64 добавлено и 28 удалено
  1. 4 0
      README.md
  2. 57 25
      lib/index.js
  3. 3 3
      manifest.json

+ 4 - 0
README.md

@@ -1,6 +1,10 @@
 # Fps Utils
   Written for tera-proxy, a free script filled with features dedicated to improve your fps, in the open world, in dungeons and in battlegrounds.
 
+## NOTE FOR CLASSIC SERVER.
+  - The module should function just fine, however the GUI that the module uses (welcome window) doesn't support clicking, so this been said. You've to write the commands by hand, You may still can open the GUI however it will be just a visual, nothing can be clicked inside.
+  - I've tested all it's functionality, All went good. If you found any bug/error/issue, please inform me, thank you.
+
 ## How to use.
   * Put the script folder "fps-utils" into the `mods` folder.
   * Log the game using the proxy.

+ 57 - 25
lib/index.js

@@ -2,6 +2,8 @@
 /* global __dirname */
 
 module.exports = function FpsUtils(mod) {
+	// ~~~ * Data * ~~~ \\
+
 	const NotCP = typeof global.TeraProxy === 'undefined';
 	const NpcData = require("./data/npcData.json"), SkillData = require("./data/skillString.json");
 	const BnzC = '#BC8F8F', SlvC = '#9A9A9A', GldC = '#DAA520', PnkC = '#FFB7C5', HPkC = '#FF69B4', CPKC = '#ED5D92', RedC = '#FE6F5E', GrnC = '#4DE19C', LPrC = '#E0B0FF', PrpC = '#9966CC', LBlC = '#4DDCE1', BluC = '#436EEE', DBlC = '#5BC0BE', HBlC = '#08B3E5', GryC = '#778899', YlwC = '#C0B94D';
@@ -11,6 +13,8 @@ module.exports = function FpsUtils(mod) {
 	const SpamAchIds = [6, 51, 377, 391, 466, 467, 468, 469, 470, 471, 472, 473, 476, 611, 1408, 1744, 1745, 1769, 1770, 1771, 1942, 1943, 1952, 1992, 2032, 2033, 2036, 2037, 2038, 2057, 2062, 2071, 2078, 2081, 2082, 2083, 2084, 2088, 2089, 2095, 6005, 9817, 28723, 28724, 28725, 28726, 28727, 28728, 28729, 28730, 28731, 28732, 28733, 28734, 28735, 28736, 510005, 510012, 510019, 510026, 510027, 510033, 510034, 510035, 510036, 510037, 510038, 510039, 510040, 510041, 520029, 520030, 520032, 520033, 520034, 520035, 520048, 520049, 520050, 520051, 525000, 525001, 525002, 525003, 525004, 525005, 525006, 525007, 525008, 525009, 525010, 525011, 525012, 525013, 525014, 525015, 525016, 525017, 525018, 525019, 525020, 525021, 525022, 525023, 525024, 525025, 5010000];
 	const ImportantAbns = [90440009, 90442106, 90442110, 90442111, 90442112, 90442113, 90442114, 90442400, 90442401, 90442402, 90442403, 90442404, 90442405, 90442406, 90442407, 90442408, 90442502, 78200123, 78200126, 78200130, 78200131, 78200161, 78200162, 78200203, 78200204, 78200205, 78200209, 78200234, 78200235, 78200236];
 
+	// ~~~ * Variables * ~~~ \\
+
 	let MyGameId,
 		MyName,
 		MyPlayerId,
@@ -205,6 +209,7 @@ module.exports = function FpsUtils(mod) {
 				break;
 			case "help":
 				gui.parse([
+					{ text: mod.majorPatchVersion < 79 ? `<font color="${PnkC}" size="+15"><p align="right">The GUI is only visual in classic server, buttons doesn't work, thanks for understanding.</p></font><br>` : '' },
 					{ text: `<font color="${PrpC}" size="+24"><p align="right">MAIN MENU</p></font><br>`, command: "fps gui" },
 					{ text: `<font size="20"><font color="${LBlC}">Command</font>            <font color="${SlvC}">Arg(s)</font>                 <font color="${CPKC}">Example</font><br>` },
 					{ text: `<font color="${HBlC}">gui ^ g</font>                      <font color="${DBlC}">N/A</font>                    <font color="${HPkC}">!fps gui</font><br>` },
@@ -235,6 +240,7 @@ module.exports = function FpsUtils(mod) {
 				break;
 			default:
 				gui.parse([
+					{ text: mod.majorPatchVersion < 79 ? `<font color="${PnkC}" size="+15"><p align="right">The GUI is only visual in classic server, buttons doesn't work, thanks for understanding.</p></font><br>` : '' },
 					{ text: `<font color="${PrpC}" size="+15"><p align="right">REFRESH</p></font><br>`, command: "fps gui" },
 					{ text: `<font color="${YlwC}" size="+20">Modes:</font>` }, { text: "&#09;&#09;" },
 					{ text: `<font color="${mod.settings.Mode === 0 ? GrnC : RedC}" size="+18">[Mode 0]</font>`, command: "fps mode 0;fps gui" }, { text: "&nbsp;&nbsp;&nbsp;&nbsp;" },
@@ -478,18 +484,27 @@ module.exports = function FpsUtils(mod) {
 
 	// ~~~ * Functions * ~~~ \\
 
-	function EqGid(xg) {
-		return (xg === MyGameId)
-	}
-
 	function ModifyUserAppearance(event) {
 		let modified = false;
 
 		if (mod.settings.ShowStyle) {
-			event.ShowStyle = event.showFace = false;
-			event.weaponEnchant = event.body = event.hand = event.feet = event.underwear = event.head = event.face = event.weapon = event.title = event.underwearDye = event.styleBackDye = event.styleHeadDye = event.styleFaceDye = event.styleBodyDye = event.weaponEnchant = event.styleHead = event.styleFace = event.styleBack = event.styleWeapon = event.styleBody = event.styleFootprint = 0;
+			event.weapon = event.body = event.hand = event.feet = event.underwear = event.head = event.face = 0;
+			if (event.mount) event.mount = 16; //231; The mount 231 doesn't exist in classic server.
+			if (mod.settings.Hideguildlogos) event.guildLogoId = 0;
+			if (mod.majorPatchVersion >= 79) event.title = 0; //!classic
+			// event.weaponModel = event.bodyModel = event.handModel = event.feetModel // TODO;
+			event.weaponDye = event.bodyDye = event.handDye = event.feetDye = event.weaponEnchant = 0;
+			event.showFace = false;
+			event.styleHead = event.styleFace = event.styleBack = event.styleWeapon = event.styleBody = 0;
+			if (mod.majorPatchVersion >= 79) event.underwearDye = event.styleBackDye = event.styleHeadDye = event.styleFaceDye = 0; //!classic
+			event.showStyle = false;
+			if (mod.majorPatchVersion >= 79) { //!classic
+				event.styleFootprint = event.styleHeadScale = event.styleFaceScale = event.styleBackScale = 0;
+				event.usedStyleHeadTransform = false;
+			}
+			event.styleBodyDye = 0;
 			event.icons = [];
-			if (event.mount) event.mount = 231;
+
 			modified = true;
 		}
 
@@ -524,15 +539,19 @@ module.exports = function FpsUtils(mod) {
 		}
 
 		if (mod.settings.Hit_Damage && (EqGid(event.source) || EqGid(event.owner) || UserNPCs.includes(event.templateId) && event.skill.huntingZoneId === 1023)) {
-			event.id = event.damage = event.type = event.noctEffect = event.reaction.id = 0;
-			event.crit = event.stackExplode = event.blocked = false;
+			event.id = event.type = event.noctEffect = event.reaction.skill.id = 0;
+			if (NotCP) event.damage = 0; else event.value = 0;
+			event.crit = event.stackExplode = false;
+			if (mod.majorPatchVersion >= 79) if (NotCP) event.blocked = false; else event.superArmor = false; //!classic
 
 			modified = true;
 		}
 
 		if (mod.settings.Hit_All) {
-			event.id = event.damage = event.type = event.noctEffect = event.reaction.id = 0;
-			event.crit = event.stackExplode = event.blocked = false;
+			event.id = event.type = event.noctEffect = event.reaction.skill.id = 0;
+			if (NotCP) event.damage = 0; else event.value = 0;
+			event.crit = event.stackExplode = false;
+			if (mod.majorPatchVersion >= 79) if (NotCP) event.blocked = false; else event.superArmor = false; //!classic
 			event.target = 0;
 
 			modified = true;
@@ -543,7 +562,6 @@ module.exports = function FpsUtils(mod) {
 
 	function NpcBCheck(event) {
 		let blocked = false;
-
 		//if (mod.settings.ShowStyle) event.repairable = false;
 
 		if (mod.settings.HideBlacklistedNpcs) {
@@ -586,6 +604,10 @@ module.exports = function FpsUtils(mod) {
 		return blocked;
 	}
 
+	function EqGid(xg) {
+		return (xg === MyGameId)
+	}
+
 	function ClassID(m) {
 		return (m % 100)
 	}
@@ -595,10 +617,10 @@ module.exports = function FpsUtils(mod) {
 	}
 
 	function UpdateUserLoc(event) {
-		mod.toClient('S_USER_LOCATION', 5, { gameId: event.gameId, loc: event.loc, dest: event.loc, w: event.w, speed: 300, type: 7 });
+		mod.toClient('S_USER_LOCATION', 5, { gameId: event.gameId, loc: event.loc, w: event.w, speed: 300, dest: event.loc, type: 7 });
 	}
 
-	// ~~~* Hook functions * ~~~ \\
+	// ~~~ * Hook Functions * ~~~ \\
 
 	function sLogin(event) {
 		LastState = event.name === MyName ? LastState : null;
@@ -640,7 +662,7 @@ module.exports = function FpsUtils(mod) {
 		SUsers[event.gameId].mount = event.id
 		if (HUsers[event.gameId]) HUsers[event.gameId].mount = event.id;
 		if (mod.settings.ShowStyle) {
-			event.id = 231
+			event.id = 16; //231; 
 			return true;
 		}
 	}
@@ -933,6 +955,15 @@ module.exports = function FpsUtils(mod) {
 	const Last_Hook = { order: 100010 }
 	const Last_Hookfn = { order: 100010, filter: { fake: null } };
 
+	if (mod.majorPatchVersion >= 79) {
+		mod.hook('S_DEAD_LOCATION', 2, sDeadLocation)
+		mod.hook('S_USER_MOVETYPE', 'raw', Last_Hook, sUserMoveType)
+		mod.hook('S_UNICAST_TRANSFORM_DATA', 5, Last_Hook, sUnicastTransformData)
+		mod.hook('S_USER_APPEARANCE_CHANGE', 1, Last_Hookfn, sUserAppearanceChange)
+		mod.hook('S_USER_EXTERNAL_CHANGE', 7, Last_Hookfn, sUserExternalChange)
+		mod.hook('S_FONT_SWAP_INFO', 'raw', sFontSwapInfo)
+	}
+
 	mod.hook('S_LOGIN', 12, sLogin)
 	mod.hook('S_LOAD_TOPO', 'raw', sLoadTopo)
 	mod.hook('S_LEAVE_PARTY', 'raw', sLeaveParty)
@@ -956,12 +987,12 @@ module.exports = function FpsUtils(mod) {
 	mod.hook('S_DESPAWN_USER', 3, Last_Hook, sDespawnUser)
 	mod.hook('S_USER_LOCATION', 5, sUserLocation)
 	mod.hook('S_USER_STATUS', 3, sUserStatus)
-	mod.hook('S_DEAD_LOCATION', 2, sDeadLocation)
-	mod.hook('S_USER_MOVETYPE', 'raw', Last_Hook, sUserMoveType)
+	//'S_DEAD_LOCATION
+	//'S_USER_MOVETYPE'
 	mod.hook('S_PARTY_MEMBER_LIST', 7, sPartyMemberList)
-	mod.hook('S_USER_APPEARANCE_CHANGE', 1, Last_Hookfn, sUserAppearanceChange)
-	mod.hook('S_USER_EXTERNAL_CHANGE', 7, Last_Hookfn, sUserExternalChange)
-	mod.hook('S_UNICAST_TRANSFORM_DATA', 5, Last_Hook, sUnicastTransformData)
+	//'S_USER_APPEARANCE_CHANGE
+	//'S_USER_EXTERNAL_CHANGE' meh, I can't figure out this definition for classic sth is messed up dunno why. :\
+	//'S_UNICAST_TRANSFORM_DATA'
 
 	mod.hook('S_SPAWN_NPC', 11, sSpawnNpc)
 	mod.hook('S_DESPAWN_NPC', 3, sDespawnNpc)
@@ -980,9 +1011,9 @@ module.exports = function FpsUtils(mod) {
 	mod.hook('S_START_USER_PROJECTILE', 9, Last_Hook, sStartUserProjectile)
 	mod.hook('S_PLAYER_CHANGE_MP', 1, sPlayerChangeMp)
 	mod.hook('S_CREATURE_CHANGE_HP', 6, sCreatureChangeHp)
-	mod.hook('S_EACH_SKILL_RESULT', 12, Last_Hook, sEachSkillResult)
+	mod.hook('S_EACH_SKILL_RESULT', NotCP ? 12 : 13, Last_Hook, sEachSkillResult)
 	mod.hook('S_SPAWN_DROPITEM', 6, sSpawnDropItem)
-	mod.hook('S_FONT_SWAP_INFO', 'raw', sFontSwapInfo)
+	//'S_FONT_SWAP_INFO'
 
 	// ~~~ * Commands * ~~~ \\
 
@@ -1068,9 +1099,7 @@ module.exports = function FpsUtils(mod) {
 									if (mod.settings.ClassesData[i].name === arg) mod.settings.ClassesBlacklist.push(arg);
 									if (mod.settings.ClassesData[i].role.includes(arg)) mod.settings.RolesBlacklist.push(arg);
 									let classtohide = mod.settings.ClassesData[i].model;
-									for (let i in SUsers) {
-										if (ClassID(SUsers[i].templateId) === classtohide) HideSpecificPlayer(SUsers[i].name);
-									}
+									for (let i in SUsers) { if (ClassID(SUsers[i].templateId) === classtohide) HideSpecificPlayer(SUsers[i].name); }
 								}
 							}
 							Msg(`Class/Role ${arg} <font color="${GrnC}">Hidden</font>.`);
@@ -1356,15 +1385,18 @@ module.exports = function FpsUtils(mod) {
 						mod.toServer('C_REQUEST_CONTRACT', 1, { type: 8 });
 						break;
 					case "talent": case "talents":
+						if (mod.majorPatchVersion < 79) return;	//classic
 						mod.toServer('C_REQUEST_CONTRACT', 1, { type: 77 });
 						break;
 					case "broker":
 						mod.toClient('S_NPC_MENU_SELECT', 1, { type: 28 });
 						break;
 					case "dress": case "dressingroom":
+						if (mod.majorPatchVersion < 79) return;	//classic
 						mod.toServer('C_REQUEST_CONTRACT', 1, { type: 76 });
 						break;
 					case "hat": case "hatrestyle":
+						if (mod.majorPatchVersion < 79) return;	//classic
 						mod.toServer('C_REQUEST_CONTRACT', 1, { type: 90 });
 						break;
 					case "lobby":

+ 3 - 3
manifest.json

@@ -1,9 +1,9 @@
 {
     "files": {
-        "README.md": "d460498a2503b6857f0faed356b8f06cf4108ae863d022e361f6762877966837",
+        "README.md": "422606400e058085470beceaa8a73a63255ce054764d85a09d572a9e87889ce3",
         "lib/data/npcData.json": "d3e7b59617ef841447567d69b074aa2dd6958eabb1a231c5821ffa7165daeac6",
         "lib/data/skillString.json": "9d69876fea0be8e6ac5dd43b3fc74ea023f6b8a6145384f8f780dd977045d8ef",
-        "lib/index.js": "f504d610bea876d47d8d189cb7e0baa7609d66253125dec8e43d833e82cf8e1a",
+        "lib/index.js": "5768099702e67546adf9e4389eb0316b99895ae7bdb48b4adf6a58d573fc5b15",
         "lib/setting_migration.js": "79e83252ce6e3a7ca75c0b4aab59007d556044f279aeb87269d15b3351528f6c",
         "module.json": "96e03571c9b6e814679fe68468cbfcf8522234966091390882cd577b5a101c5c",
         "package.json": "da64d8c0f2201c8c9cc82dd9fffa3e6d92d4e67870eb02efaece83481a6304ed"
@@ -29,7 +29,7 @@
         "S_DEAD_LOCATION": 2,
         "S_DESPAWN_NPC": 3,
         "S_DESPAWN_USER": 3,
-        "S_EACH_SKILL_RESULT": 12,
+        "S_EACH_SKILL_RESULT": [12,13],
         "S_EXIT": 3,
         "S_FEARMOVE_END": 1,
         "S_FEARMOVE_STAGE": 1,