„Main HUD v0.07.02“ ändern
parent
6b61c4b242
commit
46a9640203
|
@ -1,4 +1,4 @@
|
||||||
// 4Creative Game System - Main HUD v0.7.1
|
// 4Creative Game System - Main HUD [v0.07.02]
|
||||||
|
|
||||||
// ToDo:
|
// ToDo:
|
||||||
// - Gegestände verarbeiten einbauen (Pfeilspitze + Holz = Pfeil)
|
// - Gegestände verarbeiten einbauen (Pfeilspitze + Holz = Pfeil)
|
||||||
|
@ -7,30 +7,42 @@
|
||||||
// - Meter bauen
|
// - Meter bauen
|
||||||
// - Max. Traglast = Level * 2 Gegenstände (In Items einbauen)
|
// - Max. Traglast = Level * 2 Gegenstände (In Items einbauen)
|
||||||
// - Anzahl gesammelter Gegenstände vom Level und Zufall abhängig
|
// - Anzahl gesammelter Gegenstände vom Level und Zufall abhängig
|
||||||
|
// - HUD muss nach TP den Status abfragen und ggf. den Timer ausschalten.
|
||||||
|
// - Wenn inaktiv oder abgeschaltet statt Level entspr. Text anzeigen
|
||||||
|
// - Game Option: Avatar verlangsamen, wenn max. Gewicht fast erreicht ist.
|
||||||
|
// - Baklenfarben ändern (von gelb in violett)
|
||||||
|
// - Game Option: Meter immer sichtbar oder nur bei Bedaf (dann wie lange sichtbar?)
|
||||||
|
// - Objekt HUDs mit 1, 2, 3, 4 Plätzen bauen.
|
||||||
|
|
||||||
// ► ◄ █ ▄ ■ ▲ ▼ © ▓ ░ ─ ↑ ↓ ▲ ▼ ✔ ✘ • ♫ « »
|
// ► ◄ █ ▄ ■ ▲ ▼ © ▓ ░ ─ ↑ ↓ ▲ ▼ ✔ ✘ • ♫ « »
|
||||||
|
|
||||||
integer m_min = FALSE; // HUD minimiert?
|
integer m_min = FALSE; // HUD minimiert?
|
||||||
integer m_num_slots = 8; // Anzahl Slots, die der Spieler hat.
|
integer m_max_slots = 8; // Anzahl mx. erreichbare Slots (Wird in allen Objekten vom Setup Tool gesetzt)
|
||||||
integer m_max_slots = 8; // Anzahl mx. erreichbare Slots (WICHTIG: AUCH IN JEDEM ITEM SETZEN!)
|
float m_maxweight = 0.0; // Max. Traglasgt bei Level 0.
|
||||||
integer m_refreshtime = 190; // Nach welcher Zeit soll das HUD aktualisiert werden.
|
integer m_refreshtime = 183; // Nach welcher Zeit soll das HUD aktualisiert werden (Wird vom Setup Tool vorgegeben).
|
||||||
integer m_listener_socket = 0;
|
integer m_listener_socket = 0;
|
||||||
integer m_listener_channel = 0;
|
integer m_listener_channel = 0;
|
||||||
list m_last_touch = [];
|
list m_last_touch = [];
|
||||||
string m_listener_state = "";
|
string m_listener_state = "";
|
||||||
string m_last_action = "";
|
string m_last_action = "";
|
||||||
|
integer m_lastlevel = -1; // Wird für Level Up benötigt.
|
||||||
|
integer regchan = -1; // Wird für regionsweite Messages vom Setup Tool benötigt
|
||||||
|
integer reghandler = -1;
|
||||||
|
|
||||||
string m_lang_groupMessage = "Das Sammelsystem ist hier noch nicht eingerichtet! Bitte benutze das Setup-Tool.";
|
string m_lang_groupMessage = "Das 4CDS Spielsystem ist hier noch nicht eingerichtet! Bitte benutze das Setup-Tool.";
|
||||||
|
string m_lang_groupMessage_hud = "4CGS NICHT EINGERICHTET!";
|
||||||
|
string m_lang_regionchange = "REGIONSWECHSEL...";
|
||||||
|
string m_lang_disabled = "Das 4CDS Spielsystem ist derzeit deaktiviert.";
|
||||||
|
string m_lang_disabled_hud = "4CGS DEAKTIVIERT";
|
||||||
string m_lang_blueBoxDescText = "Was willst du mit '{0}' machen?\n \n{1}";
|
string m_lang_blueBoxDescText = "Was willst du mit '{0}' machen?\n \n{1}";
|
||||||
string m_lang_useToOther = "Auf wen möchtest du ' {0}' anwenden?";
|
string m_lang_useToOther = "Auf wen möchtest du ' {0}' anwenden?";
|
||||||
string m_lang_deleteConfirm = "Dies ist ein wichtiges, vielleicht sogar ein einzigartiges Item. Bist du dir wirklich sicher dass du dieses Item nicht mehr brauchst?";
|
string m_lang_deleteConfirm = "Dies ist ein wichtiges, vielleicht sogar ein einzigartiges Gegenstand. Bist du dir wirklich sicher dass du {0} nicht mehr brauchst?";
|
||||||
string m_lang_sendToOther = "An wen möchtest Du '{0}' weitergeben?";
|
string m_lang_sendToOther = "An wen möchtest Du '{0}' weitergeben?";
|
||||||
string m_lang_selectActions = "Was möchtest Du mit '{0}' machen?";
|
string m_lang_selectActions = "Was möchtest Du mit '{0}' machen?";
|
||||||
string m_lang_avatarNotOnRegion = "{0} ist nicht mehr auf der Region.";
|
string m_lang_avatarNotOnRegion = "{0} ist nicht mehr auf der Region.";
|
||||||
string m_lang_noFreeSlot = "{0} hat keinen freien Inventarplatz mehr!";
|
string m_lang_noFreeSlot = "{0} hat keinen freien Inventarplatz mehr!";
|
||||||
string m_lang_getItem = "{0} hat Dir {1} gegeben.";
|
string m_lang_getItem = "{0} hat Dir {1} gegeben.";
|
||||||
string m_lang_deleteText = "Du hast {0} weggeworfen.";
|
string m_lang_deleteText = "Du hast {0} x {1} weggeworfen. Deine Traglast erhöht sich um {2}kg auf {3}kg.";
|
||||||
string m_lang_toHighWeight = "Dies kann nicht mehr getragen werden.";
|
|
||||||
string m_lang_ja = "JA";
|
string m_lang_ja = "JA";
|
||||||
string m_lang_nein = "NEIN";
|
string m_lang_nein = "NEIN";
|
||||||
string m_lang_leveltext = "Level: {0} [XP: {1}]";
|
string m_lang_leveltext = "Level: {0} [XP: {1}]";
|
||||||
|
@ -55,6 +67,17 @@ list m_dataUserStore = [];
|
||||||
list m_current = [];
|
list m_current = [];
|
||||||
integer m_playsound = TRUE;
|
integer m_playsound = TRUE;
|
||||||
|
|
||||||
|
getregionchannel()
|
||||||
|
{
|
||||||
|
list lstParcelDetails = llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_ID, PARCEL_DETAILS_AREA]);
|
||||||
|
regchan = (integer)("0x" + llGetSubString(llList2String(lstParcelDetails, 0), 0, 7));
|
||||||
|
if(regchan > 0)
|
||||||
|
regchan = -regchan;
|
||||||
|
|
||||||
|
llListenRemove(reghandler);
|
||||||
|
reghandler = llListen(regchan, "", "", "" );
|
||||||
|
}
|
||||||
|
|
||||||
change_iconsize(integer prim)
|
change_iconsize(integer prim)
|
||||||
{
|
{
|
||||||
string primname = llGetLinkName(prim);
|
string primname = llGetLinkName(prim);
|
||||||
|
@ -99,6 +122,7 @@ minmax()
|
||||||
|
|
||||||
updateTime(integer _update)
|
updateTime(integer _update)
|
||||||
{
|
{
|
||||||
|
// Wenn System inaktiv ist, nichts abziehen!
|
||||||
integer _checkTime = llGetUnixTime() - (integer)getDataEntryFromDataList(m_dataUserStore, "stats.lastCheck");
|
integer _checkTime = llGetUnixTime() - (integer)getDataEntryFromDataList(m_dataUserStore, "stats.lastCheck");
|
||||||
|
|
||||||
integer _food = (integer)getDataEntryFromDataList(m_dataUserStore, "stats.essen");
|
integer _food = (integer)getDataEntryFromDataList(m_dataUserStore, "stats.essen");
|
||||||
|
@ -110,8 +134,9 @@ updateTime(integer _update)
|
||||||
integer _currentMin = 0;
|
integer _currentMin = 0;
|
||||||
for(_currentMin = 1; _currentMin <= (_checkTime / 60); ++_currentMin)
|
for(_currentMin = 1; _currentMin <= (_checkTime / 60); ++_currentMin)
|
||||||
{
|
{
|
||||||
_food = _food - (integer)getDataEntryFromDataList(m_dataUserStore, "stats.levels.sub_food");
|
_food -= (integer)getDataEntryFromDataList(m_dataUserStore, "stats.levels.sub_food");
|
||||||
_water = _water - (integer)getDataEntryFromDataList(m_dataUserStore, "stats.levels.sub_water");
|
_water -= (integer)getDataEntryFromDataList(m_dataUserStore, "stats.levels.sub_water");
|
||||||
|
//llOwnerSay("FOOD: " + (string)_food + " " + (string)_water);
|
||||||
_updatedStats = TRUE;
|
_updatedStats = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,17 +156,40 @@ default
|
||||||
{
|
{
|
||||||
state_entry()
|
state_entry()
|
||||||
{
|
{
|
||||||
|
getregionchannel();
|
||||||
|
llSetLinkPrimitiveParamsFast(osGetLinkNumber("level-anzeige"), [PRIM_TEXT, m_lang_init, <1, 0.8, 0>, 1]);
|
||||||
llPreloadSound("click");
|
llPreloadSound("click");
|
||||||
llPreloadSound("inventar");
|
llPreloadSound("inventar");
|
||||||
m_dataStore = getDataListFromDataStorage("game.hud");
|
m_dataStore = getDataListFromDataStorage("game.hud");
|
||||||
m_dataUserStore = getDataListFromDataStorage("game.hud.player." + llGetOwner());
|
m_dataUserStore = getDataListFromDataStorage("game.hud.player." + llGetOwner());
|
||||||
|
m_max_slots = getDataEntryFromDataList(m_dataStore, "hud.slots");
|
||||||
|
if((integer)checkDataEntryInDataList(m_dataStore, "enable") == TRUE)
|
||||||
|
{
|
||||||
|
if((integer)getDataEntryFromDataList(m_dataStore, "stats.enable") == TRUE)
|
||||||
|
{
|
||||||
llSetTimerEvent(m_refreshtime);
|
llSetTimerEvent(m_refreshtime);
|
||||||
startGame();
|
startGame();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
llOwnerSay(m_lang_disabled);
|
||||||
|
disableBalken();
|
||||||
|
llSetTimerEvent(0);
|
||||||
|
llSetLinkPrimitiveParamsFast(osGetLinkNumber("level-anzeige"), [PRIM_TEXT, m_lang_disabled_hud, <1, 0.8, 0>, 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
llOwnerSay(m_lang_groupMessage);
|
||||||
|
disableBalken();
|
||||||
|
llSetTimerEvent(0);
|
||||||
|
llSetLinkPrimitiveParamsFast(osGetLinkNumber("level-anzeige"), [PRIM_TEXT, m_lang_groupMessage_hud, <1, 0.8, 0>, 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
timer()
|
timer()
|
||||||
{
|
{
|
||||||
|
|
||||||
m_dataStore = getDataListFromDataStorage("game.hud");
|
m_dataStore = getDataListFromDataStorage("game.hud");
|
||||||
m_dataUserStore = getDataListFromDataStorage("game.hud.player." + llGetOwner());
|
m_dataUserStore = getDataListFromDataStorage("game.hud.player." + llGetOwner());
|
||||||
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "stats.lastCheck", llGetUnixTime());
|
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "stats.lastCheck", llGetUnixTime());
|
||||||
|
@ -152,20 +200,38 @@ default
|
||||||
{
|
{
|
||||||
if(id)
|
if(id)
|
||||||
{
|
{
|
||||||
m_dataStore = getDataListFromDataStorage("game.hud");
|
llResetScript();
|
||||||
m_dataUserStore = getDataListFromDataStorage("game.hud.player." + llGetOwner());
|
// m_dataStore = getDataListFromDataStorage("game.hud");
|
||||||
|
// m_dataUserStore = getDataListFromDataStorage("game.hud.player." + llGetOwner());
|
||||||
|
|
||||||
updateTime(FALSE);
|
// updateTime(FALSE);
|
||||||
startGame();
|
// startGame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
touch_start(integer i)
|
touch_start(integer i)
|
||||||
{
|
{
|
||||||
change_iconsize(llDetectedLinkNumber(0));
|
|
||||||
m_dataStore = getDataListFromDataStorage("game.hud");
|
m_dataStore = getDataListFromDataStorage("game.hud");
|
||||||
m_dataUserStore = getDataListFromDataStorage("game.hud.player." + llGetOwner());
|
m_dataUserStore = getDataListFromDataStorage("game.hud.player." + llGetOwner());
|
||||||
|
change_iconsize(llDetectedLinkNumber(0));
|
||||||
|
if(checkDataEntryInDataList(m_dataStore, "enable") == FALSE)
|
||||||
|
{
|
||||||
|
llOwnerSay(m_lang_groupMessage);
|
||||||
|
disableBalken();
|
||||||
|
osMessageAttachments(llGetOwner(), "4CGS-DISABLE", [ATTACH_HUD_CENTER_1, ATTACH_HUD_CENTER_2], 0);
|
||||||
|
llSetLinkPrimitiveParamsFast(osGetLinkNumber("level-anzeige"), [PRIM_TEXT, m_lang_groupMessage_hud, <1, 0.8, 0>, 1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((integer)getDataEntryFromDataList(m_dataStore, "stats.enable") == FALSE)
|
||||||
|
{
|
||||||
|
llOwnerSay(m_lang_disabled);
|
||||||
|
disableBalken();
|
||||||
|
osMessageAttachments(llGetOwner(), "4CGS-DISABLE", [ATTACH_HUD_CENTER_1, ATTACH_HUD_CENTER_2], 0);
|
||||||
|
llSetLinkPrimitiveParamsFast(osGetLinkNumber("level-anzeige"), [PRIM_TEXT, m_lang_disabled_hud, <1, 0.8, 0>, 1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
osMessageAttachments(llGetOwner(), "4CGS-ENABLE", [ATTACH_HUD_CENTER_1, ATTACH_HUD_CENTER_2], 0);
|
||||||
m_last_touch = llParseString2List(llGetLinkName(llDetectedLinkNumber(0)), ["-"], []);
|
m_last_touch = llParseString2List(llGetLinkName(llDetectedLinkNumber(0)), ["-"], []);
|
||||||
m_listener_state = "main";
|
m_listener_state = "main";
|
||||||
|
|
||||||
|
@ -180,9 +246,7 @@ default
|
||||||
if(_inventarItemName != "")
|
if(_inventarItemName != "")
|
||||||
{
|
{
|
||||||
list _aktionen = [m_lang_kill, m_lang_use, m_lang_give];
|
list _aktionen = [m_lang_kill, m_lang_use, m_lang_give];
|
||||||
|
|
||||||
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "selected", _inventarSlot);
|
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "selected", _inventarSlot);
|
||||||
|
|
||||||
saveDataListToDataStorage(m_dataUserStore, "game.hud.player." + llGetOwner());
|
saveDataListToDataStorage(m_dataUserStore, "game.hud.player." + llGetOwner());
|
||||||
llDialog(llDetectedKey(0), line + "\n" + osFormatString(m_lang_blueBoxDescText, [_inventarItemDisplayName, _inventarItemBeschreibung]), _aktionen, m_listener_channel);
|
llDialog(llDetectedKey(0), line + "\n" + osFormatString(m_lang_blueBoxDescText, [_inventarItemDisplayName, _inventarItemBeschreibung]), _aktionen, m_listener_channel);
|
||||||
return;
|
return;
|
||||||
|
@ -207,12 +271,19 @@ default
|
||||||
{
|
{
|
||||||
m_dataStore = getDataListFromDataStorage("game.hud");
|
m_dataStore = getDataListFromDataStorage("game.hud");
|
||||||
m_dataUserStore = getDataListFromDataStorage("game.hud.player." + llGetOwner());
|
m_dataUserStore = getDataListFromDataStorage("game.hud.player." + llGetOwner());
|
||||||
|
|
||||||
if(left(message, ";") == "gamecommand")
|
if(left(message, ";") == "gamecommand")
|
||||||
{
|
{
|
||||||
if(right(message, ";") == "reload")
|
if(right(message, ";") == "reload")
|
||||||
|
{
|
||||||
|
if(llSubStringIndex(llKey2Name(id), "4CGS - Control-Terminal") != -1)
|
||||||
|
{
|
||||||
|
disableBalken();
|
||||||
|
llSetLinkPrimitiveParamsFast(osGetLinkNumber("level-anzeige"), [PRIM_TEXT, m_lang_init, <1, 0.5, 0>, 1]);
|
||||||
|
llSleep(2.5);
|
||||||
|
}
|
||||||
refreshData();
|
refreshData();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
integer _inventarSlot = llList2String(m_last_touch, 2);
|
integer _inventarSlot = llList2String(m_last_touch, 2);
|
||||||
|
@ -230,6 +301,7 @@ default
|
||||||
{
|
{
|
||||||
if(_inventarItemDUnique != "TRUE")
|
if(_inventarItemDUnique != "TRUE")
|
||||||
{
|
{
|
||||||
|
llOwnerSay(osFormatString(m_lang_deleteText, [getDataEntryFromDataList(m_dataUserStore, "inventar.slot." + _inventarSlot + ".count"), _inventarItemDisplayName, llGetSubString(calcPlayerWeight(m_dataUserStore), 0, llSubStringIndex(calcPlayerWeight(m_dataUserStore), ".") + 2), llGetSubString(getMaxPlayerWeight(m_dataUserStore), 0, llSubStringIndex(getMaxPlayerWeight(m_dataUserStore), ".") + 2)]));
|
||||||
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "inventar.slot." + _inventarSlot, "");
|
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "inventar.slot." + _inventarSlot, "");
|
||||||
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "inventar.slot." + _inventarSlot + ".count", "0");
|
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "inventar.slot." + _inventarSlot + ".count", "0");
|
||||||
refreshData();
|
refreshData();
|
||||||
|
@ -238,7 +310,7 @@ default
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_listener_state = "confirmDelete";
|
m_listener_state = "confirmDelete";
|
||||||
llDialog(llGetOwner(), m_lang_deleteConfirm, [m_lang_ja, m_lang_nein], m_listener_channel);
|
llDialog(llGetOwner(), osFormatString(m_lang_deleteConfirm, [_inventarItemDisplayName]), [m_lang_ja, m_lang_nein], m_listener_channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -311,7 +383,7 @@ default
|
||||||
|
|
||||||
if(getMaxPlayerWeight(_selectedTargetAvatarDataStorage) < calcPlayerWeight(_selectedTargetAvatarDataStorage))
|
if(getMaxPlayerWeight(_selectedTargetAvatarDataStorage) < calcPlayerWeight(_selectedTargetAvatarDataStorage))
|
||||||
{
|
{
|
||||||
llOwnerSay(m_lang_toHighWeight);
|
llOwnerSay(osFormatString(m_lang_maxweight, [llGetSubString((string)getMaxPlayerWeight(_selectedTargetAvatarDataStorage), llSubStringIndex((string)getMaxPlayerWeight(_selectedTargetAvatarDataStorage), ".") + 2, -1)]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +402,7 @@ default
|
||||||
saveDataListToDataStorage(m_dataUserStore, "game.hud.player." + llGetOwner());
|
saveDataListToDataStorage(m_dataUserStore, "game.hud.player." + llGetOwner());
|
||||||
|
|
||||||
refreshData();
|
refreshData();
|
||||||
llRegionSay((integer)getDataEntryFromDataList(_selectedTargetAvatarDataStorage, "channel"), "gamecommand;reload");
|
llRegionSay((integer)(integer)getDataEntryFromDataList(_selectedTargetAvatarDataStorage, "channel"), "gamecommand;reload");
|
||||||
llRegionSayTo(_selectedTargetAvatar, 0, osFormatString(m_lang_getItem, [llList2String(llParseString2List(llKey2Name(llGetOwner()), [" "], [""]), 0), _inventarItemDisplayName]));
|
llRegionSayTo(_selectedTargetAvatar, 0, osFormatString(m_lang_getItem, [llList2String(llParseString2List(llKey2Name(llGetOwner()), [" "], [""]), 0), _inventarItemDisplayName]));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -343,6 +415,7 @@ default
|
||||||
{
|
{
|
||||||
if(message == m_lang_ja)
|
if(message == m_lang_ja)
|
||||||
{
|
{
|
||||||
|
llOwnerSay(osFormatString(m_lang_deleteText, [getDataEntryFromDataList(m_dataUserStore, "inventar.slot." + _inventarSlot + ".count")]));
|
||||||
setDataEntryInDataList(m_dataUserStore, "inventar.slot." + _inventarSlot, "");
|
setDataEntryInDataList(m_dataUserStore, "inventar.slot." + _inventarSlot, "");
|
||||||
setDataEntryInDataList(m_dataUserStore, "inventar.slot." + _inventarSlot + ".count", "0");
|
setDataEntryInDataList(m_dataUserStore, "inventar.slot." + _inventarSlot + ".count", "0");
|
||||||
saveDataListToDataStorage(m_dataUserStore, "game.hud.player." + llGetOwner());
|
saveDataListToDataStorage(m_dataUserStore, "game.hud.player." + llGetOwner());
|
||||||
|
@ -377,12 +450,39 @@ default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dataserver(key id, string msg)
|
||||||
|
{
|
||||||
|
if(llSubStringIndex(llKey2Name(id), "4CGS") != -1)
|
||||||
|
{
|
||||||
|
if(llSubStringIndex(msg, "4CGS-DAMAGE:") != -1)
|
||||||
|
{
|
||||||
|
integer _hp = (integer)getDataEntryFromDataList(m_dataUserStore, "stats.hp");
|
||||||
|
integer _damage = (integer)osReplaceString(msg, "4CGS-DAMAGE:", "", -1, 0);
|
||||||
|
if(_hp == 0)
|
||||||
|
return;
|
||||||
|
_hp -= _damage;
|
||||||
|
if(_hp <= 0)
|
||||||
|
{
|
||||||
|
_hp = 0;
|
||||||
|
osMessageAttachments(id, "4CGS-DIE", [31, 32, 33, 34, 35, 36, 37, 38], 0);
|
||||||
|
}
|
||||||
|
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "stats.hp", (string)_hp);
|
||||||
|
saveDataListToDataStorage(m_dataUserStore, "game.hud.player." + llGetOwner());
|
||||||
|
refreshData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
changed(integer change)
|
changed(integer change)
|
||||||
{
|
{
|
||||||
if(change & CHANGED_TELEPORT)
|
if(change & (CHANGED_REGION | CHANGED_INVENTORY))
|
||||||
{
|
{
|
||||||
m_dataStore = getDataListFromDataStorage("game.hud");
|
llSetLinkPrimitiveParamsFast(osGetLinkNumber("level-anzeige"), [PRIM_TEXT, m_lang_regionchange, <1, 0.5, 0>, 1]);
|
||||||
refreshData();
|
cleanGameState();
|
||||||
|
llSleep(5);
|
||||||
|
llResetScript();
|
||||||
|
//m_dataStore = getDataListFromDataStorage("game.hud");
|
||||||
|
//refreshData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -395,28 +495,32 @@ cleanGameState()
|
||||||
llListenRemove(m_listener_socket);
|
llListenRemove(m_listener_socket);
|
||||||
|
|
||||||
integer i;
|
integer i;
|
||||||
for(i = 1; i < m_num_slots; i++)
|
for(i = 1; i < m_max_slots; i++)
|
||||||
{
|
{
|
||||||
setInventarSlotImage(i, TEXTURE_BLANK, 0);
|
setInventarSlotImage(i, TEXTURE_BLANK, 0);
|
||||||
setInventarSlotCountNumber(i, 0);
|
setInventarSlotCountNumber(i, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
setLevelDisplayNumber(0, 0);
|
disableBalken();
|
||||||
|
}
|
||||||
|
|
||||||
|
disableBalken()
|
||||||
|
{
|
||||||
|
setLevelDisplayNumber(0, 0, 0);
|
||||||
setBalkenValue("wasser", 0);
|
setBalkenValue("wasser", 0);
|
||||||
setBalkenValue("essen", 0);
|
setBalkenValue("essen", 0);
|
||||||
setBalkenValue("xp", 0);
|
setBalkenValue("xp", 0);
|
||||||
setBalkenValue("hp", 0);
|
setBalkenValue("hp", 0);
|
||||||
setBalkenValue("weight", 0);
|
setBalkenValue("weight", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
startGame()
|
startGame()
|
||||||
{
|
{
|
||||||
cleanGameState();
|
cleanGameState();
|
||||||
|
disableBalken();
|
||||||
if(checkDataEntryInDataList(m_dataStore, "enable") == FALSE || getDataEntryFromDataList(m_dataStore, "enable") == "FALSE")
|
if((integer)checkDataEntryInDataList(m_dataStore, "enable") == FALSE || (integer)getDataEntryFromDataList(m_dataStore, "enable") == FALSE)
|
||||||
{
|
{
|
||||||
llOwnerSay(m_lang_groupMessage);
|
llOwnerSay(m_lang_groupMessage);
|
||||||
|
disableBalken();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,14 +542,11 @@ startGame()
|
||||||
if(checkDataEntryInDataList(m_dataUserStore, "stats.hp") == FALSE)
|
if(checkDataEntryInDataList(m_dataUserStore, "stats.hp") == FALSE)
|
||||||
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "stats.hp", "100");
|
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "stats.hp", "100");
|
||||||
|
|
||||||
if(checkDataEntryInDataList(m_dataUserStore, "stats.weight") == FALSE)
|
|
||||||
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "stats.weight", "0");
|
|
||||||
|
|
||||||
if(checkDataEntryInDataList(m_dataUserStore, "stats.lastCheck") == FALSE)
|
if(checkDataEntryInDataList(m_dataUserStore, "stats.lastCheck") == FALSE)
|
||||||
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "stats.lastCheck", llGetUnixTime());
|
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "stats.lastCheck", llGetUnixTime());
|
||||||
|
|
||||||
integer i;
|
integer i;
|
||||||
for (i = 1; i <= m_num_slots; i++)
|
for (i = 1; i <= m_max_slots; i++)
|
||||||
{
|
{
|
||||||
if(checkDataEntryInDataList(m_dataUserStore, "inventar.slot." + i) == FALSE)
|
if(checkDataEntryInDataList(m_dataUserStore, "inventar.slot." + i) == FALSE)
|
||||||
{
|
{
|
||||||
|
@ -462,7 +563,7 @@ integer getInventarSlot(list _userStorage, string itemName)
|
||||||
{
|
{
|
||||||
integer _currentSlot;
|
integer _currentSlot;
|
||||||
integer _freeSlot = 0;
|
integer _freeSlot = 0;
|
||||||
for(_currentSlot = 1; _currentSlot <= m_num_slots; ++_currentSlot)
|
for(_currentSlot = 1; _currentSlot <= m_max_slots; ++_currentSlot)
|
||||||
{
|
{
|
||||||
if(getDataEntryFromDataList(_userStorage, "inventar.slot." + _currentSlot) == itemName)
|
if(getDataEntryFromDataList(_userStorage, "inventar.slot." + _currentSlot) == itemName)
|
||||||
return _currentSlot;
|
return _currentSlot;
|
||||||
|
@ -481,11 +582,11 @@ integer getItemCountFromSlot(list _userStorage, integer _slot)
|
||||||
return _returnValue;
|
return _returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
integer calcPlayerWeight(list _userStorage)
|
float calcPlayerWeight(list _userStorage)
|
||||||
{
|
{
|
||||||
integer _currentSlot;
|
integer _currentSlot;
|
||||||
integer _currentWeight = 0;
|
float _currentWeight = 0;
|
||||||
for(_currentSlot = 1; _currentSlot <= m_num_slots; ++_currentSlot)
|
for(_currentSlot = 1; _currentSlot <= m_max_slots; ++_currentSlot)
|
||||||
{
|
{
|
||||||
if(getDataEntryFromDataList(_userStorage, "inventar.slot." + _currentSlot) != "")
|
if(getDataEntryFromDataList(_userStorage, "inventar.slot." + _currentSlot) != "")
|
||||||
{
|
{
|
||||||
|
@ -493,7 +594,7 @@ integer calcPlayerWeight(list _userStorage)
|
||||||
list _itemData = getDataListFromDataStorage("item." +_itemName);
|
list _itemData = getDataListFromDataStorage("item." +_itemName);
|
||||||
|
|
||||||
integer _itemCount = getItemCountFromSlot(_userStorage, _currentSlot);
|
integer _itemCount = getItemCountFromSlot(_userStorage, _currentSlot);
|
||||||
integer _itemWeight = (integer)getDataEntryFromDataList(_itemData, "weight");
|
float _itemWeight = (float)getDataEntryFromDataList(_itemData, "weight");
|
||||||
|
|
||||||
_currentWeight = _currentWeight + (_itemCount * _itemWeight);
|
_currentWeight = _currentWeight + (_itemCount * _itemWeight);
|
||||||
}
|
}
|
||||||
|
@ -502,15 +603,15 @@ integer calcPlayerWeight(list _userStorage)
|
||||||
return _currentWeight;
|
return _currentWeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
integer getMaxPlayerWeight(list _userDataStorage)
|
float getMaxPlayerWeight(list _userDataStorage)
|
||||||
{
|
{
|
||||||
integer _maxweight = (integer)getDataEntryFromDataList(m_dataStore, "stats.levels.maxweight");
|
float _maxweight = (float)getDataEntryFromDataList(m_dataStore, "stats.levels.maxweight");
|
||||||
float _xpMultiplier = (float)getDataEntryFromDataList(m_dataStore, "stats.levels.multiplier");
|
float _xpMultiplier = (float)getDataEntryFromDataList(m_dataStore, "stats.levels.multiplier");
|
||||||
|
|
||||||
list _levelData = calcLevelData(_userDataStorage);
|
list _levelData = calcLevelData(_userDataStorage);
|
||||||
integer _playerLevel = llList2Integer(_levelData, 0) + 1;
|
integer _playerLevel = llList2Integer(_levelData, 0) + 1;
|
||||||
|
|
||||||
integer _playerMaxWight = _maxweight * (_playerLevel * _xpMultiplier);
|
float _playerMaxWight = _maxweight + ((float)_playerLevel * _xpMultiplier);
|
||||||
|
|
||||||
return _playerMaxWight;
|
return _playerMaxWight;
|
||||||
}
|
}
|
||||||
|
@ -543,7 +644,7 @@ list calcLevelData(list _dataStorage)
|
||||||
refreshData()
|
refreshData()
|
||||||
{
|
{
|
||||||
integer _currentSlot;
|
integer _currentSlot;
|
||||||
for(_currentSlot = 1; _currentSlot <= m_num_slots; ++_currentSlot)
|
for(_currentSlot = 1; _currentSlot <= m_max_slots; ++_currentSlot)
|
||||||
{
|
{
|
||||||
if(getDataEntryFromDataList(m_dataUserStore, "inventar.slot." + _currentSlot) != "")
|
if(getDataEntryFromDataList(m_dataUserStore, "inventar.slot." + _currentSlot) != "")
|
||||||
{
|
{
|
||||||
|
@ -559,16 +660,14 @@ refreshData()
|
||||||
}
|
}
|
||||||
|
|
||||||
list _levelData = calcLevelData(m_dataUserStore);
|
list _levelData = calcLevelData(m_dataUserStore);
|
||||||
//llOwnerSay("leveldata " + llList2CSV(_levelData));
|
setLevelDisplayNumber(llList2Integer(_levelData, 0), llList2Integer(_levelData, 1), llList2Integer(_levelData, 2));
|
||||||
|
|
||||||
setLevelDisplayNumber(llList2Integer(_levelData, 0), llList2Integer(_levelData, 1));
|
|
||||||
|
|
||||||
float _xpBalkenValue = (float)((100 / llList2Float(_levelData, 2)) * llList2Float(_levelData, 1));
|
float _xpBalkenValue = (float)((100 / llList2Float(_levelData, 2)) * llList2Float(_levelData, 1));
|
||||||
float _hpBalkenValue = (float)((llList2Integer(_levelData, 0) * 100) / 100);
|
float _hpBalkenValue = (float)((llList2Integer(_levelData, 0) * 100) / 100);
|
||||||
integer _food = (integer)getDataEntryFromDataList(m_dataUserStore, "stats.essen");
|
integer _food = (integer)getDataEntryFromDataList(m_dataUserStore, "stats.essen");
|
||||||
integer _water = (integer)getDataEntryFromDataList(m_dataUserStore, "stats.wasser");
|
integer _water = (integer)getDataEntryFromDataList(m_dataUserStore, "stats.wasser");
|
||||||
integer _hp = (integer)getDataEntryFromDataList(m_dataUserStore, "stats.hp");
|
integer _hp = (integer)getDataEntryFromDataList(m_dataUserStore, "stats.hp");
|
||||||
|
integer _level = llList2Integer(_levelData, 0);
|
||||||
if(_food > 100)
|
if(_food > 100)
|
||||||
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "stats.essen", "100");
|
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "stats.essen", "100");
|
||||||
|
|
||||||
|
@ -587,16 +686,28 @@ refreshData()
|
||||||
if(_hp < 0)
|
if(_hp < 0)
|
||||||
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "stats.hp", "0");
|
m_dataUserStore = setDataEntryInDataList(m_dataUserStore, "stats.hp", "0");
|
||||||
|
|
||||||
setBalkenValue("wasser", (integer)getDataEntryFromDataList(m_dataUserStore, "stats.wasser"));
|
setBalkenValue("wasser", _water);
|
||||||
setBalkenValue("essen", (integer)getDataEntryFromDataList(m_dataUserStore, "stats.essen"));
|
setBalkenValue("essen" , _food);
|
||||||
setBalkenValue("hp", (integer)getDataEntryFromDataList(m_dataUserStore, "stats.hp"));
|
setBalkenValue("hp" , _hp);
|
||||||
setBalkenValue("xp", _xpBalkenValue);
|
setBalkenValue("xp" , _xpBalkenValue);
|
||||||
setBalkenValue("weight", (integer)getMaxPlayerWeight(getDataListFromDataStorage("game.hud.player." + llGetOwner())));
|
setBalkenValue("weight", (integer)(100 / (float)getMaxPlayerWeight(getDataListFromDataStorage("game.hud.player." + llGetOwner())) * (float)calcPlayerWeight(m_dataUserStore)));
|
||||||
|
|
||||||
saveDataListToDataStorage(m_dataUserStore, "game.hud.player." + llGetOwner());
|
saveDataListToDataStorage(m_dataUserStore, "game.hud.player." + llGetOwner());
|
||||||
//osMessageAttachments(llGetOwner(), "SHOW" + NAME, [ATTACH_HEAD], 0);
|
osMessageAttachments(llGetOwner(), "LEVEL:" + (string)_level, [ATTACH_HEAD], 0);
|
||||||
osMessageAttachments(llGetOwner(), "LEVEL:" + (string)llList2Integer(_levelData, 0), [ATTACH_HEAD], 0);
|
|
||||||
osMessageAttachments(llGetOwner(), "HP:" + getDataEntryFromDataList(m_dataUserStore, "stats.hp"), [ATTACH_HEAD], 0);
|
osMessageAttachments(llGetOwner(), "HP:" + getDataEntryFromDataList(m_dataUserStore, "stats.hp"), [ATTACH_HEAD], 0);
|
||||||
|
|
||||||
|
if(m_lastlevel == -1)
|
||||||
|
m_lastlevel = _level;
|
||||||
|
|
||||||
|
if(_level > m_lastlevel)
|
||||||
|
{
|
||||||
|
m_lastlevel = _level;
|
||||||
|
osMessageAttachments(llGetOwner(), "LEVEL_UP:" + (string)_level, [ATTACH_HEAD], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if((integer)checkDataEntryInDataList(m_dataStore, "enable") == FALSE || (integer)getDataEntryFromDataList(m_dataStore, "enable") == FALSE)
|
||||||
|
osMessageAttachments(llGetOwner(), "4CGS-DISABLE", [ATTACH_HUD_CENTER_1, ATTACH_HUD_CENTER_2], 0);
|
||||||
|
else
|
||||||
|
osMessageAttachments(llGetOwner(), "4CGS-ENABLE", [ATTACH_HUD_CENTER_1, ATTACH_HUD_CENTER_2], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
useAction(string _itemName, string _actionName, integer _slot, key _avatar, integer _other)
|
useAction(string _itemName, string _actionName, integer _slot, key _avatar, integer _other)
|
||||||
|
@ -756,9 +867,11 @@ setInventarSlotImage(integer slot, key imageID, integer alpha)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setBalkenValue(string balken, integer count) // integer max
|
setBalkenValue(string balken, integer count) // integer max
|
||||||
{
|
{
|
||||||
if(getDataEntryFromDataList(m_dataStore, "stats.enable") != "TRUE")
|
if((integer)getDataEntryFromDataList(m_dataStore, "stats.enable") != TRUE)
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
if(getDataEntryFromDataList(m_current, "balken."+ balken) != (string)count)
|
if(getDataEntryFromDataList(m_current, "balken."+ balken) != (string)count)
|
||||||
|
@ -771,7 +884,8 @@ setBalkenValue(string balken, integer count) // integer max
|
||||||
if(count == 0)
|
if(count == 0)
|
||||||
llSetLinkAlpha(_linkCount, 0, 4);
|
llSetLinkAlpha(_linkCount, 0, 4);
|
||||||
|
|
||||||
float _balkenValue = (1.0 / 100) * count;
|
float _balkenValue = ((1.0 / 100) * (float)count);
|
||||||
|
// llOwnerSay((string)_balkenValue + " " + (string)count);
|
||||||
llSetLinkPrimitiveParamsFast(_linkCount, [PRIM_SLICE,< 0, _balkenValue, 0>]);
|
llSetLinkPrimitiveParamsFast(_linkCount, [PRIM_SLICE,< 0, _balkenValue, 0>]);
|
||||||
|
|
||||||
m_current = setDataEntryInDataList(m_current, "balken."+ balken, (string)count);
|
m_current = setDataEntryInDataList(m_current, "balken."+ balken, (string)count);
|
||||||
|
@ -797,12 +911,11 @@ setInventarSlotCountNumber(integer slot, integer count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setLevelDisplayNumber(integer level, integer xp)
|
setLevelDisplayNumber(integer level, integer xp, integer level_xp)
|
||||||
{
|
{
|
||||||
if(getDataEntryFromDataList(m_current, "level") != (string)level + (string)xp + (string)m_min)
|
if(getDataEntryFromDataList(m_current, "level") != (string)level + (string)xp + (string)m_min)
|
||||||
{
|
{
|
||||||
integer _linkCount = osGetLinkNumber("level-anzeige");
|
llSetLinkPrimitiveParamsFast(osGetLinkNumber("level-anzeige"), [PRIM_TEXT, osFormatString(m_lang_leveltext, [(string)level, (string)xp + "/" + (string)level_xp ]), <0, 1, .2>, !m_min]);
|
||||||
llSetLinkPrimitiveParamsFast(_linkCount, [PRIM_TEXT, osFormatString(m_lang_leveltext, [(string)level, (string)xp]), <0, 1, .2>, !m_min]);
|
|
||||||
m_current = setDataEntryInDataList(m_current, "level", (string)level + (string)xp) + (string)m_min;
|
m_current = setDataEntryInDataList(m_current, "level", (string)level + (string)xp) + (string)m_min;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue