Detailed changes for version 1.023
Total RP 2 :: Development :: Discussion
Page 1 of 1
Detailed changes for version 1.023
You can find below all the detailed changes, explained, made to the code for version 1.023
- Functions added to totalRP2/totalRP2_API.lua:
- TRP2_SimplifyNameIfPlayer(unit):
This function is used when we have the name of a unit (the player or an other player), and we are going to use it to get informations from Total RP. Unit is a string with the format Player-Realm.
The function compare the unit it received and the current player. Other players are now always stored in the registry as Player-Realm, but the player himself is stored as Player. When wanting to get information about a unit, format has to be Player-Realm for an other player and Player for the current player.- Code:
function TRP2_SimplifyNameIfPlayer(unit)
local playerName, playerRealm = UnitFullName("player");
local senderName = string.gsub(unit, "-.*","");
local senderRealm = string.gsub(unit, ".*-","")
if senderRealm == playerRealm and senderName == playerName then
return playerName;
else
return unit;
end
end
- TRP2_UnitNameWithRealm(unit):
As we are now always using Player-Realm to identify a player, this function is aimed to replace the old UnitName(unit) that only return the realm if the unit is from another realm. This function will always return the unit name as Player-Realm (if the other player is from the same realm as the current player, realm will be nil after UnitName(unit), then it will receive the current realm name without spaces.- Code:
function TRP2_UnitNameWithRealm(unit)
local name, realm = UnitName(unit);
if not realm then
realm = GetRealmName():gsub("%s+", "");
end
if name and realm then
return name.."-"..realm;
else
return nil;
end
end
- TRP2_RemoveRealm(name):
Purely aesthetic, this function return the name of a player without the realm at the end. It is used on for display purpose for default values (like TRP2_GetWithDefaut(TRP2_GetInfo(name,"Registre",{}),"Prenom",TRP2_RemoveRealm(name)) )- Code:
function TRP2_RemoveRealm(name)
return string.gsub(name, "-.*","");
end
- Changes to totalRP2/totalRP2_UI_Registre.xml:
- GameTooltip, Line 2437:
replaced- Code:
if self.Nom ~= UnitName(self.TT_Type) then
- Code:
if self.Nom ~= TRP2_UnitNameWithRealm(self.TT_Type) then
- Entire code:
- Code:
<GameTooltip name="TRP2_PersoTooltip" frameStrata="TOOLTIP" parent="UIParent" inherits="GameTooltipTemplate">
<Scripts>
<OnUpdate>
if self.Nom and self.TT_Type and not self.isFading then
if self.Nom ~= TRP2_UnitNameWithRealm(self.TT_Type) then
self.isFading = true;
self.Nom = nil;
self:FadeOut();
TRP2_MountTooltip.isFading = true;
TRP2_MountTooltip:FadeOut();
end
end
</OnUpdate>
<OnHide>
self.isFading = nil;
TRP2_MountTooltip.isFading = nil;
</OnHide>
</Scripts>
</GameTooltip>
- Changes to totalRP2_Auras/totalRP2_Auras_Main.lua:
- TRP2_UpdateAuraTargetFrame():
replaced- Code:
if not TRP2_Module_Interface["BannedID"][k] and (auraInfo ~= nil or TRP2_AuraTargetFrame.target==TRP2_Joueur or TRP2_AuraTargetFrame.master == TRP2_Joueur) then
- Code:
if not TRP2_Module_Interface["BannedID"][k] and (auraInfo ~= nil or TRP2_AuraTargetFrame.target==TRP2_Joueur.."-"..GetRealmName():gsub("%s+", "") or TRP2_AuraTargetFrame.master == TRP2_Joueur.."-"..GetRealmName():gsub("%s+", "")) then
- Changes to totalRP2_Creation/totalRP2_Creation_Objet.lua (version 1.022):
- TRP2_CreateObjetTabCreation:
replaced- Code:
objet["Qualite"] = math.floor(TRP2_DefautToNil(tonumber(TRP2_CreationFrameObjetFrameGeneralQualite:GetValue()),1));
- Code:
objet["Qualite"] = TRP2_DefautToNil(TRP2_GetInt(TRP2_CreationFrameObjetFrameGeneralQualite:GetValue()),1);
- Changes to totalRP2_Interface/totalRP2_Interface_GestionChatFrame.lua:
- TRP2_ChatFrame_OnEvent():
- Code:
local coloredName = GetColoredName(event, texte, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
We are now only calling GetColoredName() if we are in the context of a discussion- Code:
local coloredName;
if event=="CHAT_MSG_SAY" or event=="CHAT_MSG_PARTY" or event=="CHAT_MSG_RAID" or event=="CHAT_MSG_GUILD" or event=="CHAT_MSG_YELL"
or event=="CHAT_MSG_PARTY_LEADER" or event=="CHAT_MSG_RAID_LEADER" or event=="CHAT_MSG_OFFICER" or event=="CHAT_MSG_EMOTE"
or event=="CHAT_MSG_TEXT_EMOTE" or event=="CHAT_MSG_WHISPER" or event=="CHAT_MSG_WHISPER_INFORM" then
coloredName = GetColoredName(event, texte, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
end
lines 121, 122, 127, 129, 130, 134, 141, 155, 181, 263, 264, 268, 270, 271, 274, 275, 285, 286, 290, 292, 293, 296
I've accidentally deleted the function to delete color code in the player name before line 134. The following code needs to be added back (and optimized)- Code:
if TRP2_GetConfigValueFor("UseColorInChat",true) then
else
personnage = TRP2_DeleteColorCode(personnage);
end
- Changes to totalRP2_Interface/totalRP2_Interface_Main.lua:
- TRP2_PlacerIconeCible():
replaced- Code:
local nom, royaume = UnitName("target");
if royaume then
nom = nom.."-"..royaume;
end
- Code:
nom = TRP2_UnitNameWithRealm("target");
replaced- Code:
if nom == TRP2_Joueur then
- Code:
if TRP2_SimplifyNameIfPlayer(nom) == TRP2_Joueur then
replaced- Code:
TRP2_SetTooltipForFrame(TRP2_TargetButton,TRP2_TargetButton,"BOTTOMRIGHT",10,0,"{v}"..TRP2_nomComplet(nom,true));
- Code:
TRP2_SetTooltipForFrame(TRP2_TargetButton,TRP2_TargetButton,"BOTTOMRIGHT",10,0,"{v}"..TRP2_nomComplet(TRP2_Joueur,true));
added- Code:
maitre = TRP2_SimplifyNameIfPlayer(maitre);
- Code:
local nomPet, maitre = TRP2_RecupTTInfo();
if nomPet and maitre then
- TRP2_MouseOverTooltip():
replaced- Code:
local Nom, royaume = UnitName(TT_Type);
if royaume then
Nom = Nom.."-"..royaume;
end
- Code:
local Nom = TRP2_UnitNameWithRealm (TT_Type);
replaced- Code:
TRP2_TraiterTooltipPerso(Nom,infoTab,i,TT_Type,royaume);
- Code:
TRP2_TraiterTooltipPerso(TRP2_SimplifyNameIfPlayer(Nom),infoTab,i,TT_Type,royaume);
replaced- Code:
nomMaitre = TRP2_IsolerNomMaitre(nomMaitre);
- Code:
nomMaitre = TRP2_SimplifyNameIfPlayer(TRP2_IsolerNomMaitre(nomMaitre));
- Changes to totalRP2_Inventaire/totalRP2_Inventaire_GestionSlot.lua:
- TRP2_SlotOnDragStop() and TRP2_GoldOnDragStop():
replaced- Code:
local name, royaume = UnitName("mouseover");
if royaume then
name = name.."-"..royaume;
end
- Code:
local name = TRP2_UnitNameWithRealm("mouseover");
- Changes to totalRP2_Inventaire/totalRP2_Inventaire_Main.lua:
- TRP2_StartExchange() and TRP2_StartExchangeAsk():
replaced- Code:
local mouseover, realm = UnitName("mouseover");
if realm then
mouseover = mouseover.."-"..realm;
end
local target, realm = UnitName("target");
if realm then
target = target.."-"..realm;
end
- Code:
local mouseover = TRP2_UnitNameWithRealm("mouseover");
local target = TRP2_UnitNameWithRealm("mouseover");
replaced- Code:
elseif sender == UnitName("target") then
- Code:
elseif sender == target then
- TRP2_ExchangeReceiveTab():
replaced- Code:
if tostring(tab[1]) ~= TRP2_Joueur and tostring(tab[1]) ~= TRP2_Joueur.."-"..TRP2_Royaume then
- Code:
if tostring(tab[1]) ~= TRP2_Joueur.."-"..GetRealmName():gsub("%s+", "") then
Possible future optimisation :- Code:
if tostring(TRP2_SimplifyNameIfPlayer(tab[1])) ~= TRP2_Joueur then
- Changes to totalRP2_Language/totalRP2_Language_Main.lua:
- TRP2_TransformMessage():
added- Code:
TRP2_OpenPanelLangues();
removed that big block of nonsense- Code:
--if (TRP2_GetInfo(TRP2_Joueur,"Langues",{}) and TRP2_GetInfo(TRP2_Joueur,"Langues",{})[ID] and TRP2_GetInfo(TRP2_Joueur,"Langues",{})[ID]["bMother"]) or string.find(msg,"|H") or string.find(TRP2_DIALBASETAB[TRP2_enRace],ID) or string.sub(msg,1,1) == "|" then
englishFaction, localizedFaction = UnitFactionGroup("player"); --Added by Ephedrae. ^ That breaks native race languages. Like Night elfs trying to speak darnassian ...
if (TRP2_GetInfo(TRP2_Joueur,"SelectDial", select(1, GetDefaultLanguage("player"))) == GetDefaultLanguage("player") and englishFaction == "Alliance") or (TRP2_GetInfo(TRP2_Joueur,"SelectDial", select(1, GetDefaultLanguage("player"))) == GetDefaultLanguage("player") and englishFaction == "Horde") then --Exclude common/orcish from translation on their respective factions.
TRP2_DernierePhrase = "";--Added by Lixxel. Clear out translation requests.
return msg;--and just return the message. No translations!
end
- Code:
local msgTransformed = "";
replaced- Code:
msg = msg..stringTab[texte];
- Code:
msgTransformed = msgTransformed..stringTab[texte];
- Code:
msg = "["..TRP2_GetWithDefaut(LangueTab,"Entete",ID).."] "..msg;
- Code:
msgTransformed = "["..TRP2_GetWithDefaut(LangueTab,"Entete",ID).."] "..msgTransformed;
add at the end of the function- Code:
-- Modified by Ellypse in version 1.023
-- Return the original message if native language
if TRP2_GetInfo(TRP2_Joueur,"Langues",{})[ID]["bMother"] or string.find(msg,"|H") or string.find(TRP2_DIALBASETAB[TRP2_enRace],ID) or string.sub(msg,1,1) == "|" then
-- TRP2_GetInfo(TRP2_Joueur,"SelectDial", select(1, GetDefaultLanguage("player"))) -> Currently selected language localized
-- GetDefaultLanguage("player") -> Faction language (Orcish or common) localized
if TRP2_GetInfo(TRP2_Joueur,"SelectDial", select(1, GetDefaultLanguage("player"))) == GetDefaultLanguage("player") then
TRP2_DernierePhrase = "";--Added by Lixxel. Clear out translation requests.
end
return msg;--and just return the message. No translations!
end
return msgTransformed;
The first condition means we are going to send the message untouched in that case. So for :- Code:
TRP2_GetInfo(TRP2_Joueur,"Langues",{})[ID]["bMother"]
- Code:
string.find(msg,"|H")
- Code:
string.sub(msg,1,1) == "|"
- Code:
string.find(TRP2_DIALBASETAB[TRP2_enRace],ID)
then, the second condition- Code:
if TRP2_GetInfo(TRP2_Joueur,"SelectDial", select(1, GetDefaultLanguage("player"))) == GetDefaultLanguage("player") then
If all the above are not true, we return the transformed message.
- Changes to totalRP2_PlayerInfo/totalRP2_PlayerInfo_Main.lua:
- TRP2_TraiterTooltipPet():
added- Code:
NomMaitre = TRP2_SimplifyNameIfPlayer(NomMaitre);
replaced- Code:
if string.find(infoTab[2],NomMaitre) then
- Code:
if string.find(infoTab[2],TRP2_RemoveRealm(NomMaitre)) or string.find(infoTab[3],NomMaitre:gsub("-.*", "")) then
replaced- Code:
local Phrase = "{w}< "..infoTab[2].." >";
- Code:
local Phrase ="";
if string.find(infoTab[2],TRP2_RemoveRealm(NomMaitre)) then
Phrase = "{w}< "..infoTab[2].." >";
else
Phrase = "{w}< "..infoTab[3].." >";
end
replaced- Code:
Phrase = string.gsub(Phrase,NomMaitre,"{o}"..NomMaitre.."{w}");
- Code:
Phrase = string.gsub(Phrase,NomMaitre,"{o}"..TRP2_RemoveRealm(NomMaitre).."{w}");
- TRP2_DD_PotraitIconeClick() (by the way, there's a typo in the functions name, might be corrected some day):
replaced- Code:
if not nom then
nom, royaume = UnitName("target");
if royaume then
nom = nom.."-"..royaume;
end
end
- Code:
if not nom then
nom, royaume = UnitName("target");
if not royaume then
royaume = GetRealmName():gsub("%s+", "");
end
nom = nom.."-"..royaume;
end
- Code:
local name = TRP2_UnitNameWithRealm("target");
replaced- Code:
if nom == TRP2_Joueur then
- Code:
if nom == TRP2_Joueur.."-"..GetRealmName():gsub("%s+", "") then
replaced- Code:
info.text = TRP2_CTS(TRP2_FT(TRP2_LOC_FICHE,nom));
- Code:
info.text = TRP2_CTS(TRP2_FT(TRP2_LOC_FICHE,TRP2_Joueur));
- Changes to totalRP2_Registre/totalRP2_Registre_Main.lua:
- TRP2_nomComplet():
added- Code:
local realm = string.gsub(nom,".*-","");
removed- Code:
if royaume then
Prenom = string.gsub(nom,"-"..royaume,"");
end
added- Code:
Prenom = string.gsub(Prenom, "-"..realm, "");
- TRP2_IsolerNomMaitre():
added- Code:
if not string.find(nomMaitre,"-") then
nomMaitre = nomMaitre.."-"..GetRealmName():gsub("%s+", "");
end
Ellypse- Admin
- Posts : 215
Join date : 2013-09-26
Age : 33
Location : Paris, France
Total RP 2 :: Development :: Discussion
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|