void LuaChatForm::OnOptionClicked(int option) { SetMoney(1000000000); lua_State *l = Lua::manager->GetLuaState(); LUA_DEBUG_START(l); lua_getfield(l, LUA_REGISTRYINDEX, "PiAdverts"); assert(lua_istable(l, -1)); lua_pushinteger(l, GetAdvert()->ref); lua_gettable(l, -2); assert(!lua_isnil(l, -1)); lua_getfield(l, -1, "onChat"); assert(lua_isfunction(l, -1)); LuaObject<LuaChatForm>::PushToLua(this); lua_pushinteger(l, GetAdvert()->ref); lua_pushinteger(l, option); pi_lua_protected_call(l, 3, 0); lua_pop(l, 2); LUA_DEBUG_END(l, 0); }
SpaceStation::SpaceStation(const SBody *sbody): ModelBody() { m_sbody = sbody; m_lastUpdatedShipyard = 0; m_numPoliceDocked = Pi::rng.Int32(3,10); for (int i=1; i<Equip::TYPE_MAX; i++) { if (Equip::types[i].slot == Equip::SLOT_CARGO) { m_equipmentStock[i] = Pi::rng.Int32(0,100) * Pi::rng.Int32(1,100); } else { if (Equip::types[i].techLevel <= Pi::currentSystem->m_techlevel) m_equipmentStock[i] = Pi::rng.Int32(0,100); else m_equipmentStock[i] = 0; } } for (int i=0; i<MAX_DOCKING_PORTS; i++) { m_shipDocking[i].ship = 0; m_shipDocking[i].stage = 0; m_shipDocking[i].stagePos = 0; m_openAnimState[i] = 0; m_dockAnimState[i] = 0; } SetMoney(1000000000); InitStation(); }
SpaceStation::SpaceStation(const SystemBody *sbody): ModelBody() { m_sbody = sbody; m_lastUpdatedShipyard = 0; m_numPoliceDocked = Pi::rng.Int32(3,10); m_bbCreated = false; m_bbShuffled = false; m_oldAngDisplacement = 0.0; m_doorAnimationStep = m_doorAnimationState = 0.0; SetMoney(1000000000); InitStation(); }
void CPlayer::AddReward(std::string name, float amount) { m_Rewards.push_back(name + "|r"); m_PendingReward += amount; if (m_PendingReward >= 1) { uint32 Reward = m_PendingReward * 10000.f; m_PendingReward = 0; SetMoney(GetMoney() + Reward); BoxChat << "You were rewarded with " << GetGoldString(Reward) << " for the kills of " << GetRewardNames(false) << std::endl; m_Rewards.clear(); } }
JohanCity::JohanCity(int gridsize,float edgelen) { // Resize grid Resize(gridsize,edgelen); // Misc. checkid = 0; timingreport[0] = 0; clock = new Clock(false); // Set default user values SetPopulation(0); SetMoney(50000); SetR(50); // beginpop SetC(10); // 1 kantoortje? SetI(70); }
SpaceStation::SpaceStation(const SystemBody *sbody): ModelBody() { m_sbody = sbody; m_lastUpdatedShipyard = 0; m_numPoliceDocked = Pi::rng.Int32(3,10); m_bbCreated = false; m_bbShuffled = false; for (int i=0; i<MAX_DOCKING_PORTS; i++) { m_shipDocking[i].ship = 0; m_shipDocking[i].stage = 0; m_shipDocking[i].stagePos = 0; } m_dockingLock = false; m_oldAngDisplacement = 0.0; SetMoney(1000000000); InitStation(); }
void CFSPlayer::SetAutoDonate(CFSPlayer* pplayer, Money amount, bool bSend) { assert (pplayer != this); ShipID sidDonateBy = GetShipID(); ShipID sidDonateTo; IshipIGC* pship; if (pplayer) { pship = pplayer->GetIGCShip()->GetAutoDonate(); if (pship == NULL) pship = pplayer->GetIGCShip(); else { assert (pship->GetAutoDonate() == NULL); CFSPlayer* pplayerNew = ((CFSShip*)(pship->GetPrivateData()))->GetPlayer(); if (pplayerNew == this) { //We are trying to autodonate to someone who is already autodonating to us //Tell them to stop first (but don't send any messages) pplayer->SetAutoDonate(NULL, 0, false); //and then set our autodonate to go to them anyhow pship = pplayer->GetIGCShip(); } else { //The person we would like to donate to was already donating to someone else //donate to who ever they were donating to. pplayer = pplayerNew; } } assert (pship->GetAutoDonate() == NULL); assert (pplayer->GetIGCShip() == pship); sidDonateTo = pship->GetObjectID(); if (amount != 0) { TrapHack(GetMoney() >= amount); pplayer->SetMoney(amount + pplayer->GetMoney()); SetMoney(GetMoney() - amount); } } else { pship = NULL; sidDonateTo = NA; } GetIGCShip()->SetAutoDonate(pship); BEGIN_PFM_CREATE(g.fm, pfmAD, S, AUTODONATE) END_PFM_CREATE pfmAD->sidDonateBy = sidDonateBy; pfmAD->sidDonateTo = sidDonateTo; pfmAD->amount = amount; if (bSend) g.fm.SendMessages(CFSSide::FromIGC(GetSide())->GetGroup(), FM_GUARANTEED, FM_FLUSH); }