chat.txt 10 KB

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