1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107 |
- function guild.isSame(spieler1, spieler2) {
- if(isPlayer(spieler1)) { //player
- id1 = guild.getId(spieler1);
- } else { //player_name
- p = read.player(spieler1);
- if(p != null) {
- id1 = guild.getId(p);
- } else {
- id1 = guild.getIdFromDatabase(player.getId(player.getUuid(spieler1)));
- }
- }
- if(isPlayer(spieler2)) { //player
- id2 = guild.getId(spieler2);
- } else { //player_name
- p = read.player(spieler2);
- if(p != null) {
- id2 = guild.getId(p);
- } else {
- id2 = guild.getIdFromDatabase(player.getId(player.getUuid(spieler2)));
- }
- }
- return id1 == id2;
- }
- function getPlayerId(unknown) { //Wenn die Eingabe ungewiss ist, und man fix eine Player_Id haben möchte
- if(isPlayer(unknown)) { //player
- player_id = player.getId(unknown);
- } elseif(isDouble(unknown)) { //player_id
- player_id = unknown;
- } elseif(text.class(unknown) == "String") { //player_name
- player_id = player.getId(player.getUuid(unknown));
- } else { //uuid
- player_id = player.getId(unknown);
- }
- return player_id;
- }
- function displaygold(player, gold) {
- display.add(player, 40, "#23-1- §e", text.number(gold));
- }
- function displayclass(player, class) {
- display.add(player, 41, "§y", class);
- }
- function displaylevel(player, level) {
- display.add(player, 42, "Stufe §a", text.number(level));
- }
- function getMaxHealth(class, level) {
- if(class == "Jäger") {
- max_health = 670 + 10 * level;
- } elseif(class == "Schurke") {
- max_health = 581 + 9 * level;
- } elseif(class == "Krieger") {
- max_health = 924 + 16 * level;
- } else {
- max_health = 200;
- }
- return max_health;
- }
- function getGildenHealth(health, max_health) {
- return health * max_health / 20;
- }
- function displayHealth(player) {
- health = entity.getHealth(player);
- class = guild.getClass(player);
- level = guild.getLevel(player);
- max_health = getMaxHealth(class, level);
- gilden_health = getGildenHealth(health, max_health);
- setHeadName(player);
- display.add(player, 43, "#28-1- ", text.number(math.round(gilden_health)), "/", text.number(math.round(max_health)));
- }
- function displaymana(player) {
- display.add(player, 44, "#27-1- ", text.number(getManaAtm(player)), "/", text.number(getManaMax(player)));
- }
- function displayxp(player, level, xp) {
- if(level == 100) {
- display.add(player, 45, "#26-1- MAX");
- } else {
- display.add(player, 45, "#26-1- ", text.number(xp), "/", text.number(getXpForNextlevel(level)));
- }
- }
- function addNewGuild(gilden_id, g_type, gold_delay, gold, name, block_world, block_x, block_y, block_z, safetime, plot_id, share_xp, share_gold, elo, tag) {
- stmt = databank.prepare("INSERT INTO gilden (gilden_id, g_type, gold_delay, gold, name, block_world, block_x, block_y, block_z, safetime, plot_id, share_xp, share_gold, elo, tag) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
- databank.setInt(stmt, 1, gilden_id);
- databank.setInt(stmt, 2, g_type);
- databank.setInt(stmt, 3, gold_delay);
- databank.setInt(stmt, 4, gold);
- databank.setString(stmt, 5, name);
- databank.setString(stmt, 6, block_world);
- databank.setInt(stmt, 7, block_x);
- databank.setInt(stmt, 8, block_y);
- databank.setInt(stmt, 9, block_z);
- databank.setLong(stmt, 10, safetime);
- databank.setInt(stmt, 11, plot_id);
- databank.setInt(stmt, 12, share_xp);
- databank.setInt(stmt, 13, share_gold);
- databank.setInt(stmt, 14, elo);
- databank.setString(stmt, 15, tag);
- databank.workerExecute(stmt);
- }
- function deleteGuildFromData(gilden_id) {
- stmt = databank.prepare("DELETE FROM gilden WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- databank.workerExecute(stmt);
- }
- function deleteGuild(gilden_id) {
- //Gildenblock und Grundstück entfernen
- gildenblockloc = getGuildBlock(gilden_id);
- removeGuildBlockArea(gildenblockloc);
- block.set(gildenblockloc, "minecraft:air");
- plot = getGuildPlot(gilden_id);
- removePlot(plot, $gpvpworld);
- removeMoveArea(gilden_id);
- //Gilde löschen
- deleteGuildFromData(gilden_id);
- }
- function setGoldDelay(gilden_id, gold_delay) {
- stmt = databank.prepare("UPDATE gilden SET gold_delay = ? WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gold_delay);
- databank.setInt(stmt, 2, gilden_id);
- databank.workerExecute(stmt);
- }
- function setGuildGold(gilden_id, gold) {
- stmt = databank.prepare("UPDATE gilden SET gold = ? WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gold);
- databank.setInt(stmt, 2, gilden_id);
- databank.workerExecute(stmt);
- }
- function setGuildName(gilden_id, name) {
- stmt = databank.prepare("UPDATE gilden SET name = ? WHERE gilden_id = ?;");
- databank.setString(stmt, 1, name);
- databank.setInt(stmt, 2, gilden_id);
- databank.workerExecute(stmt);
- }
- function addGuildElo(gilden_id, elo) {
- setGuildElo(gilden_id, getGuildElo(gilden_id) + elo);
- }
- function setGuildElo(gilden_id, elo) {
- stmt = databank.prepare("UPDATE gilden SET elo = ? WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, elo);
- databank.setInt(stmt, 2, gilden_id);
- databank.workerExecute(stmt);
- }
- function setGuildBlockW(gilden_id, location) {
- world = loc.getWorld(location);
- block_world = world.getName(world);
- stmt = databank.prepare("UPDATE gilden SET block_world = ? WHERE gilden_id = ?;");
- databank.setString(stmt, 1, block_world);
- databank.setInt(stmt, 2, gilden_id);
- databank.workerExecute(stmt);
- }
- function setGuildBlockX(gilden_id, location) {
- block_x = loc.getCoord(location, "bx");
- stmt = databank.prepare("UPDATE gilden SET block_x = ? WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, block_x);
- databank.setInt(stmt, 2, gilden_id);
- databank.workerExecute(stmt);
- }
- function setGuildBlockY(gilden_id, location) {
- block_y = loc.getCoord(location, "by");
- stmt = databank.prepare("UPDATE gilden SET block_y = ? WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, block_y);
- databank.setInt(stmt, 2, gilden_id);
- databank.workerExecute(stmt);
- }
- function setGuildBlockZ(gilden_id, location) {
- block_z = loc.getCoord(location, "bz");
- stmt = databank.prepare("UPDATE gilden SET block_z = ? WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, block_z);
- databank.setInt(stmt, 2, gilden_id);
- databank.workerExecute(stmt);
- }
- function setGuildBlock(gilden_id, location) {
- setGuildBlockW(gilden_id, location);
- setGuildBlockX(gilden_id, location);
- setGuildBlockY(gilden_id, location);
- setGuildBlockZ(gilden_id, location);
- //Obsidian-Plattform setzen
- y = loc.getY(location) - 1;
- x1 = loc.getX(location) - 5;
- z1 = loc.getZ(location) - 5;
- x2 = loc.getX(location) + 5;
- z2 = loc.getZ(location) + 5;
- iter = loc.iterator(loc.getWorld(location), x1, y, z1, x2, y, z2);
- while(hasNext(iter)) {
- block.set(next(iter), "minecraft:obsidian");
- }
- }
- function setGuildSafetime(gilden_id, safetime) {
- stmt = databank.prepare("UPDATE gilden SET safetime = ? WHERE gilden_id = ?;");
- databank.setLong(stmt, 1, safetime);
- databank.setInt(stmt, 2, gilden_id);
- databank.workerExecute(stmt);
- }
- function setShareXp(gilden_id, share_xp) {
- stmt = databank.prepare("UPDATE gilden SET share_xp = ? WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, share_xp);
- databank.setInt(stmt, 2, gilden_id);
- databank.workerExecute(stmt);
- }
- function setShareGold(gilden_id, share_gold) {
- stmt = databank.prepare("UPDATE gilden SET share_gold = ? WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, share_gold);
- databank.setInt(stmt, 2, gilden_id);
- databank.workerExecute(stmt);
- }
- function getGoldDelay(gilden_id) {
- stmt = databank.prepare("SELECT gold_delay FROM gilden WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- gold_delay = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return gold_delay;
- }
- function getGuildType(gilden_id) {
- g_type = null;
- stmt = databank.prepare("SELECT g_type FROM gilden WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- g_type = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return g_type;
- }
- function getGuildGold(gilden_id) {
- stmt = databank.prepare("SELECT gold FROM gilden WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- gold = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return gold;
- }
- function getGuildName(gilden_id) {
- name = null;
- stmt = databank.prepare("SELECT name FROM gilden WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- name = databank.getString(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return name;
- }
- function getGuildElo(gilden_id) {
- elo = null;
- stmt = databank.prepare("SELECT elo FROM gilden WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- elo = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return elo;
- }
- function getGuildTag(gilden_id) {
- tag = null;
- stmt = databank.prepare("SELECT tag FROM gilden WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- tag = databank.getString(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return tag;
- }
- function getAllGuildIds() {
- list.new(list);
- stmt = databank.prepare("SELECT gilden_id FROM gilden;");
- result = databank.execute(stmt);
- while(databank.next(result)) {
- list.add(list, databank.getInt(result, 1));
- }
- databank.close(result);
- databank.close(stmt);
- return list;
- }
- function getAllGuildBlocks() {
- list.new(locations);
- id_list = getAllGuildIds();
- for(i = 0; i < list.getSize(id_list); i++) {
- gilden_id = list.getIndex(id_list, i);
- list.add(locations, getGuildBlock(gilden_id));
- }
- return locations;
- }
- function getGuildBlock(gilden_id) {
- location = null;
- stmt = databank.prepare("SELECT block_world, block_x, block_y, block_z FROM gilden WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- world_name = databank.getString(result, 1);
- x = databank.getInt(result, 2);
- y = databank.getInt(result, 3);
- z = databank.getInt(result, 4);
- world = world.get(world_name);
- location = loc.new(world, x, y, z);
- }
- databank.close(result);
- databank.close(stmt);
- return location;
- }
- function getGuildBlockW(gilden_id) {
- stmt = databank.prepare("SELECT block_world FROM gilden WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- block_world = databank.getString(result, 1);
- world = world.get(block_world);
- }
- databank.close(result);
- databank.close(stmt);
- return world;
- }
- function getGuildBlockX(gilden_id) {
- stmt = databank.prepare("SELECT block_x FROM gilden WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- block_x = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return block_x;
- }
- function getGuildBlockY(gilden_id) {
- stmt = databank.prepare("SELECT block_y FROM gilden WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- block_y = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return block_y;
- }
- function getGuildBlockZ(gilden_id) {
- stmt = databank.prepare("SELECT block_z FROM gilden WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- block_z = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return block_z;
- }
- function getGuildSafetime(gilden_id) {
- stmt = databank.prepare("SELECT safetime FROM gilden WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- safetime = databank.getLong(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return safetime;
- }
- function getGuildPlotId(gilden_id) {
- stmt = databank.prepare("SELECT plot_id FROM gilden WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- plot_id = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return plot_id;
- }
- function getGuildPlot(gilden_id) {
- plot = null;
- location = getGuildBlock(gilden_id);
- list = plot.get(location);
- plot = list.getIndex(list, 0);
- return plot;
- }
- function getGuildIdFromPlotId(plot_id) {
- gilden_id = null;
- stmt = databank.prepare("SELECT gilden_id FROM gilden WHERE plot_id = ?;");
- databank.setInt(stmt, 1, plot_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- gilden_id = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return gilden_id;
- }
- function getShareXp(gilden_id) {
- stmt = databank.prepare("SELECT share_xp FROM gilden WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- share_xp = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return share_xp;
- }
- function getShareGold(gilden_id) {
- stmt = databank.prepare("SELECT share_gold FROM gilden WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- share_gold = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return share_gold;
- }
- function getGuildIdFromName(name) {
- stmt = databank.prepare("SELECT gilden_id FROM gilden WHERE name = ?;");
- databank.setString(stmt, 1, name);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- gilden_id = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- if(gilden_id == "null") {
- return null;
- }
- return gilden_id;
- }
- function isExistingGuildName(name) {
- return getGuildIdFromName(name) != null;
- }
- function addGuildPlayer(player_id, gilden_id, gold_atm, gold_bank, next_join) {
- stmt = databank.prepare("INSERT INTO gildenplayer (player_id, gilden_id, gold_atm, gold_bank, next_join) VALUES (?, ?, ?, ?, ?);");
- databank.setInt(stmt, 1, player_id);
- databank.setInt(stmt, 2, gilden_id);
- databank.setInt(stmt, 3, gold_atm);
- databank.setInt(stmt, 4, 0); //Deprecated, gold_bank wird in gdmap "money" gespeichert
- databank.setLong(stmt, 5, next_join);
- databank.workerExecute(stmt);
- }
- function deleteGuildPlayer(player_id) {
- stmt = databank.prepare("DELETE FROM gildenplayer WHERE player_id = ?;");
- databank.setInt(stmt, 1, player_id);
- databank.workerExecute(stmt);
- }
- function removePlayerFromGuild(spieler, instant_join) {
- player_id = getPlayerId(spieler);
- guild.setId(player_id, 0);
- player_name = player.getNameFromId(player_id);
- if(isOnline(player_name)) {
- player = read.player(player_name);
- setHeadName(player);
- }
- removeRang(spieler);
- removeNick(spieler);
- if(!instant_join) {
- setNextJoin(spieler, time.getMillis() + 43200000);
- }
- }
- function addGoldAtm(player, gold) {
- goldnew = getGoldAtm(player) + gold;
- setGoldAtm(player, goldnew);
- displaygold(player, goldnew);
- }
- function subGoldAtm(player, gold) {
- goldnew = getGoldAtm(player) - gold;
- setGoldAtm(player, goldnew);
- displaygold(player, goldnew);
- }
- function setGoldAtm(player, gold_atm) {
- stmt = databank.prepare("UPDATE gildenplayer SET gold_atm = ? WHERE player_id = ?;");
- databank.setInt(stmt, 1, gold_atm);
- databank.setInt(stmt, 2, player.getId(player));
- databank.workerExecute(stmt);
- }
- function setGoldBank(spieler, gold_bank) {
- setMoney(getPlayerId(spieler), "gpvp_gold_bank", gold_bank);
- }
- function setNextJoin(spieler, next_join) {
- player_id = getPlayerId(spieler);
- stmt = databank.prepare("UPDATE gildenplayer SET next_join = ? WHERE player_id = ?;");
- databank.setLong(stmt, 1, next_join);
- databank.setInt(stmt, 2, player_id);
- databank.workerExecute(stmt);
- }
- function setRang(spieler, rang) {
- player_id = getPlayerId(spieler);
- stmt = databank.prepare("UPDATE gildenplayer SET rang = ? WHERE player_id = ?;");
- databank.setString(stmt, 1, rang);
- databank.setInt(stmt, 2, player_id);
- databank.workerExecute(stmt);
- }
- function setLeader(spieler) {
- setRang(spieler, "Leiter");
- }
- function setOfficer(spieler) {
- setRang(spieler, "Offizier");
- }
- function setAdel(spieler) {
- setRang(spieler, "Adel");
- }
- function setMember(spieler) {
- setRang(spieler, "Mitglied");
- }
- function removeRang(spieler) {
- setRang(spieler, null);
- }
- function removeNick(spieler) {
- setNick(spieler, null);
- }
- function setNick(spieler, nick) {
- player_id = getPlayerId(spieler);
- stmt = databank.prepare("UPDATE gildenplayer SET nick = ? WHERE player_id = ?;");
- databank.setString(stmt, 1, nick);
- databank.setInt(stmt, 2, player_id);
- databank.workerExecute(stmt);
- }
- function getGoldAtm(spieler) {
- player_id = getPlayerId(spieler);
- stmt = databank.prepare("SELECT gold_atm FROM gildenplayer WHERE player_id = ?;");
- databank.setInt(stmt, 1, player_id);
- result = databank.execute(stmt);
- gold_atm = 0;
- while(databank.next(result)) {
- gold_atm = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return gold_atm;
- }
- function getGoldBank(spieler) {
- player_id = getPlayerId(spieler);
- gold_bank = getMoney(player_id, "gpvp_gold_bank");
- return gold_bank;
- }
- function getNextJoin(spieler) {
- player_id = getPlayerId(spieler);
- stmt = databank.prepare("SELECT next_join FROM gildenplayer WHERE player_id = ?;");
- databank.setInt(stmt, 1, player_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- next_join = databank.getLong(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return next_join;
- }
- function getRang(spieler) {
- player_id = getPlayerId(spieler);
- stmt = databank.prepare("SELECT rang FROM gildenplayer WHERE player_id = ?;");
- databank.setInt(stmt, 1, player_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- rang = databank.getString(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- if(rang == "null") {
- return null;
- }
- return rang;
- }
- function getNick(spieler) {
- player_id = getPlayerId(spieler);
- stmt = databank.prepare("SELECT nick FROM gildenplayer WHERE player_id = ?;");
- databank.setInt(stmt, 1, player_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- nick = databank.getString(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- if(nick == "null") {
- return null;
- }
- return nick;
- }
- function getGuildPlayers(gilden_id) {
- list.new(list);
- stmt = databank.prepare("SELECT player_id FROM gildenplayer WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- list.add(list, databank.getInt(result, 1));
- }
- databank.close(result);
- databank.close(stmt);
- return list;
- }
- function getOnlineGuildPlayerIds(gilden_id) {
- list.new(list);
- stmt = databank.prepare("SELECT player_id FROM gildenplayer WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- player_id = databank.getInt(result, 1);
- if(read.player(player.getNameFromId(player_id)) != null) {
- list.add(list, player_id);
- }
- }
- databank.close(result);
- databank.close(stmt);
- return list;
- }
- function getOnlineGuildPlayers(gilden_id) {
- list.new(list);
- stmt = databank.prepare("SELECT player_id FROM gildenplayer WHERE gilden_id = ?;");
- databank.setInt(stmt, 1, gilden_id);
- result = databank.execute(stmt);
- while(databank.next(result)) {
- player_id = databank.getInt(result, 1);
- p = read.player(player.getNameFromId(player_id));
- if(p != null) {
- list.add(list, p);
- }
- }
- databank.close(result);
- databank.close(stmt);
- return list;
- }
- function isGameAdmin(player) {
- return perm.has(player, "isSnuviMaster");
- }
- function isGameMod(player) {
- return perm.has(player, "isGuildMod");
- }
- function displayMovePlot(player, move_id) {
- for(i = 0; i < list.getSize($gmoveids); i++) {
- array = list.getIndex($gmoveids, i);
- moveid = array[0];
- if(move_id == moveid) {
- gilden_id = array[1];
- gilden_name = getGuildName(gilden_id);
- display.add(player, 39, "§6", gilden_name);
- elo = getGuildElo(gilden_id);
- gold = getGuildGold(gilden_id);
- if(gilden_id == guild.getId(player)) {
- //Gildenextra: Heimvorteil
- if(elo >= 1400 && gold >= 10000) {
- entity.addEffect(player, "haste", 150, 1);
- }
- } else {
- //Gildenextra: Patrouillen
- if(elo >= 2500 && gold >= 15000) {
- nachricht = concat("Feind im Gildengebiet! ", player.getName(player));
- sendGuildMessage(gilden_id, $gildepräfix, nachricht, false);
- }
- }
- }
- }
- }
- function isGroup(gilden_id) {
- if(gilden_id == null) {
- return false;
- }
- return getGuildType(gilden_id) == 0;
- }
- function isGuild(gilden_id) {
- if(gilden_id == null) {
- return false;
- }
- return getGuildType(gilden_id) == 1;
- }
- function isPlayerInGuild(player) {
- return isGuild(guild.getId(player));
- }
- function isPlayerInGroup(player) {
- return isGroup(guild.getId(player));
- }
- function registerGpvpPlayer(player) {
- player_id = getPlayerId(player);
- if(!isGuildPlayer(player)) {
- addGuildPlayer(player_id, player_id * -1, 0, 0, time.getMillis());
- list = players.toWorldList($gpvpworld);
- if(list.contains(list, player)) {
- displaygold(player, 0);
- class = guild.getClass(player);
- if(class != "none") {
- level = guild.getLevel(player);
- displayclass(player, class);
- displaylevel(player, level);
- displayxp(player, level, guild.getXp(player));
- setManaAtm(player, 0);
- setManaMax(player, calcManaMax(class, level));
- displaymana(player);
- }
- displayHealth(player);
- fillStacksBar(player, class);
- stacks.setActive(player, true);
- }
- return true;
- }
- return false;
- }
- function joinGpvpWorld(player) {
- displaygold(player, getGoldAtm(player));
- displayHealth(player);
- class = guild.getClass(player);
- if(class != "none") {
- level = guild.getLevel(player);
- displayclass(player, class);
- displaylevel(player, level);
- displayxp(player, level, guild.getXp(player));
- setManaAtm(player, 0);
- setManaMax(player, calcManaMax(class, level));
- displaymana(player);
- }
- if(isPlayerInGuild(player)) {
- gilden_id = guild.getId(player);
- gilden_tag = getGuildTag(gilden_id);
- }
- fillStacksBar(player, class);
- stacks.setActive(player, true);
- setHeadName(player);
- }
- function setHeadName(player) {
- player_name = player.getName(player);
- level = guild.getLevel(player);
- level_string = "";
- class = guild.getClass(player);
- if(class != "none") {
- level_string = concat("§a", text.number(level), " ");
- }
- health = entity.getHealth(player);
- max_health = getMaxHealth(class, level);
- gilden_health = math.round(getGildenHealth(health, max_health));
-
- guild_string = "";
- guild_id = guild.getId(player);
- if(guild_id > 0) {
- guild_tag = getGuildTag(guild_id);
- guild_string = concat(" [§6", gilden_tag, "§r]");
- }
- entity.setName(player, concat(text.number(gilden_health), " §c❤\n", level_string, "§r", player_name, guild_string));
- }
- function isGuildPlayer(player) {
- stmt = databank.prepare("SELECT player_id FROM gildenplayer;");
- result = databank.execute(stmt);
- if(databank.next(result)) {
- databank.close(result);
- databank.close(stmt);
- return true;
- }
- databank.close(result);
- databank.close(stmt);
- return false;
- }
- function dropTables() {
- databank.workerExecute(databank.prepare("DROP TABLE gilden_chests_1"));
- databank.workerExecute(databank.prepare("DROP TABLE gilden_chests_2"));
- databank.workerExecute(databank.prepare("DROP TABLE gilden"));
- databank.workerExecute(databank.prepare("DROP TABLE gildenplayer"));
- databank.workerExecute(databank.prepare("DROP TABLE guild_jobs"));
- }
- function setManaAtm(player, mana) {
- data.set(player, "mana_atm", mana);
- }
- function getManaAtm(player) {
- return data.get(player, "mana_atm");
- }
- function setManaMax(player, mana) {
- if(getManaAtm(player) > mana) {
- setManaAtm(player, mana);
- }
- data.set(player, "mana_max", mana);
- }
- function getManaMax(player) {
- return data.get(player, "mana_max");
- }
- function calcManaMax(class, level) {
- if(class == "Jäger") {
- mana_lvl_1 = 480;
- mana_per_level = 9;
- } elseif(class == "Schurke") {
- mana_lvl_1 = 590;
- mana_per_level = 9;
- } elseif(class == "Krieger") {
- mana_lvl_1 = 560;
- mana_per_level = 8;
- } else {
- mana_per_level = 0;
- mana_lvl_1 = 100;
- }
- return mana_per_level * (level - 1) + mana_lvl_1;
- }
- function getManaRegenerationForClass(class) {
- if(class == "Krieger") {
- return 1;
- }
- if(class == "Schurke") {
- return 1;
- }
- if(class == "Jäger") {
- return 1;
- }
- return null;
- }
- function addSharedGold(gilden_id, gold) {
- list = getOnlineGuildPlayerIds(gilden_id);
- size = list.getSize(list);
- gold /= size;
- for(i = 0; i < size; i++) {
- player_id = list.getIndex(list, i);
- player = player.get(player.getUuidFromId(player_id));
- addGoldAtm(player, gold);
- if(gold > 0) {
- if(isGuild(gilden_id)) {
- speakPrefix(player, "§eGold", concat("§rDu hast §6", text.number(gold), " §rGold erhalten [§6Gilde§r]"));
- } else {
- speakPrefix(player, "§eGold", concat("§rDu hast §6", text.number(gold), " §rGold erhalten [§9Gruppe§r]"));
- }
- }
- }
- }
- function addSharedXp(gilden_id, xp) {
- list = getOnlineGuildPlayerIds(gilden_id);
- size = list.getSize(list);
- for(i = 0; i < size; i++) {
- player_id = list.getIndex(list, i);
- player = player.get(player.getUuidFromId(player_id));
- xp = math.round((xp * 1.1) / size);
- addXp(player, xp, true, true);
- }
- }
- function addXp(player, xp, sendmsg, sharing) {
- class = guild.getClass(player);
- if(class == "none") {
- return;
- }
- level = guild.getLevel(player);
- if(level >= 100) {
- return;
- }
- if(sendmsg) {
- if(sharing) {
- gilden_id = guild.getId(player);
- if(isGuild(gilden_id)) {
- speakPrefix(player, "§aEXP", concat("§rDu hast §a", text.number(xp), " §rEXP erhalten [§6Gilde§r]"));
- } else {
- speakPrefix(player, "§aEXP", concat("§rDu hast §a", text.number(xp), " §rEXP erhalten [§9Gruppe§r]"));
- }
- } else {
- speakPrefix(player, "§aEXP", concat("§rDu hast §a", text.number(xp), " §rEXP erhalten"));
- }
- }
- new_xp = guild.getXp(player) + xp;
- next_xp = getXpForNextlevel(level);
- while(new_xp >= next_xp) {
- //Level Up
- player_loc = entity.getLocation(player);
- entity.spawn("minecraft:firework_rocket", player_loc, "{LifeTime:25,FireworksItem:{id:firework_rocket,Count:1,tag:{Fireworks:{Explosions:[{Type:1,Colors:[I;11141120]}]}}}}");
- sound.spawn(player_loc, level_up_sound, sound_category_player);
- level++;
- guild.setLevel(player, level);
- displaylevel(player, level);
- setManaMax(player, calcManaMax(class, level));
- displaymana(player);
- displayHealth(player);
- setHeadName(player);
- speakPrefix(player, "§aEXP", concat("§rDu hast Level §a", text.number(level), "§r erreicht"));
- if(level >= 100) {
- new_xp = 0;
- } else {
- new_xp -= next_xp;
- }
- }
- guild.setXp(player, new_xp);
- displayxp(player, level, new_xp);
- }
- function sendGuildMail(from_name, gilden_id, nachricht) { //from, to, message. Sendet eine Mail an alle Mitglieder einer Gilde
- list = getGuildPlayers(gilden_id);
- for(i = 0; i < list.getSize(list); i++) {
- to_name = player.getNameFromId(list.getIndex(list, i));
- mail.send(from_name, to_name, nachricht);
- }
- }
- function sendGuildMessage(gilden_id, topic, nachricht, boolean) { //Sendet eine Chat-Nachricht an an alle Mitglieder einer Gilde. Wenn boolean = true, dann eine Mail an Offline Members
- list = getGuildPlayers(gilden_id);
- for(i = 0; i < list.getSize(list); i++) {
- pname = player.getNameFromId(list.getIndex(list, i));
- sendmessage(pname, topic, nachricht, boolean);
- }
- }
- function sendWorldMessage(topic, nachricht) { //Sendet eine Chat-Nachricht an alle Spieler in der Gildenpvp-Welt
- list = players.toWorldList($gpvpworld);
- for(i = 0; i < list.getSize(list); i++) {
- player = list.getIndex(list, i);
- speakPrefix(player, topic, nachricht);
- }
- }
- function sendGuildTitle(gilden_id, title, subtitle) { //Sendet einen Title an alle Spieler einer Gilde, wenn diese online sind.
- list = getOnlineGuildPlayerIds(gilden_id);
- for(i = 0; i <= list.getSize(list) - 1; i++) {
- player_id = list.getIndex(list, i);
- player = player.get(player.getUuidFromId(player_id));
- title.clear(player);
- title.reset(player);
- title.setSub(player, subtitle);
- title.send(player, title);
- }
- }
- function isInGpvpWorld(player) {
- worldlist = players.toWorldList($gpvpworld);
- return list.contains(worldlist, player);
- }
- function isLeader(spieler) {
- ownrang = getRang(spieler);
- return ownrang == "Leiter";
- }
- function isMember(spieler) {
- ownrang = getRang(spieler);
- return ownrang == "Mitglied";
- }
- function isOfficer(spieler) {
- ownrang = getRang(spieler);
- return ownrang == "Offizier";
- }
- function isAdel(spieler) {
- ownrang = getRang(spieler);
- return ownrang == "Adel";
- }
- function isLeaderOrOfficer(spieler) {
- ownrang = getRang(spieler);
- return ownrang == "Leiter" || ownrang == "Offizier";
- }
- function checkGuildBlockArea(location) {
- world = loc.getWorld(location);
- x = loc.getX(location);
- y = loc.getY(location);
- z = loc.getZ(location);
- iter = loc.iterator(world, x - 5, y, z - 5, x + 5, y + 7, z + 5);
- while(hasNext(iter)) {
- loc = next(iter);
- if(!block.isAir(loc)) {
- b_type = block.getType(modded_loc);
- if(b_type != "km:guild_block") {
- return false;
- }
- }
- }
- return true;
- }
- function checkArteArea(location) {
- world = loc.getWorld(location);
- x = loc.getX(location);
- y = loc.getY(location);
- z = loc.getZ(location);
- iter = loc.iterator(world, x - 8, y, z - 8, x + 8, y + 8, z + 8);
- while(hasNext(iter)) {
- loc = next(iter);
- if(!block.isAir(loc)) {
- b_type = block.getType(modded_loc);
- if(b_type != "km:artefact") {
- return false;
- }
- }
- }
- return true;
- }
- function setArteBlockArea(location) {
- set.add($forbiddenblocks, loc.mod(location, 0, -1, 0));
- for(y = 0; y <= 8; y++) {
- for(z = -8; z <= 8; z++) {
- for(x = -8; x <= 8; x++) {
- set.add($forbiddenblocks2, loc.mod(location, x, y, z));
- }
- }
- }
- }
- function removeArteBlockArea(location) {
- set.remove($forbiddenblocks, loc.mod(location, 0, -1, 0));
- for(y = 0; y <= 8; y++) {
- for(z = -8; z <= 8; z++) {
- for(x = -8; x <= 8; x++) {
- set.remove($forbiddenblocks2, loc.mod(location, x, y, z));
- }
- }
- }
- }
- function setGuildBlockArea(location) {
- set.add($forbiddenblocks, loc.mod(location, 0, -1, 0));
- for(y = 0; y <= 7; y++) {
- for(z = -5; z <= 5; z++) {
- for(x = -5; x <= 5; x++) {
- set.add($forbiddenblocks2, loc.mod(location, x, y, z));
- }
- }
- }
- }
- function removeGuildBlockArea(location) {
- set.remove($forbiddenblocks, loc.mod(location, 0, -1, 0));
- for(y = 0; y <= 7; y++) {
- for(z = -5; z <= 5; z++) {
- for(x = -5; x <= 5; x++) {
- set.remove($forbiddenblocks2, loc.mod(location, x, y, z));
- }
- }
- }
- }
- //Überprüfung, ob sich im Umkreis <= 100 Blöcken Gegner befinden (Gegner != Gilde/Gruppe/Freund)
- function checkForEnimies(player) {
- nearplayers = player.near(player, 100);
- for(i = 0; i < list.getSize(nearplayers); i++) {
- p = list.getIndex(nearplayers, i);
- p_name = player.getName(p);
- if(!guild.isSame(player.getName(player), p_name)) {
- //ja, nicht in selber Gilde/Gruppe
- return false; //return true; testphase
- }
- //Überprüfung, ob Freunde
- player_id = player.getId(player);
- p_id = player.getId(p);
- if(!isAFriend(player_id, p_id)) {
- //ja, die beiden spieler sind keine Freunde
- return false; //return true; testphase
- }
- }
- return false;
- }
- function cancelCauseEnimy() {
- //testphase
- //speakPrefix($player, $fehlerpräfix, "§rGegner in der Nähe");
- //$cancel = true; //Auskommentiert: Um Bauarbeiten zu ermöglichen, während andere Spieler in der Nähe sind
- }
- function hasInvitationFromThisGuild(p_id, g_id) {
- for(i = 0; i < list.getSize($invitations); i++) {
- invitation = list.getIndex($invitations, i);
- player_id = invitation[0];
- gilden_id = invitation[1];
- if(player_id == p_id && gilden_id == g_id) {
- return true;
- }
- }
- return false;
- }
- function hasGroupInvitation(player_id) {
- for(i = 0; i < list.getSize(groupinvitations); i++) {
- invitation = list.getIndex(groupinvitations, i);
- p_id = invitation[0];
- if(player_id == p_id) {
- return true;
- }
- }
- return false;
- }
- function hasGroupInvitationFromThisPlayer(player_id, inv_id) {
- for(i = 0; i < list.getSize(groupinvitations); i++) {
- invitation = list.getIndex(groupinvitations, i);
- p_id = invitation[0];
- inviter_id = invitation[1];
- if(player_id == p_id && inviter_id == inv_id) {
- return true;
- }
- }
- return false;
- }
- function addGuildInvitation(p_id, gilden_id, sender_id) {
- invitation = array.new(2);
- invitation[0] = p_id;
- invitation[1] = gilden_id;
- list.add($invitations, invitation);
- }
- function addGroupInvitation(player_id, inviter_id) {
- invitation = array.new(2);
- invitation[0] = player_id;
- invitation[1] = inviter_id;
- list.add($groupinvitations, invitation);
- }
- //Ist die Location auf dem Grundstück der angegebenen Gilde?
- function isOnGuildPlot(gilden_id, location) {
- if(gilden_id < 0) {
- return false;
- }
- guild_plot = getGuildPlot(gilden_id);
- plot_list = plot.get(location);
- return list.contains(plot_list, guild_plot);
- }
- function getFightArray(plot_id) {
- gfights = getScriptVar("gfights");
- for(i = 0; i < list.getSize(gfights); i++) {
- array = list.getIndex(gfights, i);
- if(plot_id == array[2]) {
- return array;
- }
- }
- return null;
- }
- function isAFightPlot(plot_id) {
- plot_set = getFightPlots();
- return set.contains(plot_set, plot_id);
- }
- function getFightPlots() {
- set.new(set);
- gfights = getScriptVar("gfights");
- for(i = 0; i < list.getSize(gfights); i++) {
- array = list.getIndex(gfights, i);
- plot_id = array[2];
- set.add(set, plot_id);
- }
- return set;
- }
- function checkIfAttacker(gilden_id) {
- gfights = getScriptVar("gfights");
- for(i = 0; i < list.getSize(gfights); i++) {
- array = list.getIndex(gfights, i);
- attacker_id = array[1];
- if(gilden_id == attacker_id) {
- return true;
- }
- }
- return false;
- }
- function checkIfGuildInFight(gilden_id) {
- gfights = getScriptVar("gfights");
- for(i = 0; i < list.getSize(gfights); i++) {
- array = list.getIndex(gfights, i);
- defender_id = array[0];
- attacker_id = array[1];
- if(gilden_id == defender_id || gilden_id == attacker_id) {
- return true;
- }
- }
- return false;
- }
- function checkIfPlayerInFight(player) {
- gfights = getScriptVar("gfights");
- for(i = 0; i < list.getSize(gfights); i++) {
- array = list.getIndex(gfights, i);
- player_set = array[3];
- if(set.contains(player_set, player.getId(player))) {
- return true;
- }
- }
- return false;
- }
- function getOppFighter(gilden_id) {
- opp_gilden_id = null;
- gfights = getScriptVar("gfights");
- for(i = 0; i < list.getSize(gfights); i++) {
- array = list.getIndex(gfights, i);
- defender_id = array[0];
- attacker_id = array[1];
- if(gilden_id == defender_id) {
- opp_gilden_id = attacker_id;
- } elseif(gilden_id == attacker_id) {
- opp_gilden_id = defender_id;
- }
- }
- return opp_gilden_id;
- }
- function getFightPlot(gilden_id) {
- plot_id = null;
- gfights = getScriptVar("gfights");
- for(i = 0; i < list.getSize(gfights); i++) {
- array = list.getIndex(gfights, i);
- defender_id = array[0];
- attacker_id = array[1];
- if(gilden_id == defender_id || gilden_id == attacker_id) {
- plot_id = array[2];
- }
- }
- return plot_id;
- }
- function getNewGuildId() {
- nextid = ggv("SERVER", "gildencounter") + 1;
- sgv("SERVER", "gildencounter", nextid);
- return nextid;
- }
- function toggleGoldOrXp(gilden_id) {
- if(!isLeader($player_name)) {
- speakPrefix($player, $fehlerpräfix, "§rNur für Leiter");
- return;
- }
- if($arg0 == "gold") {
- if(getShareGold(gilden_id) == 1) {
- setShareGold(gilden_id, 0);
- speakPrefix($player, $gildepräfix, "§rGold-Teilung deaktiviert");
- } else {
- setShareGold(gilden_id, 1);
- speakPrefix($player, $gildepräfix, "§rGold-Teilung aktiviert");
- }
- }
- elseif($arg0 == "xp") {
- if(getShareXp(gilden_id) == 1) {
- setShareXp(gilden_id, 0);
- speakPrefix($player, $gildepräfix, "§rXP-Teilung deaktiviert");
- } else {
- setShareXp(gilden_id, 1);
- speakPrefix($player, $gildepräfix, "§rXP-Teilung aktiviert");
- }
- }
- }
- function getGuildSizeMax(gilden_id) {
- elo = getGuildElo(gilden_id);
- gold = getGuildGold(gilden_id);
- if(elo < 1200 && gold < 7500) {
- size_max = 15;
- } else {
- //Gildenextra: Expansion
- size_max = 20;
- }
- return size_max;
- }
- function getGuildSize(gilden_id) {
- list = getGuildPlayers(gilden_id);
- list_size = list.getSize(list);
- return list_size;
- }
- function checkGroupSize(gilden_id) {
- if(getGuildSize(gilden_id) < 2) {
- templist = getGuildPlayers(gilden_id);
- for(i = 0; i < list.getSize(templist); i++) {
- player_id = list.getIndex(templist, i);
- setGuildId(player_id, 0);
- sendmessage(player.getNameFromId(player_id), $gruppepräfix, concat("Deine Gruppe wurde aufgelöst"), false);
- }
- deleteGuildFromData(gilden_id);
- }
- }
- function createMoveArea(gilden_id, g_block) {
- x = loc.getX(g_block);
- x1 = x - 150;
- x2 = x + 150;
- z = loc.getZ(g_block);
- z1 = z - 150;
- z2 = z + 150;
- gpvpworld = world.get($gpvpworld_name);
- gs_edge1 = loc.new(gpvpworld, x1, 0, z1);
- gs_edge2 = loc.new(gpvpworld, x2, 255, z2);
- move_id = event.addMoveData(gs_edge1, gs_edge2, 100, -1);
- array = array.new(2);
- array[0] = move_id;
- array[1] = gilden_id;
- list.add($gmoveids, array);
- }
- function removeMoveArea(gilden_id) {
- for(i = 0; i < list.getSize($gmoveids); i++) {
- array = list.getIndex($gmoveids, i);
- gildenid = array[1];
- if(gilden_id == gildenid) {
- moveid = array[0];
- list.remove($gmoveids, array);
- event.removeMoveData(moveid);
- }
- }
- }
- function getOfficersAmount(gilden_id) {
- templist = getGuildPlayers(gilden_id);
- counter = 0;
- for(i = 0; i < list.getSize(templist); i++) {
- player_id = list.getIndex(templist, i);
- if(isOfficer(player_id)) {
- counter ++;
- }
- }
- return counter;
- }
- function getOfficersMax(gilden_id) {
- elo = getGuildElo(gilden_id);
- gold = getGuildGold(gilden_id);
- if(elo < 500 && gold < 2500) {
- officers_max = 1;
- } elseif(elo < 1000 && gold < 5000) {
- //Gildenextra: Dorf
- officers_max = 2;
- } else {
- //Gildenextra: Siedlung
- officers_max = 3;
- }
- return officers_max;
- }
- function getAdelAmount(gilden_id) {
- templist = getGuildPlayers(gilden_id);
- counter = 0;
- for(i = 0; i < list.getSize(templist); i++) {
- player_id = list.getIndex(templist, i);
- if(isAdel(player_id)) {
- counter ++;
- }
- }
- return counter;
- }
- function getAdelMax(gilden_id) {
- elo = getGuildElo(gilden_id);
- gold = getGuildGold(gilden_id);
- if(elo < 500 && gold < 2500) {
- adel_max = 0;
- } elseif(elo < 1000 && gold < 5000) {
- //Gildenextra: Dorf
- adel_max = 1;
- } elseif(elo < 32000 && gold < 25000) {
- //Gildenextra: Siedlung
- adel_max = 3;
- } else {
- //Gildenextra: Metropole
- adel_max = 4;
- }
- return adel_max;
- }
- function getXpForNextlevel(level) {
- //um von level 1 auf level 2 zu kommen, werden 300 xp benötigt
- level--;
- xp = math.round(0.7*math.pow(level, 2)+14*level+300);
- return xp;
- }
- function calculateTax(gilden_id) {
- gildenkonto = getGuildGold(gilden_id);
- //obsidian_tax = obsidian_count * 0.1;
- land_tax = getLandTax(gilden_id);
- //tax = obsidian_tax + land_tax;
- tax = land_tax;
- setGuildGold(gilden_id, gildenkonto - tax);
- sendGuildMessage(gilden_id, $gildepräfix, concat("Deine Gilde hat ", text.number(tax), " Gold Steuern gezahlt"), false);
- if(tax < gildenkonto) {
- setGoldDelay(gilden_id, 0);
- } else {
- days = getGoldDelay(gilden_id) + 1;
- setGoldDelay(gilden_id, days);
- nachricht = concat("Deine Gilde ist den ", text.number(days), ".Tag in Folge nach der Steuerabrechnung im Minus!");
- sendGuildMessage(gilden_id, $gildepräfix, nachricht, false);
- if(days == 6) {
- nachricht = concat("Sollte dies morgen wieder der Fall sein, wird die Gilde aufgelöst!");
- sendGuildMessage(gilden_id, $gildepräfix, nachricht, false);
- }
- if(days == 7) {
- nachricht = concat("Die Gilde wurde automatisch aufgelöst!");
- sendGuildMessage(gilden_id, $gildepräfix, nachricht, true);
- //Artefakt zurücksetzen, falls die Gilde das Artefakt besitzt
- if(arte_loc_type == "placed") {
- if(isOnGuildPlot(gilden_id, arte_yet_loc)) {
- arteresetcore();
- }
- }
- //Spieler entfernen
- templist = getGuildPlayers(gilden_id);
- for(i = 0; i < list.getSize(templist); i++) {
- p_id = list.getIndex(templist, i);
- removePlayerFromGuild(p_id, true);
- }
- //Gilde entfernen
- deleteGuild(gilden_id);
- }
- }
- }
- function getLandTax(gilden_id) {
- elo = getGuildElo(gilden_id);
- if(elo < 400) {
- land_tax = 50;
- } elseif(elo < 1200) {
- land_tax = 100;
- } elseif(elo < 2000) {
- land_tax = 200;
- } elseif(elo < 3500) {
- land_tax = 400;
- } else {
- land_tax = 600;
- }
- return land_tax;
- }
- function fillStacksBar(player, class) {
- stacks.clear(player);
- for(i = 0; i <= 8; i++) {
- tempskill = hotkey.get(player, class, i);
- if(tempskill != null) {
- icon_id = skill.getIconId(tempskill);
- stacks.set(player, i, icon_id, 0);
- }
- }
- }
- function getGuildPlots() {
- list.new(plot_list);
- stmt = databank.prepare("SELECT plot_id FROM gilden;");
- result = databank.execute(stmt);
- while(databank.next(result)) {
- list.add(plot_list, databank.getInt(result, 1));
- }
- databank.close(result);
- databank.close(stmt);
- return plot_list;
- }
- function isAGuildPlot(plot_id) {
- plot_list = getGuildPlots();
- return list.contains(plot_list, plot_id);
- }
- function getMagicArmor(class, level) {
- if(class == "Jäger") {
- magic_armor = 28 + level / 4;
- } elseif(class == "Schurke") {
- magic_armor = 24 + level / 4;
- } elseif(class == "Krieger") {
- magic_armor = 42 + level / 2;
- } else {
- magic_armor = 0;
- }
- return magic_armor;
- }
- function cache.get(player, index) {
- map = getScriptVar("guild_player_cache");
- if(map == null) {
- return null;
- }
- player_cache = map.get(map, player.getUuid(player));
- if(player_cache == null) {
- return null;
- }
- return player_cache[index];
- }
- function cache.set(spieler, index, value) {
- if(isPlayer(spieler)) {
- spieler = player.getUuid(spieler);
- }
- map = getScriptVar("guild_player_cache");
- if(map == null) {
- map = map.new();
- setScriptVar("guild_player_cache", map);
- }
- player_cache = map.get(map, spieler);
- if(player_cache == null) {
- player_cache = array.new(4);
- map.add(map, spieler, player_cache);
- }
- player_cache[index] = value;
- }
- function guild.createTables() {
- databank.workerExecute(databank.prepare("CREATE TABLE IF NOT EXISTS gilden (gilden_id INT NOT NULL PRIMARY KEY, g_type INT NOT NULL, gold_delay INT NOT NULL, gold INT NOT NULL, name VARCHAR(20) NOT NULL, block_world VARCHAR(20) NOT NULL, block_x INT NOT NULL, block_y INT NOT NULL, block_z INT NOT NULL, safetime BIGINT NOT NULL, plot_id INT NOT NULL, share_xp TINYINT NOT NULL, share_gold TINYINT NOT NULL, elo INT NOT NULL, tag VARCHAR(3) NOT NULL);"));
- databank.workerExecute(databank.prepare("CREATE TABLE IF NOT EXISTS gildenplayer (player_id INT NOT NULL, gilden_id INT NOT NULL, gold_atm INT NOT NULL, gold_bank INT NOT NULL, next_join BIGINT NOT NULL, rang VARCHAR(15), nick VARCHAR(15), PRIMARY KEY (gilden_id, player_id), FOREIGN KEY (player_id) REFERENCES minecraft.players(id) ON DELETE CASCADE);"));
- databank.workerExecute(databank.prepare("CREATE TABLE IF NOT EXISTS gilden_chests_1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, gilden_id INT NOT NULL, block_world VARCHAR(20) NOT NULL, block_x INT NOT NULL, block_y INT NOT NULL, block_z INT NOT NULL, type VARCHAR(10) NOT NULL, FOREIGN KEY (gilden_id) REFERENCES minecraft.gilden(gilden_id) ON DELETE CASCADE);"));
- databank.workerExecute(databank.prepare("CREATE TABLE IF NOT EXISTS gilden_chests_2 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, player_id INT NOT NULL, block_world VARCHAR(20) NOT NULL, block_x INT NOT NULL, block_y INT NOT NULL, block_z INT NOT NULL, FOREIGN KEY (player_id) REFERENCES minecraft.players(id) ON DELETE CASCADE);"));
- databank.workerExecute(databank.prepare("CREATE TABLE IF NOT EXISTS guild_jobs (player_id INT NOT NULL, name VARCHAR(20) NOT NULL, level INT NOT NULL, xp INT NOT NULL, active TINYINT NOT NULL, PRIMARY KEY(player_id, name), FOREIGN KEY (player_id) REFERENCES minecraft.players(id) ON DELETE RESTRICT);"));
- databank.workerExecute(databank.prepare("CREATE TABLE IF NOT EXISTS hotkeys (player_id INT NOT NULL, class_name VARCHAR(20) NOT NULL, key_index INT NOT NULL, skill_name VARCHAR(30) NOT NULL, PRIMARY KEY(player_id, class_name, key_index), FOREIGN KEY (player_id) REFERENCES minecraft.players(id) ON DELETE RESTRICT);"));
- databank.workerExecute(databank.prepare("CREATE TABLE IF NOT EXISTS guild_reward (player_id INT NOT NULL, day INT NOT NULL, opened TINYINT NOT NULL, PRIMARY KEY(player_id, day), FOREIGN KEY (player_id) REFERENCES minecraft.players(id) ON DELETE RESTRICT);"));
- }
- function guild.clearRewards() {
- databank.workerExecute(databank.prepare("DELETE FROM guild_reward"));
- }
- function guild.openedReward(player, day) {
- stmt = databank.prepare("INSERT INTO guild_reward (player_id, day, opened) VALUES (?,?,1)");
- databank.setInt(stmt, 1, player.getId(player));
- databank.setInt(stmt, 2, day - 1);
- databank.workerExecute(stmt);
- }
- function guild.hasRewardOpened(player, day) {
- stmt = databank.prepare("SELECT opened FROM guild_reward WHERE player_id = ? AND day = ?");
- databank.setInt(stmt, 1, player.getId(player));
- databank.setInt(stmt, 2, day - 1);
- result = databank.execute(stmt);
- if(databank.next(result)) {
- databank.close(result);
- databank.close(stmt);
- return true;
- }
- databank.close(result);
- databank.close(stmt);
- return false;
- }
- function guild.getRewardList(player) {
- list = list.new();
- stmt = databank.prepare("SELECT day FROM guild_reward WHERE player_id = ? ORDER BY day ASC");
- databank.setInt(stmt, 1, player.getId(player));
- result = databank.execute(stmt);
- while(databank.next(result)) {
- day = databank.getInt(result, 1);
- list.add(list, day);
- }
- databank.close(result);
- databank.close(stmt);
- return list;
- }
- function guild.getClass(player) {
- class = cache.get(player, 0);
- if(class == null) {
- class = guild.getClassFromDatabase(player.getId(player));
- cache.set(player, 0, class);
- }
- return class;
- }
- function guild.getClassFromDatabase(player_id) {
- stmt = databank.prepare("SELECT name FROM guild_jobs WHERE player_id = ? AND active = 1");
- databank.setInt(stmt, 1, player_id);
- result = databank.execute(stmt);
- class_name = "none";
- if(databank.next(result)) {
- class_name = databank.getString(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return class_name;
- }
- function guild.setClass(player, class_name) {
- player_id = player.getId(player);
- if(guild.hasClass(player_id, class_name)) {
- cache.set(player, 0, class_name);
- cache.set(player, 1, null); //Chache invalidieren, damit er (nur) beim Abrufen gesetzt wird
- cache.set(player, 2, null);
- } else {
- cache.set(player, 0, class_name);
- cache.set(player, 1, 1);
- cache.set(player, 2, 0);
- }
- stmt1 = databank.prepare("UPDATE guild_jobs SET active = 0 WHERE player_id = ?;");
- databank.setInt(stmt1, 1, player_id);
- databank.workerExecute(stmt1);
- stmt2 = databank.prepare("INSERT INTO guild_jobs (player_id, name, level, xp, active) VALUES (?,?,1,0,1) ON DUPLICATE KEY UPDATE active = 1;");
- databank.setInt(stmt2, 1, player_id);
- databank.setString(stmt2, 2, class_name);
- databank.workerExecute(stmt2);
- }
- function guild.getLevel(player) {
- level = cache.get(player, 1);
- if(level == null) {
- level = guild.getLevelFromDatabase(player.getId(player));
- cache.set(player, 1, level);
- }
- return level;
- }
- function guild.getLevelFromDatabase(player_id) {
- stmt = databank.prepare("SELECT level FROM guild_jobs WHERE player_id = ? AND active = 1;");
- databank.setInt(stmt, 1, player_id);
- result = databank.execute(stmt);
- level = 1;
- if(databank.next(result)) {
- level = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return level;
- }
- function guild.getClassLevelFromDatabase(player_id, class_name) {
- stmt = databank.prepare("SELECT level FROM guild_jobs WHERE player_id = ? AND name = ?;");
- databank.setInt(stmt, 1, player_id);
- databank.setString(stmt, 2, class_name);
- result = databank.execute(stmt);
- level = 1;
- if(databank.next(result)) {
- level = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return level;
- }
- function guild.setLevel(player, level) {
- cache.set(player, 1, level);
- stmt = databank.prepare("UPDATE guild_jobs SET level = ? WHERE player_id = ? AND active = 1;");
- databank.setInt(stmt, 1, level);
- databank.setInt(stmt, 2, player.getId(player));
- databank.workerExecute(stmt);
- }
- function guild.getXp(player) {
- xp = cache.get(player, 2);
- if(xp == null) {
- xp = guild.getXpFromDatabase(player.getId(player));
- cache.set(player, 2, xp);
- }
- return xp;
- }
- function guild.getXpFromDatabase(player_id) {
- stmt = databank.prepare("SELECT xp FROM guild_jobs WHERE player_id = ? AND active = 1;");
- databank.setInt(stmt, 1, player_id);
- result = databank.execute(stmt);
- xp = 0;
- if(databank.next(result)) {
- xp = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return xp;
- }
- function guild.getClassXpFromDatabase(player_id, class_name) {
- stmt = databank.prepare("SELECT xp FROM guild_jobs WHERE player_id = ? AND name = ?;");
- databank.setInt(stmt, 1, player_id);
- databank.setString(stmt, 2, class_name);
- result = databank.execute(stmt);
- xp = 0;
- if(databank.next(result)) {
- xp = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return xp;
- }
- function guild.setXp(player, xp) {
- cache.set(player, 2, xp);
- stmt = databank.prepare("UPDATE guild_jobs SET xp = ? WHERE player_id = ? AND active = 1;");
- databank.setInt(stmt, 1, xp);
- databank.setInt(stmt, 2, player.getId(player));
- databank.workerExecute(stmt);
- }
- function guild.getId(player) {
- guild_id = cache.get(player, 3);
- if(guild_id == null) {
- guild_id = guild.getIdFromDatabase(player.getId(player));
- cache.set(player, 3, guild_id);
- }
- return guild_id;
- }
- function guild.getIdFromDatabase(player_id) {
- stmt = databank.prepare("SELECT gilden_id FROM gildenplayer WHERE player_id = ?;");
- databank.setInt(stmt, 1, player_id);
- result = databank.execute(stmt);
- guild_id = - player_id;
- while(databank.next(result)) {
- guild_id = databank.getInt(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return guild_id;
- }
- function guild.setId(spieler, guild_id) {
- if(isPlayer(spieler)) {
- player_id = player.getId(spieler);
- } else {
- player_id = spieler;
- }
- if(guild_id == 0) {
- guild_id = player_id * -1;
- }
- cache.set(player.getUuidFromId(player_id), 3, guild_id);
- stmt = databank.prepare("UPDATE gildenplayer SET gilden_id = ? WHERE player_id = ?;");
- databank.setInt(stmt, 1, guild_id);
- databank.setInt(stmt, 2, player_id);
- databank.workerExecute(stmt);
- }
- function guild.hasClass(player, class_name) {
- stmt = databank.prepare("SELECT player_id FROM guild_jobs WHERE player_id = ? AND name = ?;");
- databank.setInt(stmt, 1, player.getId(player));
- databank.setString(stmt, 2, class_name);
- result = databank.execute(stmt);
- hasClass = databank.next(result);
- databank.close(result);
- databank.close(stmt);
- return hasClass;
- }
- function guild.isActiveClass(player, class_name) {
- stmt = databank.prepare("SELECT player_id FROM guild_jobs WHERE player_id = ? AND name = ? AND active = 1;");
- databank.setInt(stmt, 1, player.getId(player));
- databank.setString(stmt, 2, class_name);
- result = databank.execute(stmt);
- isActive = databank.next(result);
- databank.close(result);
- databank.close(stmt);
- return isActive;
- }
- function canExecuteSkill(player, skill_name) {
- needed_class_name = skill.getClassName(skill_name);
- //Existiert der Skill?
- if(needed_class_name == null) {
- return 2;
- }
- class_name = guild.getClass(player);
- //Besitzt der Spieler den richtigen Job für den Skill?
- if(class_name == needed_class_name) {
- //Besitzt der Spieler den richtigen Job-Level für den Skill?
- needed_job_level = skill.getNeededJobLevel(skill_name);
- job_level = guild.getLevel(player);
- if(needed_job_level > job_level) {
- return 5;
- }
- needed_cooldown = (skill.getCooldownConst(skill_name) + skill.getCooldownLvl(skill_name) * job_level) * 1000;
- last_exe_time = skill.getLastExeTime(player, skill_name);
- last_time = time.getMillis() - last_exe_time;
- if(last_time < needed_cooldown) {
- diff_time = text.number(math.roundUp((needed_cooldown - last_time) / 1000));
- player.action(player, concat("§rNoch ", diff_time, "s Cooldown"));
- return 7;
- }
- belagerungsskills_set = getScriptVar("belagerungsskills_set");
- if(set.contains(belagerungsskills_set, skill_name)) {
- gfights = getScriptVar("gfights");
- if(!checkIfPlayerInFight(player)) {
- return 8;
- }
- }
- return true;
- }
- return 3;
- }
- function skill.speak(player, player_name, skill) {
- //Meldung geht an Spieler im Radius von 15
- loc = entity.getLocation(player);
- templist = players.near(loc, 15);
- for(i = 0; i < list.getSize(templist); i++) {
- speakPrefix(list.getIndex(templist, i), "§2Skills", concat("§6", player_name, " §rhat §6", skill, " §rbenutzt"));
- }
- }
- function initSkills() {
- $skills = list.new();
- addSkill("Krieger", "Schwerthieb", "Schwerthieb", read.item("km:skill33"), "Der nächste automatische Angriff verursacht 50% mehr Schaden", 0, 0, 8, 0, 0, false, 149);
- addSkill("Krieger", "Schmerz ertragen", "Schmerzertragen", read.item("km:skill32"), "Du heilst dich über 5 Sekunden für 30% deines Maximalen Lebens", 0, 0, 60, 0, 0, false, 148);
- addSkill("Krieger", "Schildstoß", "Schildstoß", read.item("km:skill30"), "Der anvisierte Gegner wird für 1,5 Sekunden betäubt", 0, 0, 12, 0, 0, false, 146);
- addSkill("Krieger", "Klingenwirbel", "Klingenwirbel", read.item("km:skill27"), "Entfacht einen Klingenwirbel (AOE Radius 3), der über 2,5 Sekunden 2 Schaden verursacht", 0, 0, 25, 0, 0, false, 143);
- addSkill("Krieger", "Eiserner Wille", "EisernerWille", read.item("km:skill25"), "Verringert den physischen Schaden des Anwenders für 10 Sekunden um 20%", 0, 0, 35, 0, 0, false, 141);
- addSkill("Krieger", "Kniezerschmetterer", "Kniezerschmetterer", read.item("km:skill28"), "Der anvisierte Gegner wird für 3 Sekunden bewegungsunfähig", 0, 0, 0, 25, 0, false, 144);
- addSkill("Krieger", "Stürmen", "Stürmen", read.item("km:skill35"), "Stürmt 22 Blöcke in Blickrichtung und erteilt dort AOE Radius 5 für 1,5 Sekunden Langsamkeit", 0, 0, 35, 0, 0, false, 151);
- addSkill("Krieger", "Kriegsruf", "Kriegsruf", read.item("km:skill29"), "Stößt einen furchteinflößenden Schrei aus. Verbündete erhalten Magie- und Feuerresistenz für 15 Sekunden", 0, 0, 40, 0, 0, false, 145);
- addSkill("Krieger", "Drachenhaut", "Drachenhaut", read.item("km:skill24"), "Sämtliche Pfeile prallen am Anwender ab", 0, 0, 50, 0, 0, false, 140);
- addSkill("Krieger", "Wütender Schlag", "WütenderSchlag", read.item("km:skill38"), "Umso weniger Leben der Anwender hat, desto mehr Schaden verursacht er", 0, 0, 25, 0, 0, false, 154);
- addSkill("Krieger", "Schildwall", "Schildwall", read.item("km:skill31"), "Der Anwender und seine Verbündeten erhalten einen starken Rüstungsbuff für 10 Sekunden", 0, 0, 40, 0, 0, false, 147);
- addSkill("Krieger", "Schwertknaufschlag", "Schwertknaufschlag", read.item("km:skill34"), "Der anvisierte Gegner erleidet Übelkeit und kann 3 Sekunden keine Skills einsetzen", 0, 0, 35, 0, 0, false, 150);
- addSkill("Krieger", "Entwaffnen", "Entwaffnen", read.item("km:skill26"), "Der anvisierte Gegner wird entwaffnet und kann für 6 Sekunden keine normalen Angriffe mehr durchführen", 0, 0, 25, 0, 0, false, 142);
- addSkill("Krieger", "Dornenpanzer", "Dornenpanzer", read.item("km:skill23"), "Der Anwender reflektiert 30% des erlittenen physischen Schadens als magischen Schaden an die Schadensquelle", 0, 0, 40, 0, 0, false, 139);
- addSkill("Krieger", "Unbeugsam", "Unbeugsam", read.item("km:skill36"), "Der Anwender wird für 15 Sekunden immun gegen sämtliche Kontrolleffekte", 0, 0, 60, 0, 0, false, 152);
- addSkill("Krieger", "Verspotten", "Verspotten", read.item("km:skill37"), "Der Anwender zieht alle Gegner im Umkreis von 6 Blöcken zu sich und zwingt diese ihn anzugreifen", 0, 0, 70, 0, 0, false, 153);
- addSkill("Krieger", "Belagerungsleiter", "Belagerungsleiter", read.item("km:skill20"), "Setzt am anvisierten Block eine Belagerungsleiter, die sich nach oben und unten ausbreitet", 0, 0, 180, 0, 0, true, 136);
-
- addSkill("Schurke", "Dolchangriff", "Dolchangriff", read.item("km:skill42"), "Der nächste automatische Angriff verursacht 150% Schaden", 0, 0, 0, 0, 0, false, 171);
- addSkill("Schurke", "Bandagieren", "Bandagieren", read.item("km:skill40"), "Heilt sofort 30% des maximalen Lebens", 0, 0, 0, 0, 0, false, 169);
- addSkill("Schurke", "Schattenhieb", "Schattenhieb", read.item("km:skill52"), "Der nächste Hit macht den Anwender für 2 Sekunden unsichtbar + Speed II", 0, 0, 0, 0, 0, false, 181);
- addSkill("Schurke", "Trittnägel", "Trittnägel", read.item("km:skill56"), "Legt an Ort und Stelle Trittnägel aus, die Gegner Schaden und sie verlangsamen", 0, 0, 0, 0, 0, false, 185);
- addSkill("Schurke", "Rauchbombe", "Rauchbombe", read.item("km:skill49"), "Wirft eine Rauchbombe in Blickrichtung, welche Gegnern magischen Schaden zufügt und diese blendet", 0, 0, 0, 0, 0, false, 178);
- addSkill("Schurke", "Schattenform", "Schattenform", read.item("km:skill51"), "Der Anwender geht vorübergehend in die Schattenwelt über. Andere Skills profitieren von Unsichtbarkeit", 0, 0, 0, 0, 0, false, 180);
- addSkill("Schurke", "Festnageln", "Festnageln", read.item("km:skill43"), "Das anvisierte Ziel wird bewegungsunfähig gemacht", 0, 0, 0, 0, 0, false, 172);
- addSkill("Schurke", "Todesblüte", "Todesblüte", read.item("km:skill54"), "Der anvisierte Ziel wird geblendet und erleidet Hunger", 0, 0, 0, 0, 0, false, 183);
- addSkill("Schurke", "Giftklinge", "Giftklinge", read.item("km:skill45"), "Die nächsten 10 Sekunden belegen automatische Angriffe die Ziele mit einem tödlichen Gift", 0, 0, 0, 0, 0, false, 174);
- addSkill("Schurke", "Schattenschritt", "Schattenschritt", read.item("km:skill53"), "Der Anwender teleportiert sich hinter das anvisierte Ziel. Doppelte Reichweite wenn Unsichtbar", 0, 0, 0, 0, 0, false, 182);
- addSkill("Schurke", "Herzsucher", "Herzsucher", read.item("km:skill46"), "Der Anwender führt einen gezielten Stich aus. Je weniger Leben das Ziel hat, desto mehr Schaden erleidet es", 0, 0, 0, 0, 0, false, 175);
- addSkill("Schurke", "Kehlschnitt", "Kehlschnitt", read.item("km:skill48"), "Das anvisierte Ziel wird für 2,5 Sekunden zum Schweigen gebracht", 0, 0, 0, 0, 0, false, 177);
- addSkill("Schurke", "Assassinensiegel", "Assassinensiegel", read.item("km:skill39"), "Der Anwender erhält die nächsten 15 Sekunden keinen Fallschaden", 0, 0, 0, 0, 0, false, 168);
- addSkill("Schurke", "Rückruf", "Rückruf", read.item("km:skill50"), "Der Anwender markiert eine Stelle, zu der er bei erneuter Aktivierung zurückkehrt", 0, 0, 0, 0, 0, false, 179);
- addSkill("Schurke", "Widerhaken", "Widerhaken", read.item("km:skill57"), "Der nächste abgeschossene Pfeil teleportiert den Anwender zum Aufprallort des Pfeils und erschafft eine Plattform unter ihm", 0, 0, 20, 0, 0, false, 186);
- addSkill("Schurke", "Todgeweiht", "Todgeweiht", read.item("km:skill55"), "Der Anwender stürzt sich auf das anvisierte Ziel und markiert es für 5 Sekunden. Das Ziel erleidet 20% seines maximalen Lebens + 10% des in der Zeit erhaltenen Schadens als magischen Schaden nach 5 Sekunden", 0, 0, 0, 0, 0, false, 184);
- addSkill("Barbar", "Axthieb", "Axthieb", read.item("minecraft:white_wool"), "Der nächste automatische Angriff verursacht 50% mehr Schaden", 0, 0, 0, 0, 0, false, 0);
- addSkill("Barbar", "Blutrausch", "Blutrausch", read.item("minecraft:orange_wool"), "Heilt den Anwender für 30% deines maximalen Lebens über 5 Sekunden", 0, 0, 0, 0, 0, false, 0);
- addSkill("Barbar", "Wuchtschlag", "Wuchtschlag", read.item("minecraft:magenta_wool"), "Der nächste Angriff verursacht 100% mehr Schaden und verlangsamt das Ziel für 2 Sekunden", 0, 0, 0, 0, 0, false, 0);
- addSkill("Barbar", "Aggressiver Ausbruch", "AggressiverAusbruch", read.item("minecraft:light_blue_wool"), "Der Anwender verursacht Flächenschaden für die nächsten 5 Sekunden", 0, 0, 0, 0, 0, false, 0);
- addSkill("Barbar", "Innere Wut", "InnereWut", read.item("minecraft:yellow_wool"), "Der Anwender verursacht 30% mehr Sachden für 7 Sekunden", 0, 0, 0, 0, 0, false, 0);
- addSkill("Barbar", "Axtwurf", "Axtwurf", read.item("minecraft:lime_wool"), "Der Anwender wirft eine Axt die am Aufprallort Schaden verursacht und Gegner verlangsamt", 0, 0, 0, 0, 0, false, 0);
- addSkill("Barbar", "Knochenbrecher", "Knochenbrecher", read.item("minecraft:pink_wool"), "Das anvisierte Ziel erhält 14% seines maximalen Lebens als absoluten Schaden sowie Übelkeit", 0, 0, 0, 0, 0, false, 0);
- addSkill("Barbar", "Schlachtruf", "Schlachtruf", read.item("minecraft:gray_wool"), "Der Anwender und Verbündete im Umkreis erhalten Feuerresistenz für 15 Sekunden", 0, 0, 0, 0, 0, false, 0);
- addSkill("Barbar", "Zertrümmern", "Zertrümmern", read.item("minecraft:light_gray_wool"), "Der Anwender verursacht Schaden abhängig von der gehaltenen Waffe und zertrümmert die Rüstung des anvisierten Gegners", 0, 0, 0, 0, 0, false, 0);
- addSkill("Barbar", "Pfad der Narben", "PfadderNarben", read.item("minecraft:cyan_wool"), "Der Anwender erhält 35% Rüstungsdurchdringung für 5 Sekunden", 0, 0, 0, 0, 0, false, 0);
- addSkill("Barbar", "Ausweiden", "Ausweiden", read.item("minecraft:purple_wool"), "Der Anwender schadet dem Ziel und heilt sich für diesen Wert, zudem erhält das Ziel für 5 Sekunden 50% weniger Heilung", 0, 0, 0, 0, 0, false, 0);
- addSkill("Barbar", "Kampfeslust", "Kampfeslust", read.item("minecraft:blue_wool"), "Springt zum anvisierten Ziel, das Ziel erhält Verlangsamung und Blindheit für 2 Sekunden", 0, 0, 0, 0, 0, false, 0);
- addSkill("Barbar", "Verkrüppeln", "Verkrüppeln", read.item("minecraft:brown_wool"), "Das anvisierte Ziel erhält massive Verlangsamung und Übelkeit für 3 Sekunden", 0, 0, 0, 0, 0, false, 0);
- addSkill("Barbar", "Hungernde Klinge", "HungerndeKlinge", read.item("minecraft:green_wool"), "Verursacht 14% des maximalen Lebens des Zieles und lässt es hungern, insofern der Anwender mehr als 50% Leben besitzt", 0, 0, 0, 0, 0, false, 0);
- addSkill("Barbar", "Aufstampfen", "Aufstampfen", read.item("minecraft:red_wool"), "Wirft Gegner im Umkreis hoch", 0, 0, 0, 0, 0, false, 0);
- addSkill("Barbar", "Lebensbrecher", "Lebensbrecher", read.item("minecraft:black_wool"), "Anwender springt zum anvisierten Ziel. Wenn das Ziel weniger als 20% seines maximalen Leben besitzt, wird es für 2 Sekunden festgehalten", 0, 0, 0, 0, 0, false, 0);
-
- addSkill("Jäger", "Schnellschuss", "Schnellschuss", read.item("km:skill12"), "Der Anwender feuert sofort einen Pfeil ab", 0, 0, 3, 0, 0, false, 115);
- addSkill("Jäger", "Trollsalbe", "Trollsalbe", read.item("km:skill18"), "Der Anwender heilt sich für 30% seines maximalen Lebens", 0, 0, 60, 0, 0, false, 121);
- addSkill("Jäger", "Stachelpfeil", "Stachelpfeil", read.item("km:skill16"), "Der nächste Pfeil verlangsamt sein Ziel für 3 Sekunden", 0, 0, 10, 0, 0, false, 119);
- addSkill("Jäger", "Sprung", "Sprung", read.item("km:skill15"), "Der Anwender führt einen elbengleichen Sprung aus", 0, 0, 15, 0, 0, false, 118);
- addSkill("Jäger", "Magentritt", "Magentritt", read.item("km:skill9"), "Das anvisierte Ziel wird weggetreten und erhält Übelkeit", 0, 0, 30, 0, 0, false, 112);
- addSkill("Jäger", "Trägheitspfeil", "Trägheitspfeil", read.item("km:skill17"), "Der nächste Pfeil lässt sein Ziel bewegungsunfähig werden", 0, 0, 30, 0, 0, false, 120);
- addSkill("Jäger", "Netzfalle", "Netzfalle", read.item("km:skill10"), "Legt an Ort und Stelle eine Netzfalle aus. Gegner die darauf treten lösen diese aus", 0, 0, 0, 0, 0, false, 113);
- addSkill("Jäger", "Giftsalve", "Giftsalve", read.item("km:skill7"), "Der Anwender feuert eine Salve aus Pfeilen welche getroffene Ziele leicht vergiften", 0, 0, 25, 0, 0, false, 110);
- addSkill("Jäger", "Brandpfeil", "Brandpfeil", read.item("km:skill4"), "Der nächste Pfeil steckt sein Ziel in Brand", 0, 0, 15, 0, 0, false, 107);
- addSkill("Jäger", "Waldhorn", "Waldhorn", read.item("km:skill19"), "Alle Verbündeten im Umkreis erhalten massives Lauftempo", 0, 0, 40, 0, 0, false, 122);
- addSkill("Jäger", "Arkaner Schuss", "ArkanerSchuss", read.item("km:skill1"), "Das getroffene Ziel wird auf magische Weise zum Anwender teleportiert", 0, 0, 40, 0, 0, false, 104);
- addSkill("Jäger", "Blendpfeil", "Blendpfeil", read.item("km:skill3"), "Der nächste Pfeil lässt sein Ziel für 4 Sekunden erblinden", 0, 0, 30, 0, 0, false, 106);
- addSkill("Jäger", "Schnellfeuer", "Schnellfeuer", read.item("km:skill11"), "Der Anwender feuert eine Salve aus Pfeile, die den Anwender mehr heilen als dem Gegner Schaden zuzufügen", 0, 0, 30, 0, 0, false, 114);
- addSkill("Jäger", "Splitterbombe", "Splitterbombe", read.item("km:skill14"), "Der nächste Pfeil lässt am Aufprallort eine Splitterbombe detonieren, welche Schaden verursacht und Gegner blendet", 0, 0, 0, 0, 0, false, 117);
- addSkill("Jäger", "Dornenranken", "Dornenranken", read.item("km:skill5"), "Mit der Kraft der Natur lässt der Anwender Dornenranken aus der Erde sprießen die Gegner stark vergiften", 0, 0, 40, 0, 0, false, 108);
- addSkill("Jäger", "Blätterkokon", "Blätterkokon", read.item("km:skill2"), "Der Anwender hüllt sich in einen Blätterkokon, wird unverwundbar und regeneriert Leben", 0, 0, 60, 0, 0, false, 105);
- addSkill("Jäger", "Rammbock", "Rammbock", read.item("minecraft:oak_door"), "Der Anwender bricht die anvisierte Tür auf", 0, 0, 0, 0, 0, false, 23);
-
- addSkill("Magier", "Feuergeschoss", "Feuergeschoss", read.item("minecraft:white_wool"), "Beschwört eine Kugel aus Feuer in Blickrichtung, welche Ziele kurz in Brand steckt", 0, 0, 0, 0, 0, false, 0);
- addSkill("Magier", "Wiederherstellung", "Wiederherstellung", read.item("minecraft:orange_wool"), "Heilt 20% max. Leben + 15% max. Mana über 5 Sekunden", 0, 0, 0, 0, 0, false, 0);
- addSkill("Magier", "Eisgeschoss", "Eisgeschoss", read.item("minecraft:magenta_wool"), "Feuert einen spitzen Eiskristall, welcher die Magieresistenz des Zieles durchdringt und es verlangsamt", 0, 0, 0, 0, 0, false, 0);
- addSkill("Magier", "Flammensäule", "Flammensäule", read.item("minecraft:light_blue_wool"), "Entfacht eine gewaltige Flammensäule, welche Gegner im Umkreis schadet und in Brand steckt", 0, 0, 0, 0, 0, false, 0);
- addSkill("Magier", "Manabarriere", "Manabarriere", read.item("minecraft:yellow_wool"), "Wenn aktiv wird für Schaden Mana statt Leben abgezogen", 0, 0, 0, 0, 0, false, 0);
- addSkill("Magier", "Partikelimplosion", "Partikelimplosion", read.item("minecraft:lime_wool"), "Beschwört sämtliche Partikel die Minecraft zu bieten hat und lässt diese miteinander kollidieren. Ausmaße sind unklar", 0, 0, 0, 0, 0, false, 0);
- addSkill("Magier", "Teleportation", "Teleportation", read.item("minecraft:pink_wool"), "Der Anwender teleportiert sich in Blickrichtung", 0, 0, 0, 0, 0, false, 0);
- addSkill("Magier", "korrosive Giftwolke", "korrosiveGiftwolke", read.item("minecraft:gray_wool"), "Der Anwender beschwört eine Giftwolke, welche Ziele die sich in ihr befinden vergiftet", 0, 0, 0, 0, 0, false, 0);
- addSkill("Magier", "Eisstrahl", "Eisstrahl", read.item("minecraft:light_gray_wool"), "Lässt den Anwender einen Eistrahl in Blickrichtung erschaffen. Getroffene Ziele werden kurz festgehalten", 0, 0, 0, 0, 0, false, 0);
- addSkill("Magier", "Blitzschlag", "Blitzschlag", read.item("minecraft:cyan_wool"), "Beschwört einen Blitz, der absoluten Schaden anrichtet", 0, 0, 0, 0, 0, false, 0);
- addSkill("Magier", "Tornado", "Tornado", read.item("minecraft:purple_wool"), "Der Anwender beschwört einen Tornado, welcher Ziele in die Luft wirft", 0, 0, 0, 0, 0, false, 0);
- addSkill("Magier", "Eisgefängnis", "Eisgefängnis", read.item("minecraft:blue_wool"), "Das anvisierte Ziel wird in einem unzerstörbaren Eiskäfig gefangen", 0, 0, 0, 0, 0, false, 0);
- addSkill("Magier", "Hexenwerk", "Hexenwerk", read.item("minecraft:brown_wool"), "", 0, 0, 0, 0, 0, false, 0);
- addSkill("Magier", "Blizzard", "Blizzard", read.item("minecraft:green_wool"), "Der Anwender hüllt sich in eine Rüstung aus dunklem Eis und entfacht einen Blizzard um sich, welcher Gegner Schaden zufügt und sie massiv verlangsamt", 0, 0, 0, 0, 0, false, 0);
- addSkill("Magier", "Gewittersturm", "Gewittersturm", read.item("minecraft:red_wool"), "Entfacht einen gewaltigen Gewittersturm der mehrere Blitze entsendet", 0, 0, 0, 0, 0, false, 0);
- addSkill("Magier", "Urzeitknall", "Urzeitknall", read.item("minecraft:black_wool"), "Das anvisierte Ziel erfährt gewaltige Arkane Energien. Umso weniger Leben das Ziel hat, desto mehr Schaden erleidet es", 0, 0, 0, 0, 0, false, 0);
-
- addSkill("Mönch", "harmonischer Hieb", "harmonischerHieb", read.item("minecraft:white_wool"), "Der nächste automatische Angriff verursacht 250% mehr Schaden", 0, 0, 0, 0, 0, false, 0);
- addSkill("Mönch", "Heilen", "Heilen", read.item("minecraft:orange_wool"), "Der Anwender heilt 25% maximales Leben. Kann auf Verbündete angewendet werden", 0, 0, 0, 0, 0, false, 0);
- addSkill("Mönch", "Verbannung", "Verbannung", read.item("minecraft:magenta_wool"), "Das anvisierte Ziel erhält 150% Waffenschaden. Falls es sich um einen Zombie handelt, verdoppelt sich der Wert auf 300%", 0, 0, 0, 0, 0, false, 0);
- addSkill("Mönch", "Kreis der Heilung", "KreisderHeilung", read.item("minecraft:light_blue_wool"), "Heilt alle Verbündeten im Umkreis von 5 Blöcken", 0, 0, 0, 0, 0, false, 0);
- addSkill("Mönch", "Lichtschild", "Lichtschild", read.item("minecraft:yellow_wool"), "Verhindert bis zu 100 magischen Schaden am anvisierten Ziel", 0, 0, 0, 0, 0, false, 0);
- addSkill("Mönch", "Heilige Eile", "HeiligeEile", read.item("minecraft:lime_wool"), "Verbündete im Umkreis erhalten Lauftempo und Eile", 0, 0, 0, 0, 0, false, 0);
- addSkill("Mönch", "Segen sprechen", "Segensprechen", read.item("minecraft:pink_wool"), "Gibt positive Effekte vom Anwender an anvisierten Verbündeten. Bei beiden werden die Effekte um 20% verlängert", 0, 0, 0, 0, 0, false, 0);
- addSkill("Mönch", "Glaubensexplosion", "Glaubensexplosion", read.item("minecraft:gray_wool"), "Verursacht Flächenschaden an Gegnern. Heilt Verbündete", 0, 0, 0, 0, 0, false, 0);
- addSkill("Mönch", "Himmlische Gabe", "HimmlischeGabe", read.item("minecraft:light_gray_wool"), "Der Anwender platziert eine Reliquie welche von Verbündeten angeklickt werden kann um sich zum Anwender teleportieren zu lassen", 0, 0, 0, 0, 0, false, 0);
- addSkill("Mönch", "Helfende Hand", "HelfendeHand", read.item("minecraft:cyan_wool"), "Springt zum anvisierten Verbündeten. Beide erhalten Lauftempo", 0, 0, 0, 0, 0, false, 0);
- addSkill("Mönch", "unnachgiebige Aura", "unnachgiebigeAura", read.item("minecraft:purple_wool"), "Alle aktiven Effekte von Verbündeten in der Nähe werden verlängert", 0, 0, 0, 0, 0, false, 0);
- addSkill("Mönch", "Mondgewalt", "Mondgewalt", read.item("minecraft:blue_wool"), "Alle Verbündeten in der Nähe erhalten Sprungkraft", 0, 0, 0, 0, 0, false, 0);
- addSkill("Mönch", "Trugschluss", "Trugschluss", read.item("minecraft:brown_wool"), "", 0, 0, 0, 0, 0, false, 0);
- addSkill("Mönch", "Engelsfeder", "Engelsfeder", read.item("minecraft:green_wool"), "Entfernt alle negativen Effekte vom anvisierten Verbündeten", 0, 0, 0, 0, 0, false, 0);
- addSkill("Mönch", "Voodoo", "Voodoo", read.item("minecraft:red_wool"), "Wendet einen Voodoozauber auf einen Gegner an. Schaden den der Anwender in den nächsten 5 Sekunden erleidet wird an den verzauberten weitergegeben", 0, 0, 0, 0, 0, false, 0);
- addSkill("Mönch", "Heiliger Schein", "HeiligerSchein", read.item("minecraft:black_wool"), "Nach 2,5 Sekunden werden alle Verbündeten im Umkreis für 3 Sekunden unverwundbar", 0, 0, 0, 0, 0, false, 0);
- setScriptVar("skills", $skills);
- }
- function addSkill(class_name, skill_name, label_name, item, description, mana_const, mana_lvl, cooldown_const, cooldown_lvl, needed_job_level, belagerung, icon_id) {
- skill = array.new(12);
- skill[0] = class_name;
- skill[1] = skill_name;
- skill[2] = label_name;
- skill[3] = item;
- skill[4] = description;
- skill[5] = mana_const;
- skill[6] = mana_lvl;
- skill[7] = cooldown_const; //s
- skill[8] = cooldown_lvl; //s
- skill[9] = needed_job_level;
- skill[10] = belagerung;
- skill[11] = icon_id;
- list.add($skills, skill);
- }
- function getSkillsFromJob(class_name) {
- skills = getScriptVar("skills");
- list.new(list);
- for(i = 0; i < list.getSize(skills); i++) {
- array = list.getIndex(skills, i);
- temp_job_name = array[0];
- skill_name = array[1];
- if(temp_job_name == class_name) {
- list.add(list, skill_name);
- }
- }
- return list;
- }
- function skill.getWusi(skill_name, index) {
- skills = getScriptVar("skills");
- for(i = 0; i < list.getSize(skills); i++) {
- array = list.getIndex(skills, i);
- temp_skill_name = array[1];
- if(temp_skill_name == skill_name) {
- wusi = array[index];
- }
- }
- return wusi;
- }
- function skill.getClassName(skill_name) {
- return skill.getWusi(skill_name, 0);
- }
- function skill.getLabel(skill_name) {
- return skill.getWusi(skill_name, 2);
- }
- function skill.getItem(skill_name) {
- return skill.getWusi(skill_name, 3);
- }
- function skill.getDescription(skill_name) {
- return skill.getWusi(skill_name, 4);
- }
- function skill.getManaConst(skill_name) {
- return skill.getWusi(skill_name, 5);
- }
- function skill.getManaLvl(skill_name) {
- return skill.getWusi(skill_name, 6);
- }
- function skill.getCooldownConst(skill_name) {
- return skill.getWusi(skill_name, 7);
- }
- function skill.getCooldownLvl(skill_name) {
- return skill.getWusi(skill_name, 8);
- }
- function skill.getNeededJobLevel(skill_name) {
- return skill.getWusi(skill_name, 9);
- }
- function skill.getIconId(skill_name) {
- return skill.getWusi(skill_name, 11);
- }
- function hotkey.set(player, class_name, key_index, skill_name) {
- stmt = databank.prepare("INSERT INTO hotkeys (player_id, class_name, key_index, skill_name) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE hotkeys.skill_name=?");
- databank.setInt(stmt, 1, player.getId(player));
- databank.setString(stmt, 2, class_name);
- databank.setInt(stmt, 3, key_index);
- databank.setString(stmt, 4, skill_name);
- databank.setString(stmt, 5, skill_name);
- databank.workerExecute(stmt);
- }
- function hotkey.get(player, class_name, key_index) {
- temp = null;
- stmt = databank.prepare("SELECT skill_name FROM hotkeys WHERE player_id = ? AND class_name = ? AND key_index = ?");
- databank.setInt(stmt, 1, player.getId(player));
- databank.setString(stmt, 2, class_name);
- databank.setInt(stmt, 3, key_index);
- result = databank.execute(stmt);
- if(databank.next(result)) {
- temp = databank.getString(result, 1);
- }
- databank.close(result);
- databank.close(stmt);
- return temp;
- }
- function hotkey.del(player, class_name, key_index) {
- stmt = databank.prepare("DELETE FROM hotkeys WHERE player_id = ? AND class_name = ? AND key_index = ?");
- databank.setInt(stmt, 1, player.getId(player));
- databank.setString(stmt, 2, class_name);
- databank.setInt(stmt, 3, key_index);
- databank.workerExecute(stmt);
- }
- function skill.setLastExeTime(player, skill_name) {
- player_id = player.getId(player);
- last_exe_times = getScriptVar("last_exe_times");
- player_map = map.getOrDefault(last_exe_times, player_id, map.new());
- map.add(player_map, skill_name, time.getMillis());
- map.add(last_exe_times, player_id, player_map);
- setScriptVar("last_exe_times", last_exe_times);
- }
- function skill.getLastExeTime(player, skill_name) {
- last_exe_times = getScriptVar("last_exe_times");
- player_map = map.get(last_exe_times, player.getId(player));
- if(player_map == null) {
- time = 0;
- } else {
- time = map.getOrDefault(player_map, skill_name, 0);
- }
- return time;
- }
- function guild.setBlock(loc, type, list) {
- if(setBlockIfNotAir(loc, type)) {
- list.add(list, loc);
- }
- return list;
- }
|