chat.txt 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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 he was in survival."));
  38. list.add(drowndeaths, concat(colorcodedeath, " believed he 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. //andere damagecauses: fall, outOfWorld, arrow, drown (ertrinken), player, inWall, mob, magic, starve
  49. causetolist = map.new();
  50. map.add(causetolist, "fall", falldeaths);
  51. map.add(causetolist, "drown", drowndeaths);
  52. map.add(causetolist, "inFire", firedeaths);
  53. map.add(causetolist, "onFire", firedeaths);
  54. map.add(causetolist, "lava", firedeaths);
  55. map.add(causetolist, "player", list.new());
  56. setScriptVar("rank_playtime_list", list.new());
  57. online_list = players.toList();
  58. iter = list.iterator(online_list);
  59. while(hasNext(iter)) {
  60. rank.offerTimeScheduled(next(iter));
  61. }
  62. msg("dev", "§bChat §rloaded");
  63. @wait
  64. wait();
  65. if(event == "living_death") {
  66. if(!isPlayer(living_entity)) {
  67. goto("wait");
  68. }
  69. player = living_entity;
  70. }
  71. player_name = player.getName(player);
  72. nickname = player.getNickname(player);
  73. player_id = player.getId(player);
  74. //Wenn der Spieler keinen Nicknamen hat, werden die personalisierten Nachrichten geschickt, falls solche vorhanden sind
  75. if(removeFormat(nickname) == player_name) {
  76. send_personally_messages = true;
  77. } else {
  78. send_personally_messages = false;
  79. }
  80. fullname = player.getFullName(player);
  81. ignoreGoto(event);
  82. goto("wait");
  83. @player_login
  84. first_join = player.hasFirstJoin(player_id);
  85. if(first_join) {
  86. entity.teleport(player, serverspawn);
  87. msg("online", concat("§bWelcome to our sick world §e", player_name, " §b!!!"));
  88. player.setFirstJoin(player_id, true);
  89. }
  90. player.setHeadName(player);
  91. silentjoin = player.getSilentJoin(player);
  92. if(!silentjoin) {
  93. message = text.convert(player.getJoinMessage(player));
  94. if(message == null || !send_personally_messages) {
  95. message = concat("§a§l> §r", fullname, " §9", list.getIndex(joinmessages, math.random(0, list.getSize(joinmessages) - 1)));
  96. } else {
  97. message = concat("§a§l> §r", fullname, " §9", message);
  98. }
  99. msg("online", message);
  100. }
  101. player_loc = entity.getLocation(player);
  102. //Inventory
  103. inv.loadFromPlayer(player, player, loc.getWorld(player_loc));
  104. //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
  105. if(players.getAmount() == 1) {
  106. if(!loc.isInGamesWorld(player_loc)) {
  107. if(player.isSurvival(player)) {
  108. now_time = time.getMillis();
  109. if(now_time - cookie_time > 300000) {
  110. cookie_time = now_time;
  111. msg(player, "§dHere is a cookie for you :D");
  112. player.safeGiveItem(player, cookie);
  113. }
  114. }
  115. }
  116. }
  117. player.setTabName(player);
  118. player.greet(player);
  119. player.showDefaultStacks(player);
  120. stacks.setActive(player, true);
  121. rank.offerTimeScheduled(player);
  122. displayMoney(player, getMoney(player));
  123. //send marvinius and sirterence amount of errors
  124. if(player_id == 2 || player_id == 35) {
  125. error_size = error.getSize();
  126. if(error_size > 0) {
  127. msg.prefix(player, "§cError", concat("There are ", text.number(error_size), " errors."));
  128. }
  129. }
  130. goto("wait");
  131. @player_logout
  132. message = text.convert(player.getLeaveMessage(player));
  133. if(message == null || !send_personally_messages) {
  134. message = concat("§c§l> §r", fullname, " §9", list.getIndex(leavemeassages, math.random(0, list.getSize(leavemeassages) - 1)));
  135. } else {
  136. message = concat("§c§l> §r", fullname, " §9", message);
  137. }
  138. msg("online", message);
  139. inv.saveForPlayer(player, player, loc.getWorld(entity.getLocation(player)));
  140. player.clearBackPos(player);
  141. rank.removeTimeOffert(player);
  142. goto("wait");
  143. @chat
  144. if(text.startsWith(message, "%", 0)) {
  145. cancel = true;
  146. goto("wait");
  147. }
  148. if(text.startsWith(message, "7", 0)) {
  149. length = text.length(message);
  150. space_index = read.number(text.indexOf(message, " ", 1));
  151. if(length > 1 && space_index == -1 || length > 1 && space_index > 1) {
  152. cancel = true;
  153. if(space_index == -1) {
  154. word = text.subString(message, 1, length);
  155. } else {
  156. word = text.subString(message, 1, space_index);
  157. }
  158. msg.prefix(player, "§6Commands", concat("You meant /", word, "?"));
  159. goto("wait");
  160. }
  161. }
  162. cancel = true;
  163. if(player.isMuted(player)) {
  164. //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
  165. if(!player.hasMinigame(player)) {
  166. msg.prefix(player, "§6Commands", "You are muted.");
  167. }
  168. goto("wait");
  169. }
  170. if(perm.has(player, "color")) {
  171. message = text.replace(message, "&", "§");
  172. }
  173. if(text.startsWith(message, "https://", 0)) {
  174. message = text.link(message, message);
  175. }
  176. msg.online(player, message);
  177. goto("wait");
  178. @living_death
  179. world = loc.getWorld(entity.getLocation(player));
  180. world_name = world.getName(world);
  181. if(world.isCreativeName(world_name)) {
  182. goto("wait");
  183. }
  184. damage_type = damage.getType(damage_source);
  185. list = map.getOrDefault(causetolist, damage_type, defaultdeaths);
  186. if(damage_type == "player") {
  187. killer = player.getFromDamageSource(damage_source);
  188. killer_name = player.getName(killer);
  189. item = living.getEquip(killer, "hand");
  190. if(item.hasName(item)) {
  191. message1 = concat(death_prefix, fullname, colorcodedeath, " killed by ", killer_name, " with ");
  192. message2 = item.getFullText(item);
  193. message = text.concat2(message1, message2);
  194. } else {
  195. list.clear(list);
  196. list.add(list, concat(death_prefix, fullname, colorcodedeath, " got their last honour from ", killer_name, "."));
  197. list.add(list, concat(death_prefix, fullname, colorcodedeath, " died by ", killer_name, "'s hand."));
  198. list.add(list, concat(death_prefix, fullname, colorcodedeath, " was killed by ", killer_name, "."));
  199. list.add(list, concat(death_prefix, fullname, colorcodedeath, " lost a bet to ", killer_name, "."));
  200. message = list.getIndex(list, math.random(0, list.getSize(list) - 1));
  201. }
  202. } else {
  203. message = concat(death_prefix, fullname, list.getIndex(list, math.random(0, list.getSize(list) - 1)));
  204. }
  205. msg.survival(message);
  206. msg.creative(message);
  207. msg.story(message);
  208. goto("wait");
  209. function player.greet(player) {
  210. player_name = player.getName(player);
  211. title.reset(player);
  212. title.setSub(player, concat("§cNice to see you §6", player_name));
  213. title.send(player, "");
  214. list.add($headlist, player.getUuid(player));
  215. sgoto(40, "showHead");
  216. }
  217. @showHead
  218. p_uuid = list.getIndex(headlist, 0);
  219. list.removeIndex(headlist, 0);
  220. p_name = player.getName(p_uuid);
  221. p = player.get(p_uuid);
  222. head.add(p, 0, p_name, 0.43, 0.2, 0.14, 0.25);
  223. list.add($headlist2, p);
  224. sgoto(80, "removeHead");
  225. goto("wait");
  226. @removeHead
  227. p = list.getIndex(headlist2, 0);
  228. list.removeIndex(headlist2, 0);
  229. head.remove(p, 0);
  230. goto("wait");
  231. function rank.removeTimeOffert(player) {
  232. player_uuid = player.getUuid(player);
  233. list = getScriptVar("rank_playtime_list");
  234. for(i = 0; i < list.getSize(list); i++) {
  235. a = list.getIndex(list, i);
  236. if(player_uuid == a[0]) {
  237. list.removeIndex(list, i);
  238. return;
  239. }
  240. }
  241. }
  242. function rank.offerTimeScheduled(player) {
  243. list = getScriptVar("rank_playtime_list");
  244. a = array.new(2);
  245. a[0] = player.getUuid(player);
  246. playtime = playtime.getPlayerTotal(player);
  247. if(playtime < 1200) {
  248. diff = 1200 - playtime;
  249. a[1] = "rank.newcomer";
  250. } elseif(playtime < 6000) {
  251. diff = 6000 - playtime;
  252. a[1] = "rank.frequenter";
  253. } elseif(playtime < 42000) {
  254. diff = 42000 - playtime;
  255. a[1] = "rank.legend";
  256. } else {
  257. return;
  258. }
  259. if(diff > 1440) {
  260. return;
  261. }
  262. list.add(list, a);
  263. sgoto(diff * 60 * 20, "offerTimeRank");
  264. }
  265. @offerTimeRank
  266. list = getScriptVar("rank_playtime_list");
  267. if(list.getSize(list) == 0) {
  268. goto("wait");
  269. }
  270. a = list.getIndex(list, 0);
  271. list.removeIndex(list, 0);
  272. player_uuid = a[0];
  273. tech_name = a[1];
  274. player = player.get(player_uuid);
  275. if(player != null) {
  276. offerRank(player, tech_name);
  277. }
  278. goto("wait");