chat.txt 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. @start
  2. error_counter = 0;
  3. event.load("chat");
  4. event.load("player_login");
  5. event.load("player_logout");
  6. event.load("living_death");
  7. cookie_time = 0;
  8. cookie = read.item("minecraft:cookie");
  9. serverspawn = world.getServerSpawn();
  10. joinmessages = list.new();
  11. list.add(joinmessages, concat("joined Mundus Crassus."));
  12. list.add(joinmessages, concat("entered the sick world."));
  13. list.add(joinmessages, concat("is ready to discover new ores."));
  14. list.add(joinmessages, concat("turns everything upside down."));
  15. leavemeassages = list.new();
  16. list.add(leavemeassages, concat("has left Mundus Crassus."));
  17. list.add(leavemeassages, concat("has left the sick world."));
  18. list.add(leavemeassages, concat("came, saw and won."));
  19. list.add(leavemeassages, concat("faded in the face of copper."));
  20. colorcodedeath = "§9";
  21. death_prefix = "§0§lx §r";
  22. headlist = list.new();
  23. headlist2 = list.new();
  24. defaultdeaths = list.new();
  25. list.add(defaultdeaths, concat(colorcodedeath, " bled out."));
  26. list.add(defaultdeaths, concat(colorcodedeath, " wanted to die."));
  27. list.add(defaultdeaths, concat(colorcodedeath, " isn't hungry anymore."));
  28. list.add(defaultdeaths, concat(colorcodedeath, " f***ing died."));
  29. list.add(defaultdeaths, concat(colorcodedeath, " now dines with ghosts."));
  30. list.add(defaultdeaths, concat(colorcodedeath, " visits kajetan in his heaven."));
  31. list.add(defaultdeaths, concat(colorcodedeath, " is judged by kajetan (god)."));
  32. drowndeaths = list.new();
  33. list.add(drowndeaths, concat(colorcodedeath, " drowned."));
  34. list.add(drowndeaths, concat(colorcodedeath, " drank too much water."));
  35. list.add(drowndeaths, concat(colorcodedeath, " didn't grow gills fast enough."));
  36. list.add(drowndeaths, concat(colorcodedeath, " wanted to visit cthulhu."));
  37. list.add(drowndeaths, concat(colorcodedeath, " forgot they were in survival."));
  38. list.add(drowndeaths, concat(colorcodedeath, " believed they can fly."));
  39. falldeaths = list.new();
  40. list.add(falldeaths, concat(colorcodedeath, " fell victim to gravitation."));
  41. list.add(falldeaths, concat(colorcodedeath, " tripped on a banana peal."));
  42. list.add(falldeaths, concat(colorcodedeath, " jumped into the depths."));
  43. list.add(falldeaths, concat(colorcodedeath, " jumped into death."));
  44. list.add(falldeaths, concat(colorcodedeath, " forgot their wings."));
  45. list.add(falldeaths, concat(colorcodedeath, " forgot their RedBull."));
  46. firedeaths = list.new();
  47. list.add(firedeaths, concat(colorcodedeath, " looks hot today."));
  48. flydeaths = list.new();
  49. list.add(flydeaths, concat(colorcodedeath, " wanted to be a pilot."));
  50. list.add(flydeaths, concat(colorcodedeath, " is now a mashed potato."));
  51. list.add(flydeaths, concat(colorcodedeath, " returns to their nest."));
  52. list.add(flydeaths, concat(colorcodedeath, " made a crash landing."));
  53. list.add(flydeaths, concat(colorcodedeath, " needs a flight training."));
  54. list.add(flydeaths, concat(colorcodedeath, " was cast from heaven."));
  55. //andere damagecauses: fall, outOfWorld, arrow, drown (ertrinken), player, inWall, mob, magic, starve
  56. causetolist = map.new();
  57. map.add(causetolist, "fall", falldeaths);
  58. map.add(causetolist, "drown", drowndeaths);
  59. map.add(causetolist, "inFire", firedeaths);
  60. map.add(causetolist, "onFire", firedeaths);
  61. map.add(causetolist, "lava", firedeaths);
  62. map.add(causetolist, "flyIntoWall", flydeaths);
  63. map.add(causetolist, "player", list.new());
  64. setScriptVar("rank_playtime_list", list.new());
  65. online_list = players.toList();
  66. iter = list.iterator(online_list);
  67. while(hasNext(iter)) {
  68. rank.offerTimeScheduled(next(iter));
  69. }
  70. msg("dev", "§bChat §rloaded");
  71. @wait
  72. wait();
  73. if(event == "living_death") {
  74. if(!isPlayer(living_entity)) {
  75. goto("wait");
  76. }
  77. player = living_entity;
  78. }
  79. player_name = player.getName(player);
  80. nickname = player.getNickname(player);
  81. player_id = player.getId(player);
  82. //Wenn der Spieler keinen Nicknamen hat, werden die personalisierten Nachrichten geschickt, falls solche vorhanden sind
  83. if(removeFormat(nickname) == player_name) {
  84. send_personally_messages = true;
  85. } else {
  86. send_personally_messages = false;
  87. }
  88. fullname = player.getFullName(player);
  89. ignoreGoto(event);
  90. goto("wait");
  91. @player_login
  92. first_join = player.hasFirstJoin(player_id);
  93. if(first_join) {
  94. entity.teleport(player, serverspawn);
  95. msg("online", concat("§bWelcome to our sick world §e", player_name, " §b!!!"));
  96. player.setFirstJoin(player_id, true);
  97. }
  98. player.setHeadName(player);
  99. silentjoin = player.getSilentJoin(player);
  100. if(!silentjoin) {
  101. message = text.convert(player.getJoinMessage(player));
  102. if(message == null || !send_personally_messages) {
  103. message = concat("§a§l> §r", fullname, " §9", list.getIndex(joinmessages, math.random(0, list.getSize(joinmessages) - 1)));
  104. } else {
  105. message = concat("§a§l> §r", fullname, " §9", message);
  106. }
  107. msg("online", message);
  108. }
  109. player_loc = entity.getLocation(player);
  110. //Inventory
  111. inv.loadFromPlayer(player, player, loc.getWorld(player_loc));
  112. //Keks geben, wenn man als einziger Spieler auf den Server joint und im Survival-Mode ist und der letzte Keks seit 5 Minuten vergeben wurde
  113. if(players.getAmount() == 1) {
  114. if(!loc.isInGamesWorld(player_loc)) {
  115. if(player.isSurvival(player)) {
  116. now_time = time.getMillis();
  117. if(now_time - cookie_time > 300000) {
  118. cookie_time = now_time;
  119. msg(player, "§dHere is a cookie for you :D");
  120. player.safeGiveItem(player, cookie);
  121. }
  122. }
  123. }
  124. }
  125. player.setTabName(player);
  126. player.greet(player);
  127. player.showDefaultStacks(player);
  128. stacks.setActive(player, true);
  129. rank.offerTimeScheduled(player);
  130. displayMoney(player, getMoney(player));
  131. //send marvinius and sirterence amount of errors
  132. if(player_id == 2 || player_id == 35) {
  133. error_size = error.getSize();
  134. if(error_size > 0) {
  135. msg.prefix(player, "§cError", concat("There are ", text.number(error_size), " errors."));
  136. }
  137. }
  138. goto("wait");
  139. @player_logout
  140. message = text.convert(player.getLeaveMessage(player));
  141. if(message == null || !send_personally_messages) {
  142. message = concat("§c§l> §r", fullname, " §9", list.getIndex(leavemeassages, math.random(0, list.getSize(leavemeassages) - 1)));
  143. } else {
  144. message = concat("§c§l> §r", fullname, " §9", message);
  145. }
  146. msg("online", message);
  147. inv.saveForPlayer(player, player, loc.getWorld(entity.getLocation(player)));
  148. player.clearBackPos(player);
  149. rank.removeTimeOffert(player);
  150. goto("wait");
  151. @chat
  152. if(text.startsWith(message, "%", 0)) {
  153. cancel = true;
  154. goto("wait");
  155. }
  156. if(text.startsWith(message, "7", 0)) {
  157. length = text.length(message);
  158. space_index = read.number(text.indexOf(message, " ", 1));
  159. if(length > 1 && space_index == -1 || length > 1 && space_index > 1) {
  160. cancel = true;
  161. if(space_index == -1) {
  162. word = text.subString(message, 1, length);
  163. } else {
  164. word = text.subString(message, 1, space_index);
  165. }
  166. msg.prefix(player, "§6Commands", concat("You meant /", word, "?"));
  167. goto("wait");
  168. }
  169. }
  170. cancel = true;
  171. if(player.isMuted(player)) {
  172. //minigames check this for themselves. cause: global mute for e.g. specs/ghosts, but spec/ghost chat should be possible without "you are muted" message
  173. if(!player.hasMinigame(player)) {
  174. msg.prefix(player, "§6Commands", "You are muted.");
  175. }
  176. goto("wait");
  177. }
  178. if(perm.has(player, "color")) {
  179. message = text.replace(message, "&", "§");
  180. }
  181. if(text.startsWith(message, "https://", 0)) {
  182. message = text.link(message, message);
  183. }
  184. msg.chat(player, message);
  185. goto("wait");
  186. @living_death
  187. world = loc.getWorld(entity.getLocation(player));
  188. world_name = world.getName(world);
  189. if(world.isCreativeName(world_name)) {
  190. goto("wait");
  191. }
  192. if(world.isGamesName(world_name)) {
  193. goto("wait");
  194. }
  195. damage_type = damage.getType(damage_source);
  196. list = map.getOrDefault(causetolist, damage_type, defaultdeaths);
  197. if(damage_type == "player") {
  198. killer = player.getFromDamageSource(damage_source);
  199. killer_name = player.getName(killer);
  200. item = living.getEquip(killer, "hand");
  201. if(item.hasName(item)) {
  202. message1 = concat(death_prefix, fullname, colorcodedeath, " killed by ", killer_name, " with ");
  203. message2 = item.getFullText(item);
  204. message = text.concat2(message1, message2);
  205. } else {
  206. list.clear(list);
  207. list.add(list, concat(death_prefix, fullname, colorcodedeath, " got their last honour from ", killer_name, "."));
  208. list.add(list, concat(death_prefix, fullname, colorcodedeath, " died by ", killer_name, "'s hand."));
  209. list.add(list, concat(death_prefix, fullname, colorcodedeath, " was killed by ", killer_name, "."));
  210. list.add(list, concat(death_prefix, fullname, colorcodedeath, " lost a bet to ", killer_name, "."));
  211. message = list.getIndex(list, math.random(0, list.getSize(list) - 1));
  212. }
  213. } else {
  214. message = concat(death_prefix, fullname, list.getIndex(list, math.random(0, list.getSize(list) - 1)));
  215. }
  216. msg.survival(message);
  217. msg.creative(message);
  218. msg.story(message);
  219. goto("wait");
  220. function player.greet(player) {
  221. player_name = player.getName(player);
  222. title.reset(player);
  223. title.setSub(player, concat("§cNice to see you §6", player_name));
  224. title.send(player, "");
  225. list.add($headlist, player.getUuid(player));
  226. sgoto(40, "showHead");
  227. }
  228. @showHead
  229. p_uuid = list.getIndex(headlist, 0);
  230. list.removeIndex(headlist, 0);
  231. p_name = player.getName(p_uuid);
  232. p = player.get(p_uuid);
  233. head.add(p, 0, p_name, 0.43, 0.2, 0.14, 0.25);
  234. list.add($headlist2, p);
  235. sgoto(80, "removeHead");
  236. goto("wait");
  237. @removeHead
  238. p = list.getIndex(headlist2, 0);
  239. list.removeIndex(headlist2, 0);
  240. head.remove(p, 0);
  241. goto("wait");
  242. function rank.removeTimeOffert(player) {
  243. player_uuid = player.getUuid(player);
  244. list = getScriptVar("rank_playtime_list");
  245. for(i = 0; i < list.getSize(list); i++) {
  246. a = list.getIndex(list, i);
  247. if(player_uuid == a[0]) {
  248. list.removeIndex(list, i);
  249. return;
  250. }
  251. }
  252. }
  253. function rank.offerTimeScheduled(player) {
  254. list = getScriptVar("rank_playtime_list");
  255. a = array.new(2);
  256. a[0] = player.getUuid(player);
  257. playtime = playtime.getPlayerTotal(player);
  258. if(playtime < 1200) {
  259. diff = 1200 - playtime;
  260. a[1] = "rank.newcomer";
  261. } elseif(playtime < 6000) {
  262. diff = 6000 - playtime;
  263. a[1] = "rank.frequenter";
  264. } elseif(playtime < 42000) {
  265. diff = 42000 - playtime;
  266. a[1] = "rank.legend";
  267. } else {
  268. return;
  269. }
  270. if(diff > 1440) {
  271. return;
  272. }
  273. list.add(list, a);
  274. sgoto(diff * 60 * 20, "offerTimeRank");
  275. }
  276. @offerTimeRank
  277. list = getScriptVar("rank_playtime_list");
  278. if(list.getSize(list) == 0) {
  279. goto("wait");
  280. }
  281. a = list.getIndex(list, 0);
  282. list.removeIndex(list, 0);
  283. player_uuid = a[0];
  284. tech_name = a[1];
  285. player = player.get(player_uuid);
  286. if(player != null) {
  287. offerRank(player, tech_name);
  288. }
  289. goto("wait");