|
Je vous déjà, les différentes fonctions du puma et je les ai réadapté pour qu'il gère que la database Bioware.
L'objet UniversalMind est toujours utile pour certaines fonctions que j'ai laissé. De toute façon , ce n'est pas un objet qui va vous tuer .
C'est du style, pour continuer à gérer la sauvegarde toutes les X minutes de la position du joueur.
Enfin bon, je n'ai pas eu le temps de tout vérifier étant sur plein de truc en même temps, donc si vous voulez essayer .
Vous avez juste à renommer l'ancien pwum_functions en pwum_functions2. De mettre le nouveau en pwum_functions.
Et de compiler le moduler , et choisir que compiler les scripts. Cela vous prendra moins de temps que de tout recommencer .
Allez c'est partie:
//*********************************** // PWUM_FUNCTIONS // SCRIPT: Adaptation de la Bibliothque du PUMA pour la database de bioware // FAIT PAR RAT POUR MASKADO ET PAORN [url]http://paorn.nexusjdr.com[/url] //************************************ // ******************************************** // // FUNCTION DECLARATIONS // ******************************************** // // Stores current locations for all PCs set to // save location (default=save, change with // SetPCToNotSaveLocation()) // fTimercount indicates how many seconds to delay // before firing again. // 0.0 = one time shot. void PWUMLocationTimer(float fTimerCount=0.0); // Stores current game date. // fTimercount indicates how many seconds to delay // before firing again. // 0.0 = one time shot. void PWUMDateTimer(float fTimerCount=0.0); // Returns number of days from 0/0/0 // iOffset = how many days to add to "today" // (i.e. 0=today, 1=tomorrow, 7=next week) int GetOffsetGameDate(int iOffset=0); // Stores Integer in log (for future sessions) // var_name = name of variable // var_val = integer value to store // iExpire = how many days from now this variable should // be removed from the system. // iToken sets whether or not this variable's expiration // date should update every time it is used (0=yes, 1=no) // iExtend indicates how many days this variable should // be updated if it is to be updated. void SetPWUMInt(string var_name,int var_val,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID); // Stores String in log (for future sessions) // var_name = name of variable // var_val = string value to store // iExpire = how many days from now this variable should // be removed from the system. // iToken sets whether or not this variable's expiration // date should update every time it is used (0=yes, 1=no) // iExtend indicates how many days this variable should // be updated if it is to be updated. void SetPWUMString(string var_name, string var_val,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID); // Stores Float in log (for future sessions) // var_name = name of variable // var_val = float value to store // iExpire = how many days from now this variable should // be removed from the system. // iToken sets whether or not this variable's expiration // date should update every time it is used (0=yes, 1=no) // iExtend indicates how many days this variable should // be updated if it is to be updated. void SetPWUMFloat(string var_name, float var_val,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID); // Stores Integer in log (for future sessions) // var_name = name of variable // var_val = location value to store // iExpire = how many days from now this variable should // be removed from the system. // iToken sets whether or not this variable's expiration // date should update every time it is used (0=yes, 1=no) // iExtend indicates how many days this variable should // be updated if it is to be updated. void SetPWUMLocationC(string var_name, location the_loc,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID ); // Sets the game date to the value of iOffsetDate (provided // iOffsetDate is greater than the "current" date). This // is NOT "days from today" but a converted date using // GetOffsetGameDate(); void SetPWUMCalendar(int iOffsetDate); // Delete Integer from game and log (will not re-appear // next gaming session) void DeletePWUMInt(string var_name,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID ); // Delete String from game and log (will not re-appear // next gaming session) void DeletePWUMString(string var_name,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID); // Delete Float from game and log (will not re-appear // next gaming session) void DeletePWUMFloat(string var_name,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID); // Delete Location from game and log (will not re-appear // next gaming session) void DeletePWUMLocation(string var_name,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID); // Retrieve Integer saved by the system. int GetPWUMInt(string var_name,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID); // Retrieve String saved by the system. string GetPWUMString(string var_name,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID); // Retrieve Float saved by the system. float GetPWUMFloat(string var_name,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID); // Retrieve Location saved by the system. location GetPWUMLocation(string var_name,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID); // Sends a PC to their last saved location void ResumePCLocation(object oPC); // Sets a PC to save their location during // PWUMLocationTimer() calls. (This is the // default state) void SetPCToSaveLocation(object oPC); // Sets a PC to be skipped during calls to // save PC locations with PWUMLocationTimer(). void SetPCToNotSaveLocation(object oPC); //fonction replace string StrReplace(string s1, string s2, string s3); //************************* // Appel des nouvelles fonctions //************************ //LES SET void SetBanqueOr(string var_name, int var_val,string ScampagnName="BANK_DB",object oPC=OBJECT_INVALID); void SetBanqueInv(string var_name,string var_val,string ScampagnName="BANK_DB",object oPC=OBJECT_INVALID); //LES GET int GetBanqueOr(string var_name,string ScampagnName="BANK_DB",object oPC=OBJECT_INVALID); string GetBanqueInv(string var_name,string ScampagnName="BANK_DB",object oPC=OBJECT_INVALID); // GESTION DES DELETE void DeleteBanqueOr(string var_name,string ScampagnName="BANK_DB",object oPC=OBJECT_INVALID); void DeleteBanqueInv(string var_name,string ScampagnName="BANK_DB",object oPC=OBJECT_INVALID); //************************** // Code pour PAORN //*************************** //************************* // Appel pour les Quetes //************************ //LES SET void SetQueteInt(string var_name, int var_val,string ScampagnName="QUETES_DB",object oPC=OBJECT_INVALID); void SetQueteStr(string var_name,string var_val,string ScampagnName="QUETES_DB",object oPC=OBJECT_INVALID); //LES GET int GetQueteInt(string var_name,string ScampagnName="QUETES_DB",object oPC=OBJECT_INVALID); string GetQueteStr(string var_name,string ScampagnName="QUETES_DB",object oPC=OBJECT_INVALID); // GESTION DES DELETE void DeleteQueteInt(string var_name,string ScampagnName="QUETES_DB",object oPC=OBJECT_INVALID); void DeleteQueteStr(string var_name,string ScampagnName="QUETES_DB",object oPC=OBJECT_INVALID);
// ******************************************** // // UTILITIES (used by functions below) // ******************************************** // string StrReplace(string s1, string s2, string s3) { int nTemp; int nL = GetStringLength(s3); int nLength = GetStringLength(s1); string sTemp; string sR = "";
while ((nTemp = FindSubString(s3, s1)) >= 0) { sTemp = GetStringLeft(s3, nTemp); s3 = GetStringRight(s3, nL - nLength - nTemp); sR = sR + sTemp + s2; nL = GetStringLength(s3); } sR+=s3;
return sR; }
void PWUMLocationTimer(float fTimerCount=0.0) { object oPC = GetFirstPC(); string sPCLocation;
// Loop through each PC while (GetIsPC(oPC)) { // If PC is currently setup to save location if (GetLocalInt(oPC, "nSaveStatus") == 0) { // store the PC location sPCLocation = GetPCPlayerName(oPC) + GetName(oPC) + "CurrentLocation"; SetPWUMLocationC(sPCLocation, GetLocation(oPC)); SendMessageToPC(oPC, "** Votre position a ete sauvegarde **"); } oPC = GetNextPC(); }
/* If this is not a one-shot call, recall this script after the directed delay */ if (fTimerCount > 0.0) DelayCommand(fTimerCount, PWUMLocationTimer(fTimerCount)); }
void PWUMDateTimer(float fTimerCount=0.0) { SetPWUMInt("iPWUMDate", GetOffsetGameDate()); /* If this is not a one-shot call, recall this script after the directed delay */ if (fTimerCount > 0.0) DelayCommand(fTimerCount, PWUMDateTimer(fTimerCount)); }
int GetOffsetGameDate(int iOffset=0) { /* If a negative number was given then this variable does not automatically expire. */ if (iOffset < 0) return -1; else /* Otherwise, return the number of days from "0/0/0". Which means if a zero was sent, the variable expires at the end of the current game day.*/ { // Get the game calendar date int iYear=GetCalendarYear(); int iMonth=GetCalendarMonth(); int iDay=GetCalendarDay(); // Add to the appropriate integer until iOffset == 0 while (iOffset > 335) { iYear++; iOffset -= 336; } while (iOffset > 27) { iMonth++; iOffset -= 28; } while (iOffset > 0) { iDay++; iOffset--; } /* Now, if we have more than 28 days, roll the month, and if we have more than 12 months, roll the year - due to the way the year, month, and days were added above, it should be impossible to have more than 24 months or 56 days. */ if (iDay > 28) { iDay -= 28; iMonth++; } if (iMonth > 12) { iMonth -= 12; iYear++; } return iYear*336 + iMonth*28 + iDay; } }
// ******************************************** // // SET (WRITE) FUNCTIONS // ******************************************** //
void SetPWUMInt(string var_name,int var_val,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID) { //object umObject = GetLocalObject(GetModule(), "um_object");
SetCampaignInt(ScampagnName,var_name+ "Int",var_val,oPC);
}
void SetPWUMString(string var_name, string var_val,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID) { var_val=StrReplace("\n","°°",var_val); //object umObject = GetLocalObject(GetModule(), "um_object"); SetCampaignString (ScampagnName,var_name+ "Str",var_val,oPC); }
void SetPWUMFloat(string var_name, float var_val,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID) { //object umObject = GetLocalObject(GetModule(), "um_object"); SetCampaignFloat(ScampagnName,var_name+ "Flt",var_val,oPC); }
void SetPWUMLocationC(string var_name, location the_loc,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID ) { SetCampaignLocation(ScampagnName,var_name + "LOC",the_loc,oPC); }
void SetPWUMCalendar(int iOffsetDate) { int iToday=GetOffsetGameDate(0); /* Only set the date if the saved date is after the start of the module. */ if (iOffsetDate > iToday) { // Get "zero" date int iYear=0; int iMonth=0; int iDay=0; // Add to the appropriate integer until iOffset == 0 while (iOffsetDate > 335) { iYear++; iOffsetDate -= 336; } while (iOffsetDate > 27) { iMonth++; iOffsetDate -= 28; } while (iOffsetDate > 1) { iDay++; iOffsetDate--; } /* Now, if we have more than 28 days, roll the month, and if we have more than 12 months, roll the year - due to the way the year, month, and days were added above, it should be impossible to have more than 24 months or 56 days. */ if (iDay > 28) { iDay -= 28; iMonth++; } if (iMonth > 12) { iMonth -= 12; iYear++; } SetCalendar(iYear, iMonth, iDay); } }
// ******************************************** // // DELETE (REMOVE) FUNCTIONS // ******************************************** //
void DeletePWUMInt(string var_name,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID ) { DeleteCampaignVariable(ScampagnName,var_name+ "Int",oPC); }
void DeletePWUMString(string var_name,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID) { DeleteCampaignVariable(ScampagnName,var_name+ "Str",oPC); }
void DeletePWUMFloat(string var_name,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID) { DeleteCampaignVariable(ScampagnName,var_name+ "Flt",oPC); }
void DeletePWUMLocation(string var_name,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID) { DeleteCampaignVariable(ScampagnName,var_name+ "LOC",oPC); }
// ******************************************** // // GET (READ) FUNCTIONS // ******************************************** //
int GetPWUMInt(string var_name,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID) { return GetCampaignInt(ScampagnName,var_name+ "Int",oPC); }
string GetPWUMString(string var_name,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID) { string retVal=GetCampaignString(ScampagnName,var_name+ "Str",oPC); retVal=StrReplace("°°","\n",retVal); return retVal; }
float GetPWUMFloat(string var_name,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID) {
return GetCampaignFloat(ScampagnName,var_name+ "Flt",oPC) ; }
location GetPWUMLocation(string var_name,string ScampagnName="PUMA_DB",object oPC=OBJECT_INVALID) { return GetCampaignLocation(ScampagnName,var_name+ "LOC",oPC); }
// ******************************************** // // PC LOCATION FUNCTIONS // ******************************************** // void ResumePCLocation(object oPC) { if (!GetIsPC(oPC)) { return; //buh-bye }
AssignCommand(oPC, ActionWait(1.0)); //2.0 is long enough to account for most network lag
// effects can be added to go with this: string sPCLocation = GetPCPlayerName(oPC) + GetName(oPC) + "CurrentLocation";
AssignCommand(oPC, ActionJumpToLocation(GetPWUMLocation(sPCLocation)));
}
void SetPCToSaveLocation(object oPC) { if (!GetIsPC(oPC)) { return; //buh-bye }
SetLocalInt(oPC, "nSaveStatus", 0); //set to save }
void SetPCToNotSaveLocation(object oPC) { if (!GetIsPC(oPC)) { return; //buh-bye }
SetLocalInt(oPC, "nSaveStatus", 1); //set to not save }
//////////////////////////////////// // NOUVELLES FONCTIONS //// // FAIT PAR RAT POUR PUMA //// ///////////////////////////////// //***************************** // FONCTIONS BANQUE //*****************************
// GESTION DES SET
void SetBanqueOr(string var_name, int var_val,string ScampagnName="BANK_DB",object oPC=OBJECT_INVALID) { SetPWUMInt(var_name,var_val,ScampagnName,oPC); }
void SetBanqueInv(string var_name,string var_val,string ScampagnName="BANK_DB",object oPC=OBJECT_INVALID) { SetPWUMString(var_name,var_val,ScampagnName,oPC); }
// GESTION DES GET
int GetBanqueOr(string var_name,string ScampagnName="BANK_DB",object oPC=OBJECT_INVALID) { return GetPWUMInt(var_name,ScampagnName,oPC);
}
string GetBanqueInv(string var_name,string ScampagnName="BANK_DB",object oPC=OBJECT_INVALID) { return GetPWUMString(var_name,ScampagnName,oPC); }
// GESTION DES DELETE
void DeleteBanqueOr(string var_name,string ScampagnName="BANK_DB",object oPC=OBJECT_INVALID) { DeletePWUMInt(var_name,ScampagnName,oPC); }
void DeleteBanqueInv(string var_name,string ScampagnName="BANK_DB",object oPC=OBJECT_INVALID) { DeletePWUMString(var_name,ScampagnName,oPC); }
//////////////////////////////// // Code pour PAORN /// //////////////////////////////
//***************************** // FONCTIONS QUETES //*****************************
// GESTION DES SET
void SetQueteInt(string var_name, int var_val,string ScampagnName="QUETES_DB",object oPC=OBJECT_INVALID ) { SetPWUMInt(var_name,var_val,ScampagnName,oPC); }
void SetQueteStr(string var_name, string var_val,string ScampagnName="QUETES_DB",object oPC=OBJECT_INVALID) { SetPWUMString(var_name,var_val,ScampagnName,oPC); }
// GESTION DES GET
int GetQueteInt(string var_name,string ScampagnName="QUETES_DB",object oPC=OBJECT_INVALID) { return GetPWUMInt(var_name,ScampagnName,oPC);
}
string GetQueteStr(string var_name,string ScampagnName="QUETES_DB",object oPC=OBJECT_INVALID) { return GetPWUMString(var_name,ScampagnName,oPC); }
// GESTION DES DELETE
void DeleteQueteInt(string var_name,string ScampagnName="QUETES_DB",object oPC=OBJECT_INVALID) { DeletePWUMInt(var_name,ScampagnName,oPC); }
void DeleteQueteStr(string var_name,string ScampagnName="QUETES_DB",object oPC=OBJECT_INVALID) { DeletePWUMString(var_name,ScampagnName,oPC); }
|